Skip to main content

SafeDNS Authenticator plugin for Certbot

Project description

SafeDNS Authenticator plugin for Certbot

ukfast/certbot-dns-safedns - Docker image

About

This container uses the SafeDNS Authenticator plugin for Certbot. It utilizes API calls to create and remove DNS TXT records for domain ownership validation.

How to use this image

1, Create the /etc/letsencrypt to house your configuration and your certificates

mkdir -p /etc/letsencrypt

2, Create the /etc/letsencrypt/safedns.ini configuration file with the below content

certbot_dns_safedns:dns_safedns_auth_token = <YOUR API KEY HERE>
certbot_dns_safedns:dns_safedns_propagation_seconds = 60

3, Set permissions for the newly created configuration file

chmod 0600 /etc/letsencrypt/safedns.ini

4, Test run the container

docker run -it \
  -v /etc/letsencrypt:/etc/letsencrypt \
  ukfast/certbot-dns-safedns:latest \
    certonly \
      -d yourdomain.com \
      --agree-tos \
      --no-eff-email \
      --email email@yourdomain.com \
      --test-cert

Usage examples

Verify current certificates

docker run -it \
  -v /etc/letsencrypt:/etc/letsencrypt \
  ukfast/certbot-dns-safedns:latest \
    certificates

Delete a certificate

docker run -it \
  -v /etc/letsencrypt:/etc/letsencrypt \
  ukfast/certbot-dns-safedns:latest \
    delete --cert-name yourdomain.com

Renew all certificates

docker run -it \
  -v /etc/letsencrypt:/etc/letsencrypt \
  ukfast/certbot-dns-safedns:latest \
    renew

The certbot-dns-safedns Plugin

Setup

apt install certbot python3-pip
pip3 install --upgrade certbot-dns-safedns

Execution

certbot certonly --authenticator dns_safedns

Warning: Certbot might tell you that it doesn't have permissions to write to its log file. However, if you run certbot as sudo, you won't have access to the SafeDNS plugin if you didn't install the plugin as sudo.

This will result in the following error from Certbot:

Could not choose appropriate plugin: The requested dns_safedns plugin does not appear to be installed

To get around this just do:

sudo pip3 install --upgrade certbot-dns-safedns
sudo certbot certonly --authenticator dns_safedns

If you get any Python cryptography errors, such as:

ContextualVersionConflict: ...

Just make sure to upgrade your pyopenssl.

sudo pip install --upgrade pyopenssl

Credentials and Config Options

Use of this plugin can be simplified by using a configuration file containing SafeDNS API credentials, obtained from your MyUKFast account page. See also the SafeDNS API documentation.

An example safedns.ini file:

dns_safedns_auth_token = 0123456789abcdef0123456789abcdef01234567
dns_safedns_propagation_seconds = 20

The path to this file can be provided interactively or using the --dns_safedns-credentials command-line argument. Certbot records the path to this file for use during renewal, but does not store the file's contents.

CAUTION: You should protect these API credentials as you would the password to your MyUKFast account. Users who can read this file can use these credentials to issue arbitrary API calls on your behalf. Users who can cause Certbot to run using these credentials can complete a dns-01 challenge to acquire new certificates or revoke existing certificates for associated domains, even if those domains aren't being managed by this server.

Certbot will emit a warning if it detects that the credentials file can be accessed by other users on your system. The warning reads "Unsafe permissions on credentials configuration file", followed by the path to the credentials file. This warning will be emitted each time Certbot uses the credentials file, including for renewal, and cannot be silenced except by addressing the issue (e.g., by using a command like chmod 600 to restrict access to the file).

Examples

To acquire a single certificate for both example.com and *.example.com, waiting 900 seconds for DNS propagation:

certbot certonly \
  --authenticator dns_safedns \
  --dns_safedns-credentials ~/.secrets/certbot/safedns.ini \
  --dns_safedns-propagation-seconds 900 \
  -d 'example.com' \
  -d '*.example.com'

Build

The package for the SafeDNS plugin is hosted on PyPI here: https://pypi.org/project/certbot-dns-safedns/

To build and upload the package from source, first ensure you've increased the version number in setup.py.

Delete the build, dist and .egg-info directories if they are present from a previous build.

Then run:

python3 setup.py sdist bdist_wheel

Deployment

python3 -m twine upload dist/*

Warning: Use the username: __token__, along with the token registered on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

certbot-dns-safedns-0.1.35.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

certbot_dns_safedns-0.1.35-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file certbot-dns-safedns-0.1.35.tar.gz.

File metadata

  • Download URL: certbot-dns-safedns-0.1.35.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for certbot-dns-safedns-0.1.35.tar.gz
Algorithm Hash digest
SHA256 d4af8b42af6e50ff496126c499eee7ac3afcd78b95412ef72dd87c36e3e6aa34
MD5 1ef472951e91a3ae55573658326dd2eb
BLAKE2b-256 e1f30e549ff20d5f185da1416fdcf9d316e84666b06f95d8c67ec5ec18b06578

See more details on using hashes here.

File details

Details for the file certbot_dns_safedns-0.1.35-py3-none-any.whl.

File metadata

  • Download URL: certbot_dns_safedns-0.1.35-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for certbot_dns_safedns-0.1.35-py3-none-any.whl
Algorithm Hash digest
SHA256 bb7a4c50e2f1c05c805f76a2029cdfb85b4f5b18d788793d6ea350b06da50451
MD5 93c70b83783c8367e717b93cede7cf5f
BLAKE2b-256 12111f474238c6efdc4f5a58ba2e9848fb7bb595bf7518e6853e77db538937de

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page