Backup & recovery
Back up encrypted data with its keys, rehearse a restore, and reconcile access after recovery.
On this page
A usable backup needs both the encrypted database and the keys that can open it. Password Manager exports are a member workflow; they do not replace a deployment backup.
Back up the complete installation#
- Back up PostgreSQL with your database provider's point-in-time recovery or a tested base-backup and WAL-archiving process.
- Preserve the root key and access to its KMS or Vault/OpenBao provider. Retain previous keys while any retained backup still depends on them.
- Keep deployment secrets, including
SECRET_KEY, database and Redis credentials, SMTP settings and integration credentials, in a separate secret store. - Preserve access to customer-managed organisation keys when BYOK is enabled.
- Keep your deployment configuration and image versions so a restore can use compatible application code.
PostgreSQL contains encrypted app secrets, wrapped keys, password vaults and encrypted attachments, memberships, grants and audit records. Redis contains queues and caches; losing it loses in-flight work but is not a substitute for losing the database.
Store bootstrap credentials outside the service you are backing up. A restore must not depend on reading its own locked database to obtain its decryption key.
Test a restore#
Run a restore drill regularly and before a major upgrade. Use an isolated environment with no path to production integrations.
- Restore the database snapshot to a separate PostgreSQL instance.
- Configure the matching root-key provider and any required organisation keys.
- Keep workers, event dispatchers and scheduled jobs stopped. Block outbound integration traffic at the network boundary.
- Start the backend and run the decryption check:
python manage.py matii_restore_check --json
The check must report zero failures. A database that restores successfully but cannot be decrypted has not passed the drill.
Then verify representative user flows: unlock a canary end-to-end encrypted app with its authorised account, fetch a test secret using a service account, and open a test password vault using its member-held recovery materials. Server-side checks cannot replace client-side decryption checks for end-to-end encrypted content.
Record the snapshot time, application version, keys used and outcome. Remove the isolated environment when the drill is complete.
Reconcile after a production restore#
A restored database reflects the snapshot's access state. Tokens or memberships revoked later may appear valid again.
- Compare with identity-provider records and audit or SIEM records kept outside the restored database.
- Reapply member removals, role changes, token revocations and device revocations that occurred after the snapshot.
- Review credentials rotated since the snapshot and bring the stored values back into agreement with their providers.
- Run the restore check and verify representative app and password-vault reads.
- Re-enable workers, dispatchers and scheduled jobs after access and credentials are reconciled.
Use a reconciliation dry run to review identity differences before applying removals:
python manage.py matii_reconcile_memberships --dry-run
Handle password-vault integrity alerts#
Password Manager stores signed manifests and remembers previously observed vault revisions on each device. A legitimate database restore can therefore look like a rollback.
Confirm the restore with the operator before accepting the current state in the vault's integrity warning. Do not teach members to dismiss an unexplained rollback or missing-item alert. A new device has less local history to compare against.
Understand the recovery boundaries#
The server root key cannot recover a member's personal password vault by itself. Members need their master password and Secret Key, their recovery key, or an organisation recovery arrangement they enrolled in. See Password Manager.
Losing or permanently deleting a required root key or customer-managed key can make the corresponding encrypted data unrecoverable. Keep old keys for old backups even after the live database has been rewrapped.
Encrypted password-vault exports do not include attachment blobs. Back up the database to preserve those files alongside the encrypted items that hold their file keys.