From c3f0dbf8bdd21038b1b1df687b8af8689b956ea2 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Mon, 21 Sep 2026 20:29:29 +0800 Subject: [PATCH] revert(backup): drop append-only for the desktop endpoint A desktop holds both the plaintext and the repository password, so blocking deletion on the server protects little while preventing the automatic retention the client needs. Immutability belongs in the offsite copy. --- BACKUP.md | 29 ++++++++++++++++------------- hosts/12kingdoms-youko/default.nix | 13 ++++++++----- hosts/idols-ai/restic.nix | 7 ------- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/BACKUP.md b/BACKUP.md index a0015ce4..694d6fd5 100644 --- a/BACKUP.md +++ b/BACKUP.md @@ -4,12 +4,12 @@ How this fleet is backed up, where the data lives, and how to restore it. ## What protects against what -| Threat | Defence | -| ----------------------------- | -------------------------------------------------------------- | -| accidental deletion, bad edit | btrbk: local btrfs snapshots | -| disk or host loss | restic: encrypted copies on youko | -| a compromised backed-up host | `rest-server --append-only`: a client can never delete history | -| a compromised backup server | desktop repositories use a password youko never holds | +| Threat | Defence | +| ----------------------------- | -------------------------------------------------------------------- | +| accidental deletion, bad edit | btrbk: local btrfs snapshots | +| disk or host loss | restic: encrypted copies on youko | +| a compromised backup server | desktop repositories use a password youko never holds | +| a compromised host | not defended yet: the immutable offsite copy (planned) is that layer | ## Layers @@ -19,10 +19,14 @@ How this fleet is backed up, where the data lives, and how to restore it. 2. **restic — encrypted copies on youko** ([`modules/nixos/base/restic-backup.nix`](./modules/nixos/base/restic-backup.nix)). Encryption happens on the client, so the server only ever stores ciphertext. youko runs `restic-rest-server` - with `--append-only` and `--private-repos`, authenticated by htpasswd, published behind caddy as - `restic.writefor.fun`. + with `--private-repos`, authenticated by htpasswd, published behind caddy as + `restic.writefor.fun`. Deliberately not append-only: a desktop holds both the plaintext and the + repository password, so blocking deletion there protects little while denying the client the + automatic retention it needs. 3. **cloud copy** (planned). youko will copy the homelab repositories with `restic copy` (it holds - that password). Desktops copy their own: youko does not hold the desktop password. + that password). Desktops copy their own: youko does not hold the desktop password. This layer is + what protects history against a compromised host, so the target should be immutable or versioned + (object lock or equivalent) rather than a plain bucket. ## Password model @@ -109,10 +113,9 @@ Restoring a btrbk snapshot (offline; stop writers first): - btrbk: automatic, 7 days with a 2 day minimum. - youko's own restic repository: automatic, `--keep-daily 3 --keep-weekly 2 --keep-monthly 2`. -- Desktop restic repositories: **none**. The append-only server rejects deletion, so the client - cannot forget or prune. Snapshots accumulate (deduplication keeps that cheap). To reclaim space, - run the server temporarily without `--append-only`, `restic forget --prune` from the desktop, then - re-enable it. +- Desktop restic repositories: automatic, the module defaults + (`--keep-daily 3 --keep-weekly 2 --keep-monthly 2`). Immutability is the offsite copy's job + (planned), not the local server's. ## Verifying diff --git a/hosts/12kingdoms-youko/default.nix b/hosts/12kingdoms-youko/default.nix index 405ae8e1..d802b7ea 100644 --- a/hosts/12kingdoms-youko/default.nix +++ b/hosts/12kingdoms-youko/default.nix @@ -59,15 +59,18 @@ in modules.btrbk.enable = true; - # The restic REST server the desktops push their backups to. Append-only, so - # a compromised client still cannot delete history; private repos, so each - # client only reaches the repository named after its user. Credentials come - # from agenix; caddy terminates TLS in front of it. + # The restic REST server the desktops push their backups to. Private repos, + # so each client only reaches the repository named after its user. Credentials + # come from agenix; caddy terminates TLS in front of it. + # + # Deliberately NOT append-only: a desktop holds both the plaintext and the + # repository password, so protecting its backups from deletion buys little + # (a compromise is a compromise) while blocking the automatic retention the + # client needs. Immutability belongs in the offsite copy instead. services.restic.server = { enable = true; listenAddress = "127.0.0.1:8000"; dataDir = "/data/backups/rest-server"; - appendOnly = true; privateRepos = true; "htpasswd-file" = config.age.secrets."restic-rest-htpasswd".path; }; diff --git a/hosts/idols-ai/restic.nix b/hosts/idols-ai/restic.nix index 768806f2..2cb11b7d 100644 --- a/hosts/idols-ai/restic.nix +++ b/hosts/idols-ai/restic.nix @@ -33,13 +33,6 @@ # archives); a size cap beats guessing file types excludeLargerThan = "500M"; - # The server is append-only (it rejects deletion), so the client cannot - # forget or prune: retention has to be applied by hand, by running - # `restic forget --prune` while the server is temporarily not in - # append-only mode. Snapshots therefore accumulate here; deduplication - # keeps that cheap. - pruneOpts = [ ]; - exclude = [ # Generic patterns only; this repository is public. #