Skip to content

Replace the intermediate

The intermediate is valid for 3 years by default (ca.intermediate_validity). Replace it before it expires, or at once if its key may be in the wrong hands. You need the offline root key.

bxp new-intermediate --config bastionxp-ca.yaml --root-key /media/usb/root.key
systemctl restart bastionxp-ca

The new intermediate takes the old one's place; the server never uses two.

What happens

  • A new key and certificate are made, signed by the root, with the name constraints and the ca.intermediate_validity of the current configuration.
  • It may not outlive the root. If it would, the command stops and says how long it may be:

    the new intermediate would outlive the root: the root ends on 2036-11-12, in 400 days.
    Set ca.intermediate_validity to at most 400d, and plan a new root
    
    - The old intermediate's key is removed. Its certificate is kept in data_dir/replaced/, for the record only. - Certificates the old intermediate issued stay valid until they expire: they carry the old intermediate in their chain, and it chains to the same root. - Revoking those certificates no longer works. The CRL and the OCSP answers now come from the new intermediate, which cannot speak for the old one's certificates. Renew them (bxp renew, bxp scep renew, or let ACME clients renew) to move them over; renewals get the new intermediate.

The command counts the TLS certificates from the current intermediate that are still valid, and asks before it goes on if there are any. --yes skips the question in scripts.

If the old key was compromised

Also replace every certificate it issued: until they expire, they still chain to your root. List them with bxp list certificates, renew them, and revoke the old ones before you replace the intermediate.

Flags

Flag Meaning
--root-key <file> The root key (default: data_dir/root.key, if it is there).
--root-passphrase-file <file> Read the root passphrase from a file instead of asking.
--yes Replace without asking, even if certificates it issued are still valid.
--csr Under an external root: make the new key and a CSR for the company CA.
--import <file> Under an external root: put the certificate the company CA issued in place.
--issuing-ca <file> With --import: the issuing CA certificate(s), if not signed by the root directly. Repeatable.
--root-ca <file> With --import, the first time: the company root certificate.

When to do it

The server and bxp doctor warn before the intermediate expires: a fifth of its lifetime ahead, at most a year (about 7 months for a 3-year intermediate). The metric bastionxp_ca_ca_certificate_expiry_timestamp_seconds{certificate="intermediate"} lets you alert on it:

- alert: BastionXPCAIntermediateExpiresSoon
  expr: bastionxp_ca_ca_certificate_expiry_timestamp_seconds{certificate="intermediate"} - time() < 180 * 86400

Under an external root, see Under an existing root.