Skip to main content

deSEC DNS Authenticator plugin for Certbot

Project description

certbot-dns-desec

main branch CI test status pypi badge

⚠ This plugin is under development, API and CLI might change! ⚠

deSEC DNS Authenticator plugin for Certbot

This plugin automates the process of completing a dns-01 challenge by creating, and subsequently removing, TXT records using the deSEC DNS API.

Configuration of deSEC

Log in at deSEC and create the domain you would like to use and a token for DNS management.

Installation

This certbot plugin can be installed using pip:

python3 -m pip install certbot-dns-desec

Command Line Interface

To start using DNS authentication with deSEC, pass the following arguments on certbot's command line:

  1. --authenticator dns-desec Selects the authenticator plugin.
  2. --dns-desec-credentials <file> Specifies the file holding the deSEC API credentials (required, see below).
  3. --dns-desec-propagation-seconds Waiting time for DNS to propagate before asking the ACME server to verify the DNS record (default 5).

deSEC API Credentials

An example credentials.ini file:

dns_desec_token = token

Additionally, the URL of the deSEC API can be specified using the dns_desec_endpoint configuration option. https://desec.io/api/v1/ is the default.

The path to this file can be provided interactively or using the --dns-desec-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 token as you would the password to your deSEC account. Users who can read this file can use these credentials to issue 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).

Example Usage

To acquire a single certificate for both example.com and *.example.com:

certbot certonly \
     --authenticator dns-desec \
     --dns-desec-credentials /etc/letsencrypt/.secrets/domain.tld.ini \
     --server https://acme-v02.api.letsencrypt.org/directory \
     --agree-tos \
     --rsa-key-size 4096 \
     -d 'example.com' \
     -d '*.example.com'

Development and Testing

To test this, install the virtual environment (venv) for this repository and activate it. Register a domain $DOMAIN with desec.io, and obtain a DNS management token $TOKEN. Then run

python3 -m pip install .
TOKEN=token-you-obtained-from-desec-io
DOMAIN=domain-you-registered-at-desec-io
EMAIL=youremail@example.com
echo "dns_desec_token = $TOKEN" > desec-secret.ini
chmod 600 desec-secret.ini
certbot \
    --config-dir tmp/certbot/config \
    --logs-dir tmp/certbot/logs \
    --work-dir tmp/certbot/work \
    --test-cert \
    -d $DOMAIN -d "*.$DOMAIN" \
    --authenticator dns-desec \
    --dns-desec-credentials desec-secret.ini \
    --non-interactive --agree-tos \
    --email $EMAIL \
    certonly

Maintenance: Prepare New Release

  1. Make sure tests are okay (see GitHub actions)
  2. Commit all changes
  3. Clean up dist/ folder
  4. Set up new release version: RELEASE=x.y.z
  5. Update version to x.y.z in setup.py
  6. Commit with message "Release Version vx.y.z": git commit -p -m "Release Version v$RELEASE"
  7. Tag commit using git tag -as v$RELEASE -m "Release Version v$RELEASE"
  8. Push
    1. branch: git push
    2. tag: git push origin v$RELEASE
  9. Set environment variables GITHUB_TOKEN to a GitHub token, TWINE_USERNAME and TWINE_PASSWORD to PyPi credentials.
  10. Publish using python3 -m publish desec-io certbot-dns-desec

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-desec-0.2.2.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

certbot_dns_desec-0.2.2-py2.py3-none-any.whl (12.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file certbot-dns-desec-0.2.2.tar.gz.

File metadata

  • Download URL: certbot-dns-desec-0.2.2.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.7.0 requests/2.25.1 setuptools/57.0.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for certbot-dns-desec-0.2.2.tar.gz
Algorithm Hash digest
SHA256 e8e8ad57da2322dba98f7bdd937135217626ed9fc29dc37c801cde3b3c7e8146
MD5 4871d8912e6d0655abe959619d48c88f
BLAKE2b-256 fc8af5b7d3fc05f9c8361629c51ce544e40067146f1ca1d4f46d09d8304f2fac

See more details on using hashes here.

File details

Details for the file certbot_dns_desec-0.2.2-py2.py3-none-any.whl.

File metadata

  • Download URL: certbot_dns_desec-0.2.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.7.0 requests/2.25.1 setuptools/57.0.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for certbot_dns_desec-0.2.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 13d4537beb294ff697d5c4b0cafcb7727111c09f8e20531406dd3572a62c8b51
MD5 f05ec7c01b60e38508ddf0b7b11a7309
BLAKE2b-256 cc84510cf427ee45b23e8f9ef00a3ac5c8bba2766bbf8d205ea0b95b5528a504

See more details on using hashes here.

Supported by

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