Harden Backrest CLI endpoint and restore recipes #226

Open
opened 2026-09-12 23:22:14 +01:00 by nimmo · 0 comments
Owner

Problem

Phase 4 backup-runbook verification found that the repository's interactive restic recipes do not fully match the declared Backrest service and recovery requirements.

  1. modules/services/backrest.nix uses mass-storage.mesh:8008, while justfiles/maintenance.just hard-codes 192.168.8.238:8008 for every backup-* restic recipe. The daemon and operator commands can therefore have different reachability, especially away from the LAN.
  2. just backup-restore targets / with --overwrite always but invokes restic restore as the ordinary caller. Current plans contain root-owned service state as well as home data, so a disaster restore can partially write user-owned paths and then fail on privileged paths.
  3. backup-restore-path creates its target before running restic and refuses any existing target. A failed restore leaves a directory that must be handled explicitly before retry, but the helper gives no completion marker or cleanup guidance.
  4. The CLI endpoint/user/repository settings are duplicated literals instead of sharing the Nix options/configuration used by Backrest.

Scope

  • Give Backrest and interactive restic commands one evaluated endpoint/repository configuration.
  • Make full-host restore privilege and overwrite behavior explicit and safe.
  • Prevent or clearly detect partial restore completion.
  • Add regression coverage for target-exists, failed-restore, host filtering, and privileged full-restore behavior.
  • Update the wiki runbooks if the supported interface changes.

Acceptance criteria

  • Daemon and CLI recipes use the same mesh-capable repository endpoint.
  • Full restore cannot silently leave a mixed partial state because it lacked filesystem permissions.
  • Failed staged restores have a clear retry/cleanup path.
  • Repository settings have one declarative owner.
  • Tests cover failure and overwrite boundaries.
  • Backup and disaster-recovery runbooks can remove the transitional warning.

Discovered while executing wiki issue #222 against source commit 556df88494.

## Problem Phase 4 backup-runbook verification found that the repository's interactive restic recipes do not fully match the declared Backrest service and recovery requirements. 1. `modules/services/backrest.nix` uses `mass-storage.mesh:8008`, while `justfiles/maintenance.just` hard-codes `192.168.8.238:8008` for every `backup-*` restic recipe. The daemon and operator commands can therefore have different reachability, especially away from the LAN. 2. `just backup-restore` targets `/` with `--overwrite always` but invokes `restic restore` as the ordinary caller. Current plans contain root-owned service state as well as home data, so a disaster restore can partially write user-owned paths and then fail on privileged paths. 3. `backup-restore-path` creates its target before running restic and refuses any existing target. A failed restore leaves a directory that must be handled explicitly before retry, but the helper gives no completion marker or cleanup guidance. 4. The CLI endpoint/user/repository settings are duplicated literals instead of sharing the Nix options/configuration used by Backrest. ## Scope - Give Backrest and interactive restic commands one evaluated endpoint/repository configuration. - Make full-host restore privilege and overwrite behavior explicit and safe. - Prevent or clearly detect partial restore completion. - Add regression coverage for target-exists, failed-restore, host filtering, and privileged full-restore behavior. - Update the wiki runbooks if the supported interface changes. ## Acceptance criteria - [ ] Daemon and CLI recipes use the same mesh-capable repository endpoint. - [ ] Full restore cannot silently leave a mixed partial state because it lacked filesystem permissions. - [ ] Failed staged restores have a clear retry/cleanup path. - [ ] Repository settings have one declarative owner. - [ ] Tests cover failure and overwrite boundaries. - [ ] Backup and disaster-recovery runbooks can remove the transitional warning. Discovered while executing wiki issue #222 against source commit 556df88494686003b1c4f20c8e0b99b5afc16a6e.
Sign in to join this conversation.
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
nimmo/nixos-config#226
No description provided.