Skip to content

Hardening

How to protect the CA's machine and network, and the CA from floods. The Production checklist has the whole list.

The machine

  • A dedicated machine or VM for the CA, with nothing else on it.
  • The server runs as its own unprivileged user, with the shipped systemd unit (or the non-root container image).
  • data_dir is mode 700; the configuration 640 (root:bastionxp-ca); secret files 600.
  • The root key is offline; the server's keys are encrypted with a TPM-sealed passphrase.
  • Name constraints limit the names the CA can issue for.
  • Backups are taken, copied off the machine, and kept private.

The network

BastionXP CA limits what can grow without a login: ACME accounts and orders (rate limits) and failed LDAP logins. Everything else that changes anything needs a token or a login first, and the public CRL and OCSP answers are cached.

What is left is plain flooding: someone sending many requests to keep the CA busy. Stop it in front of the CA, where it is cheap:

  • A firewall that lets only your networks reach the CA's ports. A CA rarely needs to be reachable from the internet.
  • Or a reverse proxy with a limit per address:

    limit_req_zone $binary_remote_addr zone=bastionxp-ca:10m rate=20r/s;
    server {
        listen 443 ssl;
        server_name ca.example.com;
        location / {
            limit_req zone=bastionxp-ca burst=40;
            proxy_pass https://127.0.0.1:8443;
            proxy_ssl_trusted_certificate /var/lib/bastionxp-ca/root.crt;
        }
    }
    
    frontend bastionxp-ca
        bind :443
        mode tcp
        stick-table type ip size 100k expire 30s store conn_rate(10s)
        tcp-request connection track-sc0 src
        tcp-request connection reject if { sc_conn_rate(0) gt 50 }
        default_backend bastionxp-ca
    backend bastionxp-ca
        mode tcp
        server ca 127.0.0.1:8443
    

If the proxy ends TLS, BastionXP CA sees the proxy's address for every client: raise acme.limits.accounts_per_ip_per_hour accordingly. A proxy that ends TLS also needs a certificate for the CA's name; the simplest is TCP passthrough (the HAProxy example).

Ports

Port What Who must reach it
server.address (8443) API, ACME, SCEP, logins requesters, admins, ACME clients, devices, browsers (OIDC)
server.public_address (8080) CRL, OCSP, CA certificates everything that checks certificates
metrics.address (9100) Prometheus Prometheus only
outbound 80, 443, 53 ACME challenges (http-01, tls-alpn-01, dns-01) the CA reaches the hosts being verified
outbound 443, 636 OIDC provider, LDAP the CA reaches the identity provider / DCs

Choosing what to turn on

Turn on only what you use: every section of the configuration is off by default. Restrict ACME to the domains and challenge types you need (leave out http-01 where the network between CA and hosts is untrusted). Prefer tokens per device over the SCEP shared challenge.