{% extends "admin/dbs/wiki/_layout.html" %} {% block wiki %}

Passphrases and SECRET_KEY

DBS derives its backup passphrase from Django's SECRET_KEY, so there is nothing to configure. The derivation is domain separated, meaning the backup key is never the same bytes Django uses for sessions, CSRF and password-reset tokens.

A project's backup passphrase must never change. Every backup is encrypted under the passphrase in force when it was written. Change SECRET_KEY without keeping the old one, set a new DBS_PASSPHRASE, or store a different passphrase for this server in the DBS manager, and every older backup stops opening.

Order of precedence

  1. An explicit --passphrase, --passphrase-stdin, or the form field.
  2. The DBS_PASSPHRASE environment variable.
  3. The DBS_PASSPHRASE setting.
  4. Derived from SECRET_KEY.

Rotating SECRET_KEY

A backup encrypted under a SECRET_KEY you later lose cannot be opened. When you rotate, keep the old value in SECRET_KEY_FALLBACKS; DBS tries every fallback on restore. To archive the derived passphrase somewhere safe:

python manage.py dbs key --show

The DBS manager

The manager stores this server's backup passphrase, sealed, and hands it to the server on standard input for every backup and restore. Store it once, while adding the server and before its first backup, and never replace it afterwards.

{% endblock %}