feat: add verified state backup and restore drill

This commit is contained in:
thanhnv
2026-07-18 00:14:22 +07:00
parent 881ee01691
commit 00963119f4
5 changed files with 168 additions and 0 deletions
+21
View File
@@ -63,3 +63,24 @@ sudo systemctl daemon-reload
sudo systemctl enable --now casan-audit-anchor.timer
systemctl list-timers casan-audit-anchor.timer
```
## Backup and restore drill
Back up CASAN runtime state using `state-backup.sh`. In production the command
requires `CASAN_BACKUP_PASSPHRASE_FILE`; store that file via the customer secret
manager, not in the repository. Restore refuses a non-empty target directory,
so a drill is non-destructive by default.
```bash
export CASAN_PROFILE=prod
export CASAN_BACKUP_PASSPHRASE_FILE=/run/secrets/casan-backup-passphrase
export CASAN_BACKUP_ROOT=/srv/casan/backups
bash packages/casan-harness/scripts/bash/state-backup.sh create "$(date -u +%Y%m%dT%H%M%SZ)"
bash packages/casan-harness/scripts/bash/state-backup.sh verify "<backup-id>"
bash packages/casan-harness/scripts/bash/state-backup.sh restore "<backup-id>" --to /srv/casan/restore-drill
```
Perform and retain a restore drill before enabling write actions. A production
runbook must define retention, off-site replication, an owner, RPO/RTO targets,
and approval for any restore into a live state directory.