From 5ad233c61241908906210a6a72bf1fd14019154c Mon Sep 17 00:00:00 2001 From: Inferencebot Date: Thu, 19 Nov 2026 23:41:16 +0000 Subject: [PATCH] security: root-only backup credentials, internal-only key feed, corrected cadence --- maintenance/backups.md | 13 +++++++++---- maintenance/librechat-key-feed.md | 21 ++++++++++++--------- migration/cloudron-server-migration.md | 2 +- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/maintenance/backups.md b/maintenance/backups.md index eab6661..e67cd72 100644 --- a/maintenance/backups.md +++ b/maintenance/backups.md @@ -87,10 +87,15 @@ having failed. ### Other mechanics - Weekly `restic check` on Sundays (repo metadata); full data check monthly. -- The passphrase (`RESTIC_PASSWORD`) lives in `~/.hermes/.env` **and** the co-op - Vault. A backup whose key exists only on the backed-up box is not a backup. -- S3 credentials come from `SWB_S3_ACCESS_KEY` / `SWB_S3_SECRET_KEY` (mapped to - `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` in the script). +- Backup credentials (`RESTIC_PASSWORD`, `RESTIC_REPOSITORY`, + `SWB_S3_ACCESS_KEY`, `SWB_S3_SECRET_KEY`) live in **root-only + `/etc/agent-backup.env`** (0600) and in the co-op Vault — never in the + steward agent's `~/.hermes/.env`. The systemd timer runs as root; the agent + can run the backup but cannot read or delete its credentials. +- **Append-only is not configured.** The Swiss Backup S3 bucket has no object + lock / immutability policy enabled, so stolen S3 keys can still delete + snapshots. This remains an open item; the root-only split only reduces who + holds them. ## 2. Cloudron app backup diff --git a/maintenance/librechat-key-feed.md b/maintenance/librechat-key-feed.md index ce155dd..7aa0df1 100644 --- a/maintenance/librechat-key-feed.md +++ b/maintenance/librechat-key-feed.md @@ -34,15 +34,18 @@ exposure window is bounded by how fast misuse would show. ## What is in place instead (2026-11-05) -1. **Access logging on the route**: every fetch logs a WARNING line - `librechat key feed served: N member key(s) to (ua=…)`. Count only — - never key material, never member emails (the portal's log redactor strips - emails anyway). -2. **Daily-digest watch** (cron job 95e5b8fece86, §7 anomaly list): the - sandbox polls ~every 10 min (~144 serves/day expected). The digest counts - `librechat key feed served` lines and flags (a) a rate far above that - cadence, or (b) any 401 burst on the route — either is a suspected token - misuse and becomes a decision item. +1. **Internal-network restriction**: `/admin/librechat/keys` refuses any + request whose last `X-Forwarded-For` hop is a public address (`403 Internal + network only`). A stolen sync token used from the internet no longer looks + like the sandbox. +2. **Access logging on the route**: every fetch logs a WARNING line + `librechat key feed served: N member key(s) to `. Count and client + address only — never key material, never member emails. +3. **Daily-digest watch** (cron job 95e5b8fece86, §7 anomaly list): the + sandbox polls **every minute (~1,440/day) by design**; the old ~144/day + baseline was stale. The digest flags (a) a rate far above ~1/min, (b) any + 401/ERROR burst, or (c) any `REFUSED for non-internal address` line — + either is suspected token misuse and becomes a decision item. ## What a real fix looks like (if ever needed) diff --git a/migration/cloudron-server-migration.md b/migration/cloudron-server-migration.md index 2eb0d52..933764c 100644 --- a/migration/cloudron-server-migration.md +++ b/migration/cloudron-server-migration.md @@ -75,7 +75,7 @@ needed to restore are inside the thing being restored. the *secret* must be in hand before the window — get it from the Infomaniak console and store it with the passphrase, off-box. - [x] The **restic** passphrase is safe: `~/.hermes/scripts/backup.sh` documents that - `RESTIC_PASSWORD` lives in the agent host's `.env` **and** the co-op Vault. The agent + `RESTIC_PASSWORD` lives in root-only `/etc/agent-backup.env` **and** the co-op Vault. The agent host is not being migrated, so the agent-side backup stays recoverable. (The Vault, however, is an app on the box being migrated — so the Vault copy alone is not off-box until it is exported.)