mongoshield rekey
Add or remove the keys that can decrypt existing backups.
mongoshield rekey [backup] [options]Rewrites only the age headers of a backup's files (or of its key file), for a new set of recipients, KMS keys or a new passphrase. The data is not re-encrypted, so a removed key that already had a copy of the files can still read them.
Arguments
Section titled “Arguments”| Argument | Description | |
|---|---|---|
[backup] | optional | A backup id, "latest", or "all" (default) |
Options
Section titled “Options”| Option | Description |
|---|---|
--from <storage-url> | Where backups are stored: ./dir, file:///abs, s3://bucket/prefix (default: config). |
--add-recipient <age1…> | Let this age public key decrypt the backups. Repeatable. |
--remove-recipient <age1…> | Stop this age public key from decrypting them. Repeatable. |
--add-kms <provider:key> | KMS backups: add a KMS key, e.g. aws:arn:aws:kms:…. Repeatable. |
--remove-kms <provider:key> | KMS backups: remove a KMS key (one must remain). Repeatable. |
--identity-file <path> | age identity file for encrypted backups (from mongoshield keygen). Repeatable. |
--passphrase-env <VAR> | The CURRENT passphrase, from this variable. |
--new-passphrase-env <VAR> | Passphrase backups: the new passphrase, from this variable. |
--dry-run | Show what would change; write nothing. |
The global options (--config, --json, --quiet,
--verbose, --no-color, --yes) work here too.
Examples
Section titled “Examples”Hand backups over to a new ops key and retire the old one:
mongoshield rekey all --add-recipient age1new… --remove-recipient age1old… --identity-file old.keyChange the passphrase of the newest backup:
mongoshield rekey latest --passphrase-env OLD_PASS --new-passphrase-env NEW_PASSMongoShield is MIT licensed and is not affiliated with, endorsed by or sponsored by MongoDB, Inc. MongoDB is a trademark of MongoDB, Inc.Privacy policy