Skip to main content

SafeDNS Authenticator plugin for Certbot

ansgroup/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

dns_safedns_auth_token = <YOUR API KEY HERE>
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 \
  ansgroup/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 \
  ansgroup/certbot-dns-safedns:latest \
    certificates

Delete a certificate

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

Renew all certificates

docker run -it \
  -v /etc/letsencrypt:/etc/letsencrypt \
  ansgroup/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 ANS Portal 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 ANS Portal 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/

The package version is generated automatically by CI from a VERSION file (not committed to source control) and is not set manually.

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

Then run:

echo "0.0.0" > VERSION  # placeholder, CI writes the real release version
uv build

Deployment

uv publish

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

Metadata

Release files for certbot-dns-safedns 0.1.60

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for certbot-dns-safedns 0.1.60
File Size Uploaded Provenance Actions
certbot_dns_safedns-0.1.60.tar.gz 6.5 kB Without provenance Details for certbot_dns_safedns-0.1.60.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for certbot-dns-safedns 0.1.60
File Interpreter ABI Platform Actions
certbot_dns_safedns-0.1.60-py3-none-any.whl Python 3 none any Details for certbot_dns_safedns-0.1.60-py3-none-any.whl

Total release size: 14.4 kB

Release files / certbot_dns_safedns-0.1.60.tar.gz

Download URL certbot_dns_safedns-0.1.60.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a8d1298d9fded94f0ebf2d93870db288e28fa95b3048b26f1ed3788095c3a3f0
BLAKE2b-256 checksum
How to use checksums
697d47efc95057bb5c5b5b266ad3dc3168eb5e0397ad51acf5a62b8f3d3c1a29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / certbot_dns_safedns-0.1.60-py3-none-any.whl

Download URL certbot_dns_safedns-0.1.60-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2dc3ffd617430292363e9c3013ed31fc5f3a91bf3a82cf920dd6d6e2f9e253b3
BLAKE2b-256 checksum
How to use checksums
df72f3802428f212a45c50085d5cfe1f5ff668ea7ea42b3dfc2ae017513f47c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for certbot-dns-safedns 0.1.60

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.60 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page