Skip to content

certbot

certbot must trust the CA's root to talk to it: point REQUESTS_CA_BUNDLE at root.crt.

Standalone (port 80)

sudo REQUESTS_CA_BUNDLE=/path/to/root.crt certbot certonly --standalone \
    --server https://ca.example.com:8443/acme/directory \
    --agree-tos --register-unsafely-without-email \
    -d web.example.com

Webroot (a web server already on port 80)

sudo REQUESTS_CA_BUNDLE=/path/to/root.crt certbot certonly --webroot -w /var/www/html \
    --server https://ca.example.com:8443/acme/directory \
    -d web.example.com

nginx plugin

sudo REQUESTS_CA_BUNDLE=/path/to/root.crt certbot --nginx \
    --server https://ca.example.com:8443/acme/directory \
    -d web.example.com

Wildcards with dns-01

With certbot's plugin for an RFC 2136 DNS server (BIND, Windows DNS with dynamic updates and others):

sudo REQUESTS_CA_BUNDLE=/path/to/root.crt certbot certonly \
    --dns-rfc2136 --dns-rfc2136-credentials /etc/letsencrypt/rfc2136.ini \
    --server https://ca.example.com:8443/acme/directory \
    -d '*.example.com'

Renew, revoke, unregister

sudo REQUESTS_CA_BUNDLE=/path/to/root.crt certbot renew
sudo REQUESTS_CA_BUNDLE=/path/to/root.crt certbot revoke \
    --server https://ca.example.com:8443/acme/directory \
    --cert-path /etc/letsencrypt/live/web.example.com/cert.pem --reason superseded
sudo REQUESTS_CA_BUNDLE=/path/to/root.crt certbot unregister \
    --server https://ca.example.com:8443/acme/directory

certbot renew remembers the server per certificate; make sure its timer has REQUESTS_CA_BUNDLE too, for example in a systemd drop-in:

systemctl edit certbot.service
[Service]
Environment=REQUESTS_CA_BUNDLE=/path/to/root.crt

Certificates from BastionXP CA last 24 hours by default, and certbot renews one that short when half its lifetime has passed. The certbot.timer most packages install runs only twice a day, with a random delay, which can miss that. Run it every hour:

systemctl edit certbot.timer
[Timer]
OnCalendar=
OnCalendar=hourly
RandomizedDelaySec=
RandomizedDelaySec=15m

(The empty lines clear the package's values before setting new ones.)

Tested

BastionXP CA's end-to-end tests run certbot 5.10.0 against the CA on every change: certonly --standalone, renew (a plain renew replaces a certificate the CA revoked, through ACME Renewal Information), revoke with the certificate's own key (--key-path), and unregister.

From a timer, certbot renew first waits a random time of up to 8 minutes; --no-random-sleep-on-renew skips that.