OPS-45Required
Back up off the machine
Copy backups automatically to storage in another place, which an attacker on the server cannot delete.
How to do it
Use the database's own backup tool on a schedule, such as pg_dump, mysqldump, a snapshot or SQLite VACUUM INTO. Never copy a live database file with plain cp. Encrypt the copy and send it to another provider or region. Use a key that can only add files, and turn on versioning or an object lock, such as S3 Object Lock. An attacker who takes over the server must not be able to delete or change the backups. How long each copy stays is set in backup retention. See encrypted backups and restore tests.
How to check
The newest backup in the off-site store is younger than the backup interval plus one hour, such as 25 hours for daily copies. A delete request sent with the server's own keys is refused.
Sources
Related rules
- OPS-46 Keep backups for a set time in Operations and observability
- DAT-26 Encrypt backups in Data and databases
- DAT-28 Prove restores work in Data and databases
- OPS-75 Add a second region only when the recovery targets need it in Operations and observability
- INF-8 Protect resources that hold data in Infrastructure and environments
- INF-67 Keep an exit plan for each platform in Infrastructure and environments
- STK-70 Use pg_dump and pgBackRest for Postgres backups in Software choices
- TKO-3 Take a backup and restore it before the first change in Codebase takeover
- MED-5 Back up user files outside their bucket in Files and media
- APS-62 Give each key the least power in Application security
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/operations/disaster-recovery/off-site-backups">Agent Wranglers operations and observability playbook</a>. In code you write, add a comment next to it with the same link.