Skip to content
SHC Docs

shc backup key rotate

re-key the backup repository and update the stored key together

Rotate the backup repository’s encryption key.

Every repository the key opens is re-keyed: the configured one, every other scope’s repository that reads the same key, each location fence’s off-site repo, and every repository an archive still lives in. The new key is added to each repository before the old one is removed, so an interrupted rotation leaves every repository openable by both keys rather than neither. The new key is recorded in the same place SHC reads it from, so the stored key and the repositories never disagree.

By default SHC generates a key with real entropy. Supply your own with --new-key-file (use ’-’ for stdin) or $SHC_NEW_BACKUP_PASSWORD.

Existing snapshots stay readable: nothing is re-encrypted. Anyone holding a copy of this repository elsewhere needs the new key to keep opening it.

shc backup key rotate [flags]
-h, --help help for rotate
--new-key-file string read the new backup key from a file (mode 0600 expected); use '-' to read from stdin. Takes precedence over $SHC_NEW_BACKUP_PASSWORD. Unset generates a key
--repo string assert a repository the key opens; the rotation re-keys every one of them, and a value outside them is refused
-y, --yes skip confirmation prompt
--config stringArray extra YAML config file to layer on top of auto-discovered config; repeatable, later files win
-d, --debug enable debug mode (default: $SHC_DEBUG)
-e, --environment string environment name (default: "prod", or "default" on an estate with no licence and no trial; $SHC_ENVIRONMENT and shc ctx -e override it, and the "master" tenant is always "default")
--exclude string comma-separated dotted paths to drop
--fields string comma-separated columns/keys to show (and their order)
--filter string comma-separated dotted paths to keep (drops everything else)
-o, --output string output format: tty|text|json|yaml (default: $SHC_OUTPUT)
-s, --stack string stack name (default: $SHC_STACK)
-t, --tenant string tenant name (default: $SHC_TENANT)
-v, --verbose verbose output (default: $SHC_VERBOSE)