Skip to content

bxp acme

BastionXP CA's own ACME client: no extra software, the same binary. It covers the whole life of a certificate: issue, renew, revoke, account key rollover and account deactivation.

Issue

On the machine that needs the certificate:

$ sudo bxp acme issue --ca-url https://ca.example.com:8443 --root root.crt --name web.example.com
Private key:  web.example.com.key
Certificate:  web.example.com.crt
Valid until:  2027-02-13 16:28 UTC

(After bxp trust, --ca-url and --root can be left out.)

  • It answers the CA's challenge itself, on port 80 (http-01, the default), which is why it usually needs sudo. With --challenge tls-alpn-01 it answers on port 443 instead.
  • It writes <name>.key and <name>.crt like bxp tls does.
  • --name can also be an IP address, if the CA allows its range.
  • It keeps acme-account.key, the key that identifies this machine to the CA; the next request uses it again. Keep it.
  • It does not do dns-01: for wildcard names, use a client with a plugin for your DNS, such as lego or certbot.
Flag Default Meaning
--name A host name or IP address (repeat for more).
--challenge http-01 http-01 (port 80) or tls-alpn-01 (port 443).
--http-address :80 Where to listen for http-01. The CA always asks on port 80; another port works only if something forwards port 80 to it.
--tls-address :443 Where to listen for tls-alpn-01.
--out-dir . Where to write the files.
--account-key acme-account.key in --out-dir The account key; created if missing.
--force Replace existing files.

Renew

Every hour, from a timer. It asks the CA when to renew (ACME Renewal Information): BastionXP CA says when a third of the lifetime is left, or at once for a revoked certificate. With a CA that does not say, it renews when a third of the lifetime is left. --force renews now.

sudo bxp acme renew --cert web.example.com.crt --key web.example.com.key \
    --exec "systemctl reload nginx"

renew proves the names again, as issue does, so it needs the same port. It makes a new key of the same kind. A certificate that has already expired is renewed too (ACME proves the names afresh).

Revoke

# signed with the account key next to the certificate
bxp acme revoke --cert web.example.com.crt --reason superseded

# signed with the certificate's own key: works without the account
bxp acme revoke --cert web.example.com.crt --key web.example.com.key --reason key-compromise

Reasons: unspecified, key-compromise, superseded, cessation.

Account key rollover

bxp acme rollover-key --account-key acme-account.key

The new key is saved as acme-account.key.new before the CA hears of it, and moved into place once the CA has accepted it, so a failure can never lock you out of the account.

Deactivate the account

bxp acme deactivate --account-key acme-account.key

Asks first (or takes --yes). Cannot be undone. Certificates already issued stay valid.

Other ACME CAs

The same commands work with any ACME CA: give its directory with --directory. Its certificate is then checked against --root, or the system's roots:

sudo bxp acme issue --directory https://acme-v02.api.letsencrypt.org/directory --name www.example.org

Run it as a service

/etc/systemd/system/bastionxp-ca-acme-renew.service
[Service]
Type=oneshot
ExecStart=/usr/local/bin/bxp acme renew --cert /etc/nginx/web.crt --key /etc/nginx/web.key --exec "systemctl reload nginx"

with an hourly timer like the one in Renew certificates.