Backup and restore¶
Back up¶
copies the data directory, with a consistent copy of the database, and is safe while the server runs.
- Keys and database belong together. The database is the list of everything the CA issued, which revocation and renewal depend on. A copy of the keys alone is not a backup.
- The database is copied as it is:
backupnever updates its schema, so a backup taken with a newer version before an upgrade is still the database from before the upgrade. --outmust be a new directory.
Not in the backup, on purpose: the configuration file and the passphrases (of the server's keys, and of the root key, which should be offline anyway). Back them up separately, and not next to the backup. Keep the backup as private as the data directory.
Schedule it¶
[Unit]
Description=Back up BastionXP CA
[Service]
Type=oneshot
User=bastionxp-ca
ExecStart=/bin/sh -c 'exec /usr/local/bin/bxp backup --config /etc/bastionxp-ca/bastionxp-ca.yaml --out /backup/bastionxp-ca-$(date +%%F-%%H%%M)'
[Unit]
Description=Back up BastionXP CA daily
[Timer]
OnCalendar=daily
Persistent=true
[Install]
WantedBy=timers.target
Copy the backups off the machine, and remove old ones on a schedule that fits your retention policy.
Restore¶
- Stop the server:
systemctl stop bastionxp-ca. -
Put the backup in place of the data directory, owned by the server's user, mode
700: -
Check it:
sudo -u bastionxp-ca bxp doctor --config /etc/bastionxp-ca/bastionxp-ca.yaml. - Start the server:
systemctl start bastionxp-ca.
Certificates issued after the backup was taken are not in the restored database: they cannot be revoked or renewed through the CA. Keep backups frequent.
What to keep where¶
| What | Where |
|---|---|
bxp backup output |
Off the CA machine, as private as data_dir. |
| The configuration file and the files it points to | Your configuration management, or a separate backup. |
| The server keys' passphrase | A secret store, or sealed to the TPM (then it cannot be backed up, by design: plan to re-seal on a new machine). |
root.key |
Two offline copies, in different places. |
| The root passphrase | A password manager. |
Moving to a new machine with a TPM-sealed passphrase
A passphrase sealed to a machine's TPM decrypts only on that machine. Keep the passphrase itself in a secret store too, so you can seal it to the new machine.