Skip to main content
Table of contents


Rotate offsite backup GPG keys

To encrypt our offsite backups, we use GPG keys which are valid for a year. For good security practice we rotate these keys each year.

Generate a new key

When creating a new key it is important you reuse the existing passphrase as otherwise the incremental backup will fail as historical data is unable to be access/unencrypted previous diffs.

  1. Pull the govuk-secrets repo.
  2. cd puppet
  3. gpg2 --batch --gen-key gpg_templates/offsite_backup_gpg_template.txt
  4. Ensure you make a copy of the password you use.
  5. Get the key ID you just generated with gpg2 --list-keys --fingerprint, and make a copy of the full fingerprint ID.
  6. Export secret key: Copy the output of gpg2 --export-secret-key --armor <key id>
  7. Export public key: Copy the output of gpg2 --export --armor <key id> to a public key server, for instance


Steps 6 and 7 above use different commands for exporting.

What do I need to update?

The following files need to be updated with the new key details:

This page was last reviewed on 22 April 2020. It needs to be reviewed again on 22 October 2020 by the page owner #govuk-2ndline .
This page was set to be reviewed before 22 October 2020 by the page owner #govuk-2ndline. This might mean the content is out of date.