Agent Wranglers

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

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.