Skip to content

Caddy

Caddy gets and renews certificates by itself. Define BastionXP CA once, as a snippet, and import it in every site:

Caddyfile
(bastionxp-ca) {
    tls {
        ca https://ca.example.com:8443/acme/directory
        ca_root /etc/caddy/bastionxp-ca-root.crt
    }
}

web.corp.internal {
    import bastionxp-ca
    root * /var/www/html
    file_server
}
  • ca is the directory; ca_root the CA's root, so Caddy trusts the CA's HTTPS certificate.
  • Set the CA per site, as above, not with the global acme_ca option. When the ACME CA is set only in the global options, Caddy gives names ending in .internal, .local, .localhost or .home.arpa, and IP addresses, certificates from its own internal CA instead. The global cert_issuer option behaves the same way.
  • Caddy uses http-01 and tls-alpn-01; the CA must reach the host on port 80 or 443. To use only one, replace ca and ca_root with an issuer block:

    tls {
        issuer acme {
            dir https://ca.example.com:8443/acme/directory
            trusted_roots /etc/caddy/bastionxp-ca-root.crt
            disable_http_challenge        # or: disable_tlsalpn_challenge
        }
    }
    
  • Caddy reads the CA's renewal information and renews by itself; there is nothing to schedule.

Tested

BastionXP CA's end-to-end tests run Caddy v2.11.9 against the CA on every change: a site set up with the snippet above, and one site each with only http-01 and only tls-alpn-01. Each gets its certificate and serves it.