From 5c52d0dc04c41e34bb43ce5be19b24c651e3899c Mon Sep 17 00:00:00 2001 From: Ben Fairless Date: Fri, 27 Nov 2026 09:44:57 +0800 Subject: [PATCH] Document the Alaveteli 0.47.0.0 one-way upgrade - Add ADR 0007: the 2FA secrets are encrypted at deploy time, so rolling back to 0.46.8.0 is unsupported, and the key and credentials file are the single point of failure. - List master.key and credentials.yml.enc in the first-time server setup and explain where they come from. No theme code changes are needed for 0.47.0.0: the theme overrides none of the changed or moved templates. Refs #1195 Assisted-by: Claude Code:claude-sonnet-5-5 Signed-off-by: Ben Fairless --- README.md | 7 ++++ ...alaveteli-0-47-0-0-is-a-one-way-upgrade.md | 35 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 doc/adr/0007-alaveteli-0-47-0-0-is-a-one-way-upgrade.md diff --git a/README.md b/README.md index ead587647..f80f2e0f9 100644 --- a/README.md +++ b/README.md @@ -449,11 +449,18 @@ One-time bootstrap per server: - `user_spam_scorer.yml` - `rails_env.rb` - `newrelic.yml` + - `master.key` (Alaveteli 0.47.0.0 and later, see below) + - `credentials.yml.enc` (Alaveteli 0.47.0.0 and later, see below) - `foi-live-creation.png` - `foi-user-use.png` - `rbenv-version` 3. Run the first deploy: `bundle exec cap deploy`. +`master.key` and `credentials.yml.enc` hold the Active Record Encryption keys that Alaveteli 0.47.0.0 uses for sensitive database columns, such as two factor authentication secrets. +The infrastructure repository's `righttoknow` role writes them from Ansible vault, with a separate pair for each stage, and the role refuses to run until they exist. +Do not generate them on the server and never regenerate them: without the key those columns cannot be read, and rolling back to 0.46.8.0 is unsupported once the secrets are encrypted. +See [ADR 0007](doc/adr/0007-alaveteli-0-47-0-0-is-a-one-way-upgrade.md). + `deploy:check_shared` runs at the start of every deploy and fails fast if any required file is missing. ### whatismyip trust-boundary check diff --git a/doc/adr/0007-alaveteli-0-47-0-0-is-a-one-way-upgrade.md b/doc/adr/0007-alaveteli-0-47-0-0-is-a-one-way-upgrade.md new file mode 100644 index 000000000..8cf95821e --- /dev/null +++ b/doc/adr/0007-alaveteli-0-47-0-0-is-a-one-way-upgrade.md @@ -0,0 +1,35 @@ +# Alaveteli 0.47.0.0 is a one-way upgrade + +Alaveteli 0.47.0.0 encrypts sensitive database columns (users' two factor +authentication secrets and backup codes) with Active Record Encryption, reading +its keys from `config/master.key` and `config/credentials.yml.enc`. Upstream +says rolling back to 0.46.8.0 is unsupported once the secrets are encrypted with +`temp:encrypt_user_otp_secret_keys`: it breaks two factor sign in for people who +enrolled on this release, and for every account once the task has run. Every +account gets a secret when it is created, even with `ENABLE_TWO_FACTOR_AUTH` +off, so the task covers everyone. + +We could have deployed, soaked for a week and encrypted afterwards, keeping +rollback possible meanwhile. We chose to run the task at deploy time instead, +for a simpler runbook, and accept that there is no rollback from the first day. + +What that commits us to: + +- **The recovery route is an RDS snapshot** taken immediately before the + production deploy, plus redeploying the previous release. Nothing else undoes + the encryption. +- **The key and credentials file are the single point of failure.** Without + `config/master.key` and `config/credentials.yml.enc` the encrypted columns + cannot be read. Each environment gets its own pair, kept in Ansible vault in + the `infrastructure` repository (as for Planning Alerts and They Vote for You) + and written to `shared/` by the Right to Know role. They are generated once + and never regenerated on a server. +- **Staging rehearses the exact mechanism** on its own data, including the + encrypt task and a sign in afterwards, and production waits for a week with no + new errors. +- **Two factor authentication stays off** (`ENABLE_TWO_FACTOR_AUTH` false) at + this release. Enabling it is separate work. + +The plan and checklist are tracked in openaustralia/righttoknow#1195. + +_Decided 2026-11-27._