Add scheduled encrypted backup operations
This commit is contained in:
@@ -57,6 +57,40 @@ No other application or administrator may write to this database during the snap
|
||||
|
||||
Copy the encrypted file off-server to restricted storage after every successful backup. Retain the exact API, worker and MongoDB images with the release: an image tag alone can change, and the drill requires matching image IDs. Agree the backup schedule, retention and tolerated data loss before a hotel pilot. Scheduling, off-server transfer, deletion and alerting are operator responsibilities in this milestone; none is silently installed.
|
||||
|
||||
### Optional systemd schedule
|
||||
|
||||
The repository includes an opt-in daily systemd service and timer. They are templates, not automatically installed. The service assumes the reviewed checkout is `/srv/guestops` and stages encrypted files in `/var/backups/guestops`; review and change both unit files together if the host uses different paths.
|
||||
|
||||
Create the staging directory and environment file without storing a private key or passphrase on the server:
|
||||
|
||||
```sh
|
||||
sudo install -d -m 700 /var/backups/guestops /var/lib/guestops-backup/gnupg /etc/guestops
|
||||
sudo install -m 600 /dev/null /etc/guestops/backup.env
|
||||
sudoedit /etc/guestops/backup.env
|
||||
sudo env GNUPGHOME=/var/lib/guestops-backup/gnupg gpg --import /secure/path/recovery-public.asc
|
||||
sudo env GNUPGHOME=/var/lib/guestops-backup/gnupg gpg --fingerprint
|
||||
```
|
||||
|
||||
The file contains only these two settings. `BACKUP_RECIPIENT` is the verified 40-character public-key fingerprint already imported into the service account's GPG keyring.
|
||||
|
||||
```text
|
||||
BACKUP_RECIPIENT=0123456789ABCDEF0123456789ABCDEF01234567
|
||||
BACKUP_DIRECTORY=/var/backups/guestops
|
||||
```
|
||||
|
||||
Review the unit sandbox against the host, copy `deploy/systemd/guestops-backup.service` and `.timer` to `/etc/systemd/system`, then validate and test before enabling:
|
||||
|
||||
```sh
|
||||
sudo systemd-analyze verify /etc/systemd/system/guestops-backup.service /etc/systemd/system/guestops-backup.timer
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl start guestops-backup.service
|
||||
sudo systemctl status guestops-backup.service
|
||||
sudo systemctl enable --now guestops-backup.timer
|
||||
systemctl list-timers guestops-backup.timer
|
||||
```
|
||||
|
||||
The timer deliberately causes the same brief maintenance interruption as a manual backup. `Persistent=true` runs a missed event after downtime, so choose and communicate the maintenance window. A successful unit only stages an encrypted file locally. Configure an independently monitored off-host transfer, verify the destination checksum, alert on both unit and transfer failure, and test the alert route. Do not add automatic deletion until retention, legal hold and recovery requirements have named owners.
|
||||
|
||||
Temporary plaintext files are held in private directories and removed on normal completion or exceptions. Process termination or power loss can leave temporary data, stopped services or TTL expiry disabled. After an interrupted run, inspect the dedicated project and remove only its identified abandoned temporary directory after securing any recovery material. Restore the recorded TTL setting (normally true) and restart the services:
|
||||
|
||||
```sh
|
||||
|
||||
Reference in New Issue
Block a user