Skip to content

Certbot plugin to provide dns-01 challenge support for namecheap.com update of python3

License

Notifications You must be signed in to change notification settings

abdorag/certbot-dns-namecheap

 
 

Repository files navigation

General

This plugin automates the process of completing a dns-01 challenge by creating, and subsequently removing, TXT records using the (XML-RPC-based) namecheap.com API. updated to work in python3.x


Presequence

Getting API access

Namecheap has certain requirements for activation to prevent system abuse. In order to have API enabled for your account, you should meet one of the following requirements:

  • have at least 20 domains under your account;
  • have at least $50 on your account balance;
  • have at least $50 spent within the last 2 years.

Credentials

Use of this plugin requires a configuration file containing Namecheap API credentials, obtained from your Namecheap account's API Managenment page.

# Namecheap API credentials used by Certbot
dns_namecheap_username=my-username
dns_namecheap_api_key=my-api-key

The path to this file can be provided by using the --dns-namecheap-credentials command-line argument.

Usage

  • Make sure that you have python3-full installed.
python --version
  • clone the repo anyware you want to store it
git clone  https://github.com/abdorag/certbot-dns-namecheap.git
  • go the repo dir
cd repo-dir-certbot-dns-namecheap
  • create the ini file
nano namecheap.ini

Important

  • Not recommended usage If you know what you're doing install the plugin into the same python environment like certbot.

  • Recommended usage work in isolated enviroment use this routine by creating speacial command as I will show in steps:

  • install virtual modules

sudo apt install python3-venv python3-pip
  • start virtual env and install the package
python3 -m venv ~/certbot-venv
source ~/certbot-venv/bin/activate
pip install .
  • Check that certbot discovers the plugin:
certbot plugins

you must see the package name certbot-dns-namecheap in the list

  • Now run the command:
certbot certonly \
  -a dns-namecheap \
  --dns-namecheap-credentials=/namecheap.ini \
  --agree-tos \
  -email "[email protected]" \
  -d example.com \
  --test-cert

if it works that mean you had success installing and use

  • Deactivate the virtual environment
deactivate
  • creat auto use for the virtual enviroment
nano /usr/local/bin/certbot-namecheap
#bash
#!/bin/bash
# Activate the virtual environment
source /path/to/certbot-venv/bin/activate

# Run Certbot with all arguments passed to the script
certbot "$@"

# Deactivate the virtual environment
deactivate
  • give the script excut ablity
chmod +x /usr/local/bin/certbot-namecheap

#command for tested example

certbot-namecheap [certbot commands]

certbot-namecheap certonly \
  -a dns-namecheap \
  --dns-namecheap-credentials=/dir/to/namecheap.ini \
  --agree-tos \
  --email [email protected] \
  -d '*.domain.com'

About

Certbot plugin to provide dns-01 challenge support for namecheap.com update of python3

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.8%
  • Dockerfile 1.2%