Backups
Encryption and keys
How backups are encrypted, the runner key in your Secret Manager, the recovery key only you hold, your variables in a backup, and who can technically read what.
On this page
Everything the runner stores is encrypted by restic inside the job, in your account, before it is written to any destination. restic encrypts with AES-256 and authenticates every piece with Poly1305-AES; the key that unlocks a repository is protected by a password through scrypt. Anyone who can read the bucket but holds no key sees encrypted data only.
Two keys
A repository can be opened by either of two passwords:
| Key | Who holds it | What it is for |
|---|---|---|
| The runner key | Your Scaleway Secret Manager, secret brewless-backup-<application>-<environment> under /brewless-backup-key/<application>-<environment>/ |
The jobs use it to write, maintain and restore. The first backup makes it, 32 random bytes, and stores it there itself |
| The recovery key | You, and nobody else | Opening the backups without Brewless and without your Scaleway account, with the Recovery Kit |
The same two passwords open every destination of the environment.
Warning
Lose both the recovery key and the runner key (for example together with your Scaleway account), and nobody can read the backups any more, Brewless included.
The recovery key
You make the recovery key in the console or with brewless backup:recovery-key <environment>. The runner makes it in your account and adds it to every repository; your browser, or the command line client, made a key pair first, and the runner sends the recovery key back encrypted to that pair, so only that browser or that machine can read it. Brewless holds the encrypted key for at most a day and never sees it in plain text. It is shown once; Brewless forgets it once you prove you stored it. See the recovery key for the steps.
Making a new recovery key removes the one you had from the repositories once you confirmed the new one. A key that is made but never confirmed is removed again after a day.
Rotating the runner key
Rotate runner key on an environment's Backups tab replaces the runner key; it asks you to confirm that it is you first. A job in your account makes a new key, adds it to every destination's repository, and stores it as a new version of the secret. Once it reports, the maintenance job removes the old key from the repositories. Until then both keys open them, so a backup that is running carries on. If the rotation stops halfway, the old key stays and the keys the job had already added are removed again.
Brewless never sees either key. The recovery key and the encryption of the data stay as they are: a rotation changes which password opens the repository, not the data. Secret Manager keeps at most 20 versions of a secret, so before a rotation Brewless deletes the oldest versions of the runner key's secret until there is room, never the one in use. The audit trail has backup.runner_key_rotation_requested and then backup.runner_key_rotated, or backup.runner_key_rotation_failed.
Your variables
The environment's variables (its secret in Secret Manager) are not in the backup by default. Switch them on with:
environments:
production:
backup:
secrets: true
or with the organisation's or the environment's setting in the console. The runner then gets one more right: reading that environment's own secret, and no other. It reads the revision Brewless names, in your account, and stores it in the backup as config/env.dotenv, encrypted like everything else. Brewless never reads the values. Switching it off again takes that right away.
Without it, the backup holds the names of the variables and the secret's revision, so you know what to fill in after a restore, but not their values.
Who can technically read what
Honestly stated, as it stands:
-
Brewless never receives backup data: no file, no row, no variable value, no key. It sees names, sizes, times, counts and snapshot ids.
-
Brewless could technically read the runner key. Brewless makes the backup jobs in your account with the key you connected, and Scaleway asks that key for the right to read secrets in order to mount them into a job. With that right it could read the runner key, and with the runner key it could open the backups. It does not, and no code of Brewless reads that secret, but we do not call this zero-knowledge. Only the recovery key is out of Brewless's reach.
-
The password of the backup user of a Managed Database is made by Brewless and kept in your Secret Manager. That user may only read.
-
The runner may read and write its own environment's runner key, and with
backup.secrets: trueread that environment's secret. It cannot read another environment's keys or secrets, also not in the same Scaleway project. -
Your application's storage key has no access to the backup buckets.
-
The temporary Instance for large buckets works as the runner, with a key of its own that expires at the Instance's deadline. Brewless makes that key and puts it, with the webhook secret, in the state bucket for the Instance to fetch once at start-up through a link that holds for 15 minutes; both go when the Instance goes. The runner key itself the Instance reads from your Secret Manager, as the jobs do.
-
An account admin of your Scaleway organisation can read your Secret Manager and therefore the runner key. That is why the recovery key belongs somewhere outside that account.
To take Brewless's access away completely, disconnect your Scaleway key at Brewless and delete it at Scaleway. The jobs keep running with their own keys; see Leaving Brewless.