From 12efb7d085c2b6422538d30291d8223753ebc3db Mon Sep 17 00:00:00 2001 From: Ilker Manap Date: Sun, 4 Oct 2026 10:38:47 +0200 Subject: [PATCH] Encrypt backups to backup_recipients with age Co-Authored-By: Claude Opus 5.5 (1M context) --- CHANGELOG.md | 5 ++ docs/install.md | 16 +++++++ docs/reference.md | 12 +++++ go.mod | 5 +- go.sum | 8 ++++ internal/cli/backup.go | 46 ++++++++++++++---- internal/cli/backup_test.go | 80 +++++++++++++++++++++++++++++++- internal/config/backup.go | 32 +++++++++++++ internal/config/config.go | 11 +++++ internal/docgen/reference_gen.go | 1 + 10 files changed, 204 insertions(+), 12 deletions(-) create mode 100644 internal/config/backup.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 19fcba2..6892a3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -159,6 +159,11 @@ APIs change between minors without a deprecation period. where every user on the node could read it: it reaches the engine in its environment, and a short launcher hands it to SGLang inside the process. Both take effect as engines restart under an upgraded agent. +- **Backups can be encrypted.** `backup_recipients` in server.yaml (age + recipients or SSH public keys) has `llmgw server backup` encrypt each + archive to them with age, as `.tar.gz.age`: an archive holds the CA's key + and every secret in the store, and is meant to be copied off the machine. + Open one with `age -d -i `. ### Everything that can be changed on a running cluster, from the console diff --git a/docs/install.md b/docs/install.md index 81782d4..a79b753 100644 --- a/docs/install.md +++ b/docs/install.md @@ -1187,6 +1187,20 @@ The control plane publishes when the newest archive was written as `llmgw_backup_last_success_timestamp_seconds`, and **BackupTooOld** fires when it is more than 26 hours old — including when there has never been one. +**Encrypt them.** Name who may open them in `/etc/llmgw/server.yaml`, and every +archive is encrypted to those keys with [age](https://age-encryption.org) and +named `.tar.gz.age`: + +```yaml +backup_recipients: + - age1ql3z7hjy54pw3hyww5ayyfg7zqgvc7w3j2elw8zmrj2kg5sfn9aqmcac8p # age-keygen's public key + - ssh-ed25519 AAAAC3Nza... ops@example # or an SSH public key +``` + +Keep the matching private keys **off** this machine — an archive whose key +sits beside it is not protected by it. Encrypted, a copy is safe wherever it +lands. + **Copy the archives off the machine.** They sit on the disk they back up and do not survive losing it. Anything that copies files will do — rsync from the mirror, a NAS mount, an offsite bucket — as long as it keeps the archives @@ -1206,6 +1220,8 @@ them: ``` sudo systemctl stop llmgw-server mkdir /tmp/restore && sudo tar -xzf /var/backups/llmgw-server/llmgw-backup--