Skip to content

Replace an SSH CA key

SSH servers and clients trust the SSH CA keys themselves, so a new key must be trusted everywhere before it signs anything. BastionXP CA does it in two steps.

Rotating an SSH CA key: make the next key, distribute it next to the old one, activate it and restart, then remove the old key from the fleet Rotating an SSH CA key: make the next key, distribute it next to the old one, activate it and restart, then remove the old key from the fleet

Step 1: make the next key

bxp new-ssh-ca user --config bastionxp-ca.yaml      # or: host

It makes the next key and prints it. The CA still signs with the current key. After a restart, /ssh_user_ca.pub (or /ssh_host_ca.pub) lists both keys.

Add the new key everywhere, next to the old one:

CA Where
user TrustedUserCAKeys file on every SSH server (the file may hold several keys)
host a second @cert-authority line in known_hosts on every client

Step 2: activate it

bxp new-ssh-ca user --activate --config bastionxp-ca.yaml
systemctl restart bastionxp-ca

New certificates are signed with the new key. The old private key is removed, and its public key is kept in data_dir/replaced/.

Step 3: remove the old key

Remove the old key from the servers and clients once nothing needs it:

  • user CA: when the users' certificates have expired (16 hours by default, 24 hours at most);
  • host CA: when the hosts have renewed. Host certificates signed with the old key can still be renewed with bxp renew, and come back signed with the new one.

bxp doctor reminds you of a next key that waits to be activated.