Encryption keys should rotate periodically — annually is a common cadence, more often if a key was potentially exposed. This guide walks through the rotation procedure.Documentation Index
Fetch the complete documentation index at: https://docs.dbdock.xyz/llms.txt
Use this file to discover all available pages before exploring further.
Why rotate
- Defense in depth — if a key is compromised in the future, only post-rotation data is affected
- Compliance — SOC 2 and similar frameworks expect periodic key rotation
- Departing team members — if someone with key access leaves, rotate
Important: losing access vs. rotation
Procedure — forward-only rotation
Easiest and safest. Old backups keep their old key; new backups use the new key.Record where the old key was
Before you change anything, note down the old key and which backups it decrypts. You’ll need it to restore any backup encrypted with it.Do not discard the old key. Move it to a secure archive — labelled with the date range it was active — not the trash.
Restart any long-lived DBdock processes
They cache the env at startup.
pm2 restart, kubectl rollout restart, etc.Full re-encryption
If you want every backup to use the new key, do this after the forward-only rotation:Set up a restore environment
Point DBdock at the old key temporarily, on a machine that can reach both the old backup storage and new backup storage.
For each old backup
- Restore the backup to a temporary database
- Switch DBdock to the new key
- Run
dbdock backupagainst the temporary database - Verify the new backup restores cleanly
- Drop the temporary database
- Delete the old backup
Restoring a backup encrypted with an old key
Temporarily swap the env variable:Multi-key scenarios
DBdock reads a single encryption key at a time. If you need truly multi-key support (e.g., different keys per environment, automatic failover), consider wrapping DBdock in your own script that sets the correct key based on metadata.Storing keys safely
Password manager
1Password, Bitwarden, etc. Good for personal use and small teams.
Cloud KMS
AWS KMS, GCP KMS, Azure Key Vault. Best for production — audit logs, rotation, IAM.
HashiCorp Vault
Self-hosted, full-featured. Worth it if you’re already running it.
Encrypted git repo
Using
git-crypt or SOPS. OK for small teams with good ops hygiene.Checklist
When rotating:- New key generated and saved in secure storage
- Old key archived (not deleted) with its active date range
- Env updated in all environments (prod, staging, CI)
- Long-lived DBdock processes restarted
- Smoke test passed (backup + restore with new key)
- Team notified of the rotation date (for audit purposes)
See also
Security
Overall security best practices.
Production checklist
Full deployment checklist.

