CA lifetimes, rotation and replacement¶
A certificate authority does not last for ever. Its certificate has an end date, and its key should be replaced from time to time, and at once if it may have been stolen. This page explains how long BastionXP's CAs last, how BastionXP warns you before a CA ends, and how you rotate, replace and revoke CAs.
It is written for the administrator who looks after the CAs. Most of these actions are rare. Read this page before you need it, so that you know what to do on the day.
The CAs in BastionXP¶
BastionXP has three kinds of CA certificates and keys. They form a chain.
| CA | What it is | How long it lasts |
|---|---|---|
| Root CA | The top of the chain. Your devices and servers trust it. It signs the intermediate CA of every authority. You create it once. | 10 years. |
| Intermediate CA | Each authority has its own. It signs the certificates that the authority issues. | 3 years by default. You choose 1, 2, 3, 5 or 10 years for each authority. It never outlives the root CA. |
| SSH CA keys | An authority that issues SSH certificates has a pair of keys for user certificates and a pair for host certificates. | SSH keys have no end date. BastionXP gives them a rotation date, three years after they were made, and warns you when it comes. |
Two rules keep the chain safe:
- An intermediate CA never lasts longer than its root CA. BastionXP refuses a lifetime that would end after the root, and it tells you the longest lifetime that is possible.
- A certificate never lasts longer than its intermediate CA. If a client asks for a longer certificate, BastionXP gives it a shorter one that ends with the intermediate.
To choose the lifetime of the next intermediate CA, use Intermediate CA lifetime on the authority's page, or when you create the authority. The new lifetime applies to the next intermediate CA that BastionXP makes, at the next rotation.
Where you see when a CA ends¶
Authority Manager shows, on every CA, how long it has left.
- The root CA card shows Valid for 9 more years, and the date.
- Each authority's card shows the state of its intermediate CA: Valid for 2 more years, or Expires in 20 days. A green dot means that there is plenty of time. An orange or blue dot means that the end is near.
- A card can also say This authority cannot issue certificates, with the reason. For example, a certificate that BastionXP needs has expired.
Expiry warnings¶
BastionXP checks every CA when it starts, and every 12 hours after that. It warns you when a CA has 180, 90, 30 or 7 days left, and when it has expired. For each warning, BastionXP:
- writes a warning to its log,
- writes an event of the type
ca_expiringto the audit log, and - shows the end date in the portal, as described above.
The audit event goes to your SIEM if you send the audit log to syslog. Alert on ca_expiring events. They are your reminder to rotate or replace a CA before it ends.
The warnings cover the root CAs, the intermediate CAs and the SSH CA keys. They also cover the certificate of a SCEP registration authority.
Rotate an intermediate CA¶
Rotating an authority gives it a new intermediate CA certificate, with a new key. The authority signs with the new one from then on. Do it before the old one ends, and when you want to change the intermediate's lifetime.
Rotation does not break the certificates that were already issued. They stay valid until their own end date.
Before you rotate¶
- Do it in a maintenance window. Systems that fetch the CA certificate will get the new one.
- BastionXP rotates an intermediate CA only when it holds the root CA's key. If the root CA's key is not available to BastionXP, for example because the root is kept offline, BastionXP refuses the rotation and says why.
- If the authority issues SSH certificates, set the CA rotation grace period on the authority's page before you rotate. It is how many hours the old SSH CA keys stay trusted after a rotation. SSH servers trust a CA key itself, and they need time to learn the new one. There is no default: until you set it, the grace period is 0 hours, and the old keys stop being trusted at once. For example, use 72 hours, and push the new keys to your servers during that time.
Rotate¶
- In Authority Manager, open the authority.
- Scroll to Rotate the intermediate certificate, and choose Rotate certificate.
- Read the message, and confirm.
BastionXP makes the new key and the new certificate, and saves them in one step. If anything fails, nothing changes, and the old intermediate CA keeps working.
What happens to the old CA¶
The old intermediate CA does not sign new certificates. It stays in the list Intermediate CAs on the authority's page, with the date when it was replaced.
- Its certificates stay valid until they end.
- It goes on answering the CRL and OCSP requests for its own certificates, until the last of its certificates has ended. Then BastionXP removes it, and deletes its key.
- If the authority issues SSH certificates, the old SSH CA keys stay trusted for the grace period. After that, only the new keys are trusted.
Replace the root CA¶
The root CA is the most important CA, and it is the hardest one to replace, because every device and server trusts it. A root CA lasts 10 years, so you replace it rarely. BastionXP makes the replacement safe with three steps. In the first, nothing changes for your devices. The second is yours to take at your own pace.
Replace a root when it will end in the next few years, or when you need a new key for the root.
Step 1: Make the next root¶
-
In Authority Manager, open the Root CAs section. On the card of the root, choose Replace.
-
Choose Make the next root.
BastionXP makes a new root CA. Its name has a generation number: if the current root is BastionXP Root CA, the next one is BastionXP Root CA G2. BastionXP also makes link certificates, which connect the two roots.
The new root does not sign anything yet. The card shows it as Next root, not signing yet, with its fingerprint.
Step 2: Put the new root into every trust store¶
From now on, the root certificate that you download contains both the current and the next root. Download it with Root certificate on the page of any authority. Add the new root to every place that trusts your CA: the trust stores of your servers and devices, and the profiles that your device management system sends.
You do not have to hurry, and you do not have to do it on one day. While both roots exist, every chain that BastionXP gives to a client contains the link certificate, so a client that trusts only one of the two roots can still build a chain. Wait until all your clients trust the new root.
If you change your mind, choose Cancel replacement. BastionXP deletes the next root, and the current root stays as it is.
Step 3: Activate the new root¶
When the new root is in your trust stores, choose Activate.
The new root becomes the current one, and it signs every new intermediate CA from now on. The old root becomes the previous root. It no longer signs intermediate CAs. It stays trusted until it ends.
The dialog has one option: Give every authority a new intermediate CA from the new root now. It is ticked by default.
- If you leave it ticked, every authority gets a new intermediate CA from the new root at once, as if you had rotated each one. The dialog then lists the authorities that moved, and the ones that failed, with the reason.
- If you untick it, each authority moves to the new root when you next rotate its intermediate CA. Until then, it keeps signing with its old intermediate, which the previous root signed.
BastionXP removes the previous root by itself, when no intermediate CA that it signed is left and none of its revocations is still needed.
Only one replacement can run at a time. You can start the next one when the previous root has been removed.
When the root CA is offline¶
On a self-hosted installation, if you imported the root CA from a key ceremony, its key is offline and BastionXP cannot sign with it. Anything that needs a signature from the root CA's key must then happen in your key ceremony. In the portal, BastionXP refuses these actions and tells you why:
| Action | What to do instead |
|---|---|
| Replace the root CA | Make the new root CA in a key ceremony. |
| Rotate an authority's intermediate CA | Make the new intermediate CA in a key ceremony, signed by the offline root CA. |
| Revoke and replace an authority's intermediate CA | Revoke it in a key ceremony, because the root CA signs the list of revoked intermediate CAs. |
Adding an authority works, as described in Authorities under an offline root CA. Everything else on this page, such as expiry warnings, applies as usual.
Revoke a CA after a compromise¶
If the key of an intermediate CA may have been stolen, treat it as an emergency. Someone who has the key can issue certificates that look genuine. Revoke the CA, and replace it at once.
Revoking an intermediate CA has a large effect. Every certificate that the CA issued stops being trusted. All your devices and servers with certificates from that CA must get new ones. Do this only when you must.
Revoke and replace the intermediate CA¶
- In Authority Manager, open the authority.
- Scroll to Revoke and replace, and choose Revoke the intermediate CA.
-
Choose the Reason:
Reason When to choose it The CA key may be compromised The key may have been stolen. This is the usual reason. Replaced by a new CA (superseded) You replaced the CA for another reason. The CA is no longer used You stopped using the CA. No reason given None of the above fits. -
Tick I understand that clients must get new certificates, and confirm.
BastionXP does three things at once:
- It adds the intermediate CA to the authority revocation list (ARL) of the root CA, with the reason.
- It makes a new intermediate CA, which signs from now on.
- It counts the certificates that must be replaced.
The portal then shows how many certificates in use must be replaced, and the address of the ARL. Below that, it lists them, with the subject, to whom each was issued, and when it ends. Use the list to plan the replacement.
The ARL is published at a stable address on the plain HTTP port of your server. Clients that check the revocation of a chain find the revoked CA there. The intermediate CA certificates that BastionXP makes name this ARL address in them, so that clients know where to look.
You can also revoke an earlier intermediate CA that a rotation already replaced. In the list Intermediate CAs, choose Revoke next to it. This only adds it to the ARL. The current intermediate CA does not change.
Replace the certificates¶
After the revocation, the certificates of the old CA must be replaced. How, depends on how the certificate was issued.
| How it was issued | What to do |
|---|---|
ACME (certbot, cert-manager, bxp-cli acme and others) |
BastionXP tells ACME clients that support ACME Renewal Information (ARI) to renew now. Such clients usually renew within an hour, without anything for you to do. See ACME. |
bxp-cli tls or bxp-cli ssh on a server |
Run bxp-cli renew --force once on every server. Use your configuration tool, such as Ansible, Puppet or Chef. The servers get certificates from the new CA within minutes. |
| SCEP or an MDM profile | Devices renew on their own schedule. To speed it up, push the profile again from your device management system. The list of certificates in the portal tells you which devices are affected. |
| People's certificates | They get a new one when they sign in again, because these certificates are short-lived. |
Revoke the SSH CA keys¶
If an authority issues SSH certificates, the SSH CA keys can be compromised too. On the authority's page, under Revoke and replace, choose Revoke the SSH CA keys.
BastionXP replaces the SSH CA keys at once, with no grace period, and adds the old keys to a key revocation list (KRL). Previous keys that are only in their normal grace period stay trusted. They were not compromised.
The portal then shows two addresses, which your servers need:
| Address | What it is for |
|---|---|
| Trusted user CA keys | The public keys that the servers must trust now, for user certificates. Use it for the TrustedUserCAKeys setting of sshd. |
| Key revocation list (KRL) | The list of revoked keys and certificates. Use it for the RevokedKeys setting of sshd. |
Push these two files to every server with your configuration tool, and then run bxp-cli renew --force on every server, so that the servers get new host certificates.
Where these files are
Both addresses are served over HTTPS, with no login, at https://<domain>/authorities/<authority>/ssh/trusted_user_ca_keys and .../ssh/krl. They change only when something changes, and they carry an ETag, so your tool can check cheaply whether it needs to download them again.
Delete and restore an authority¶
When you delete an authority, BastionXP does not destroy its keys at once. This gives you time to change your mind.
In Authority Manager, choose the three dots on an authority's card, and then Delete. The authority stops issuing certificates. Its card now says Deleted, and shows the date after which its keys can be destroyed.
- Choose Restore to cancel the deletion. The keys are kept, and the authority issues certificates again.
- Choose Delete permanently after that date, to destroy the keys. The authority is then removed for good. Certificates that it issued can no longer be checked for revocation, so be sure that none are in use.
Before the date, BastionXP refuses to delete the keys permanently.
A checklist¶
| When | What to do |
|---|---|
| Once a quarter | Open Authority Manager. Look at the end dates. Check the audit log for ca_expiring events. |
| About a year before an intermediate CA ends | Rotate it, in a maintenance window. |
| A few years before the root CA ends | Replace the root. Do steps 1 and 2 early, and activate when all your clients trust the new root. |
| A key may have been stolen | Revoke and replace the CA at once. Replace the certificates. |
| Before you delete an authority | Check that none of its certificates are in use. |




