From 969712a9fd6e2b65550d3ecd097b5a83b0f168fe Mon Sep 17 00:00:00 2001 From: Garrett Allen <98648590+Gerrrt@users.noreply.github.com> Date: Wed, 25 Nov 2026 20:36:21 -0800 Subject: [PATCH 1/3] docs(smaug): ADR-0138 keeps gerrrt as smaug's administrator account Co-Authored-By: Claude Opus 5.5 --- README.md | 4 +- ...ellyfins-state-from-a-snapshot-over-ssh.md | 8 ++ ...-gerrrt-as-smaugs-administrator-account.md | 92 +++++++++++++++++++ docs/runbooks/build-the-nas.md | 5 +- docs/security.md | 2 +- 5 files changed, 107 insertions(+), 4 deletions(-) create mode 100644 docs/adr/0138-keep-gerrrt-as-smaugs-administrator-account.md diff --git a/README.md b/README.md index 0cf7c394c..e6fa28d26 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ documents for different readers. at all. Every pinned digest is also scanned weekly for fixable HIGH and CRITICAL CVEs, and each image with findings has an open issue until a scan finds it clean. -- **Documented decisions and runbooks.** 137 ADRs covering what was chosen +- **Documented decisions and runbooks.** 138 ADRs covering what was chosen and what was rejected — including the costs accepted knowingly; 57 runbooks for the operations that are easy to get wrong at 1am, one of which is the handover page a successor reads first. Every critical alert links to @@ -236,7 +236,7 @@ inbound passes may still reach it. Data flow and the maintained Mermaid topology │ ├── architecture.md network.md hardware.md │ ├── observability.md security.md roadmap.md changelog.md │ ├── diagrams/ # the network diagram (SVG) and its predecessors -│ ├── adr/ # 137 ADRs — architecture decision records +│ ├── adr/ # 138 ADRs — architecture decision records │ ├── exercises/ # purple-team exercise records — see its README │ └── runbooks/ # 57 runbooks; successor-handover.md is the front door └── Makefile # make help diff --git a/docs/adr/0045-pull-jellyfins-state-from-a-snapshot-over-ssh.md b/docs/adr/0045-pull-jellyfins-state-from-a-snapshot-over-ssh.md index ceef39c90..4e5bb93a7 100644 --- a/docs/adr/0045-pull-jellyfins-state-from-a-snapshot-over-ssh.md +++ b/docs/adr/0045-pull-jellyfins-state-from-a-snapshot-over-ssh.md @@ -7,6 +7,14 @@ writes the first snapshot schedule decision 4 of asked for > [!NOTE] +> **A second SSH user, 2026-11.** `gerrrt`, the operator's administrator +> account, logs in by key from `desktop-02` and holds a checkout of this +> repository. Decision 4's "for this and nothing else" and the context's "no +> repository checkout" are amended by +> [ADR-0138](0138-keep-gerrrt-as-smaugs-administrator-account.md). The +> checkout is not a deploy path, and the host still holds no key that opens a +> backup. +> > **The pull reads a list, since 2026-09-22.** Audiobookshelf's state joins > Jellyfin's as a second archive in the same set, read from the same > snapshot, and `backup-nas.sh` now reads a table of archive → subpath where diff --git a/docs/adr/0138-keep-gerrrt-as-smaugs-administrator-account.md b/docs/adr/0138-keep-gerrrt-as-smaugs-administrator-account.md new file mode 100644 index 000000000..435292df2 --- /dev/null +++ b/docs/adr/0138-keep-gerrrt-as-smaugs-administrator-account.md @@ -0,0 +1,92 @@ +# ADR-0138: Keep `gerrrt` as `smaug`'s administrator account, with a checkout and no deploy path + +**Status:** Accepted · 2026-11 · amends +[ADR-0045](0045-pull-jellyfins-state-from-a-snapshot-over-ssh.md), +whose fourth decision opened SSH on `smaug` for `frodo` "and nothing else", +and whose context said the host has "no repository checkout" + +## Context + +ADR-0045 turned SSH on for one user, `frodo`, the backup pull's read-only +account, and recorded the host as having no checkout of this repository and +no key that opens anything. The documents kept saying so after both stopped +being true. + +The read-only audit of `smaug` on 2026-11-13 found a second account that no +document named: `gerrrt`, uid `3004`, with TrueNAS's `FULL_ADMIN` role, sudo +for every command, `zsh`, a home at `/mnt/erebor/apps/home/gerrrt`, an SSH +key, and in that home a checkout of this repository, the operator's dotfiles +and Claude Code, which the audit itself ran in. It logged in by password as +well as by key. `network.md` and `security.md` have since recorded the half +of this the firewall sees: the operator decided on 2026-11-23 to keep +`desktop-02` → `10.0.40.30:22` as the path `smaug` is administered by, and +password login was cleared on 2026-11-24. What no document decided is the +account itself: whether an interactive administrator with a checkout belongs +on the appliance that holds the backup datastore. + +The alternative is the shape ADR-0045 described: administer `smaug` from the +TrueNAS UI and its console shell as `truenas_admin`, carry nothing of this +repository on the box, and put every file the stack needs there through +[`smaug-fetch.sh`](../../scripts/smaug-fetch.sh), run on a workstation. That +works, and is what the runbooks still say. What it costs is that every audit, +every `midclt` read and every redeploy is done through the UI shell, by +pasting, from a machine that does not run the commands it prints. The +sessions of 2026-11-13 to 2026-11-25 did their reading, their patches and +the `smaug-fetch.sh` block for the redeploy from `gerrrt`, and none of it +needed to leave the box to be checked. + +## Decision + +**1. `gerrrt` stays, as `smaug`'s one interactive administrator.** It keeps +`FULL_ADMIN` and sudo for all commands. Sudo asks for the password every time: +no `NOPASSWD` entry, for any command. SSH is by key alone, and only from +`desktop-02`, by the host-scoped pass `network.md` records. `truenas_admin` +remains the UI's and the console's account, and is not used over SSH. + +**2. The checkout is for reading, and for printing what the box is given. It +is never a deploy path.** Files reach `/mnt/erebor/apps/stack` only as +`smaug-fetch.sh` installs them: fetched from a commit on `origin/main` and +checked against its sha256 before they replace anything. The checkout may +generate that block, but only from a clean tree at `origin/main`, which is +what the script already refuses otherwise. Nothing is copied from the +checkout into the stack directory, and nothing the stack runs points into +the home. + +**3. Nothing on `smaug` can push to this repository or decrypt its +secrets.** The checkout's push URL is SSH, and `gerrrt` holds no key GitHub +accepts. There is no `gh` and no token. A change found on the box leaves it +as a patch or a bundle and is pushed from a workstation, through review. +There is no `age` identity, so `secrets/*.sops.yaml` stay ciphertext here. +ADR-0045's property, that the host holds no key that opens a backup, is +unchanged. + +**4. A Claude Code session on `smaug` runs as `gerrrt` and is held to the +same rules as the operator.** It reads with `midclt`, `zpool`, `zfs` and the +textfile metrics. It changes the box only when the operator asks it to, and +records what it changed through the repository the way a runbook step is +recorded. It cannot use the Docker socket or sudo without the operator. + +## Consequences + +- **`gerrrt` is root for anyone who has its key and its password.** Sudo for + all commands means the key alone is not enough, and the key works only from + `desktop-02`. That is the residual, and `security.md` carries it. +- **The home is on `erebor/apps`, so it is in that dataset's snapshots.** A + session's transcript under `~/.claude` holds what the session read, kept + for the snapshot task's two weeks after it is deleted. One read on + 2026-11-13 printed the NUT monitor password into a transcript. Sessions + must read secrets by existence and permissions only, and a value that + reaches a transcript is rotated. The backup pull is not affected: it reads + only the subpaths its table names, and the home is not one of them. +- **The root-run scripts must stay owned by root.** On 2026-11-25 the + redeploy block was first run as `gerrrt`, which left the stack directory's + files owned by it until they were changed back. A `.sh` there that + `gerrrt` owns can be edited into root's cron without sudo. The block is + run as root, and an audit checks the owner. +- **The account must not outlive its use.** Turning `gerrrt` off is a UI + change: clear its role and its sudo, remove its key, and delete the home. + Nothing in the stack depends on it, and the pass on `morpheus` can go with + it. +- **The API key the audit found, `ClaudeCode2` on `truenas_admin`, is not + part of this decision.** No session in this account uses it. It is to be + revoked. diff --git a/docs/runbooks/build-the-nas.md b/docs/runbooks/build-the-nas.md index 900efde00..b6252c123 100644 --- a/docs/runbooks/build-the-nas.md +++ b/docs/runbooks/build-the-nas.md @@ -912,7 +912,10 @@ checkout of `main`, [`scripts/smaug-fetch.sh`](../../scripts/smaug-fetch.sh) prints a block that fetches each file from that one commit and checks it against a sha256 computed from your checkout before it replaces anything ([#1424](https://github.com/Gerrrt/HomeLab/issues/1424)). Paste that block -here. A file that does not match stops the block and is not installed; its +here, as root: run as `gerrrt`, it leaves root's cron scripts owned by an +account that can edit them +([ADR-0138](../adr/0138-keep-gerrrt-as-smaugs-administrator-account.md)). +A file that does not match stops the block and is not installed; its `.new` is left for you to look at. The `.env` is copied as-is, because every value in it is a plain host fact. The third file is the SMART collector §6.4 runs from cron diff --git a/docs/security.md b/docs/security.md index a72b4963a..7a9b52f90 100644 --- a/docs/security.md +++ b/docs/security.md @@ -34,7 +34,7 @@ What this network is actually built to survive: | A rooted range target reaching `gandalf` itself | **Dropped at `vmbr1`, before the host firewall.** The host has no address on the range bridge, but Linux answers ARP for its addresses on any interface and accepts a packet for them on any interface. So a target that adds an on-link route to `10.0.30.30` was reaching the host, and only the Proxmox firewall dropped it. `gandalf`'s own `pve-firewall-state` collector watches that firewall now ([ADR-0126](adr/0126-monitor-gandalf-now-that-it-stays-on.md), [#1651](https://github.com/Gerrrt/HomeLab/issues/1651)). A netdev `ingress` table on `vmbr1` now drops every frame the bridge passes up to the host, ARP included, without touching guest-to-guest traffic ([`build-the-playground.md`](runbooks/build-the-playground.md) §2, proved by §8 check four). Behind it, `gandalf` holds no estate credential, no GitHub login, no personal tooling and no third-party apt repository (§4, *Nothing else on `gandalf`*), so the host gives nothing beyond itself. The audits of 2026-11-13 and 2026-11-22 found credentials, then tooling and two third-party repositories. The credentials were gone by 2026-11-22 and the `.claude` footprint by 2026-11-23. **The `vmbr1` table is applied (verified live).** Root's SSH key is Proxmox's node key; the audit found it had reached github, so it was regenerated fresh on 2026-11-23, minutes after a too-broad deletion that day briefly broke self-SSH ([changelog](changelog.md)). The new key is not one github recognises, so no host credential reaches the repository — revoking the old key on github, if it was ever a deploy key, is off-host | | Someone on Winterfell or Hicks logging in to `trinity` | **Key-only `sshd` since 2026-11-20; no host firewall by decision.** `trinity` holds the household's data and the sensitive tier's age key, and its `sshd` answers Hicks (by [ADR-0031](adr/0031-narrow-hicks-to-a-named-list-on-winterfell-and-leave-the-lab-open.md)'s list) and every host on VLAN 99, between which pfSense never filters. [`build-the-sensitive-tier-host.md`](runbooks/build-the-sensitive-tier-host.md) §3 now makes `sshd` key-only through a drop-in that outranks cloud-init's, refuses root and X11 forwarding, and keeps `authorized_keys` to `prometheus`'s key and Hicks's. The audit of 2026-11-13 found it taking passwords, with X11 forwarding on and 17 keys imported from GitHub. The step was applied on 2026-11-20: a password-only login is refused with `Permission denied (publickey)`, and three keys remain, `prometheus`'s, Hicks's and the operator's laptop, the last kept by decision. Agent sessions run on `trinity` as the operator, by decision ([ADR-0123](adr/0123-keep-agent-sessions-on-trinity.md)). `ufw` is installed and stays disabled, unlike `phoenix`'s ([ADR-0117](adr/0117-give-phoenix-a-key-only-sshd-and-a-default-deny-inbound-policy.md)): the other two ports `trinity` answers, `443` and `53`, are published by Docker, whose rules run ahead of `ufw`'s, so a policy would govern `22` alone, which the drop-in already closes to anything without a key. Nothing routes through `trinity`, and as the spare firewall a host policy is one more thing to get in the way the day it stands in for `morpheus`. What reaches `443` and `53` is set by pfSense and by the stack's bind addresses | | Someone on Winterfell or Hicks logging in to `prometheus` | **Key-only `sshd` since 2026-11-23; no host firewall by decision.** `prometheus` holds the estate's CA key and the age key that opens every volume backup set, and converge runs as the operator, who is in `sudo` and `docker`. Its `sshd` answers all of Hicks (by `morpheus`'s pass for `22` to the segment) and every host on VLAN 99. The audit's root-only reads on 2026-11-23 found it taking passwords, with X11 forwarding on and `ufw` inactive. [ADR-0128](adr/0128-give-prometheus-a-key-only-sshd-and-no-host-firewall.md) makes `sshd` key-only through a drop-in that outranks cloud-init's, refusing root and X11 forwarding ([`restore-the-stack.md`](runbooks/restore-the-stack.md#make-sshd-key-only)). It adds no host firewall, because Docker's rules run ahead of `ufw`'s for the published ports, so a policy would cover `22` alone. Those ports stay fenced as before: by `morpheus` by destination, by the ingest proxy's tokens on `9090` and `3100`, and on `6514` by the syslog listener's pinned client certificate and its sender list. The step was applied the same day. `sshd -T` read `no` for all four settings, a password login and a keyboard-interactive login were each refused with `Permission denied (publickey)`, and a key login from Hicks succeeded after the reload. | -| Someone on Hicks or Winterfell logging in to `smaug` | **Key-only `sshd` since 2026-11-24.** `smaug` holds the household's media and the `erebor` pool. Two hosts reach its `22`, each by a host-scoped pass on `morpheus` ([`network.md`](network.md)): `prometheus`, as the read-only backup user `frodo`, and `desktop-02` on Hicks, as the administrator `gerrrt`. From 2026-11-13 `gerrrt` logged in by password, allowed both on the user and in the SSH service's *Password Login Groups*, while the documents said `frodo` was the only user. Both settings were cleared in the TrueNAS UI on 2026-11-24. `sshd_config` then had no `Match` block left, and a connection as `gerrrt` or `root` was offered `publickey` alone. | +| Someone on Hicks or Winterfell logging in to `smaug` | **Key-only `sshd` since 2026-11-24.** `smaug` holds the household's media and the `erebor` pool. Two hosts reach its `22`, each by a host-scoped pass on `morpheus` ([`network.md`](network.md)): `prometheus`, as the read-only backup user `frodo`, and `desktop-02` on Hicks, as the administrator `gerrrt`. From 2026-11-13 `gerrrt` logged in by password, allowed both on the user and in the SSH service's *Password Login Groups*, while the documents said `frodo` was the only user. Both settings were cleared in the TrueNAS UI on 2026-11-24. `sshd_config` then had no `Match` block left, and a connection as `gerrrt` or `root` was offered `publickey` alone. `gerrrt` is kept by [ADR-0138](adr/0138-keep-gerrrt-as-smaugs-administrator-account.md): `FULL_ADMIN` and sudo for all commands, with the password asked every time, and a checkout of this repository that can neither push nor decrypt. Its key and its password together are root on `smaug`; that is the residual. | | Someone with the trusted Wi-Fi key quietly joining | Kea's lease log reaches Loki; `UnknownDeviceOnTrustedSegment` fires the first time a MAC appears on VLAN 50 in seven days ([ADR-0019](adr/0019-read-device-joins-from-the-dhcp-server.md)) | | Losing visibility of a failure | 215 alert rules, 30 days of metrics and logs | | Someone on a reachable VLAN silencing an alert to hide a failure | Alertmanager binds to `127.0.0.1`; silences go through authenticated Grafana | From af7ad15c5047af1c2963cd3ece2224e1cba1b40d Mon Sep 17 00:00:00 2001 From: Garrett Allen <98648590+Gerrrt@users.noreply.github.com> Date: Wed, 25 Nov 2026 20:49:57 -0800 Subject: [PATCH 2/3] docs(smaug): ADR-0138 keeps the MCP server's API key and records the unrotated NUT password Co-Authored-By: Claude Opus 5.5 --- ...-gerrrt-as-smaugs-administrator-account.md | 33 ++++++++++++++----- docs/security.md | 2 +- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/docs/adr/0138-keep-gerrrt-as-smaugs-administrator-account.md b/docs/adr/0138-keep-gerrrt-as-smaugs-administrator-account.md index 435292df2..c4c6e4f09 100644 --- a/docs/adr/0138-keep-gerrrt-as-smaugs-administrator-account.md +++ b/docs/adr/0138-keep-gerrrt-as-smaugs-administrator-account.md @@ -1,4 +1,4 @@ -# ADR-0138: Keep `gerrrt` as `smaug`'s administrator account, with a checkout and no deploy path +# ADR-0138: Keep `gerrrt` as `smaug`'s administrator account, with a checkout and no deploy path, and keep the MCP server's API key **Status:** Accepted · 2026-11 · amends [ADR-0045](0045-pull-jellyfins-state-from-a-snapshot-over-ssh.md), @@ -66,6 +66,16 @@ textfile metrics. It changes the box only when the operator asks it to, and records what it changed through the repository the way a runbook step is recorded. It cannot use the Docker socket or sudo without the operator. +**5. The API key `ClaudeCode2` stays.** It belongs to `truenas_admin`, was +created on 2026-09-29, and has no expiry. It is how the TrueNAS MCP server on +the operator's Windows desktop reaches `smaug`'s API. It is the second +administrative path besides `gerrrt`, and it bypasses sudo: the key alone +acts as `truenas_admin`, with `FULL_ADMIN`. What limits it is the source +address. The API is served on the UI's port, and §6.13's allowlist admits +Hicks alone. That the allowlist refuses the API as well as the UI has not +been tested from another segment: the box admits its own address, so a test +from `smaug` proves nothing. A host on CasaBonita is the test. + ## Consequences - **`gerrrt` is root for anyone who has its key and its password.** Sudo for @@ -73,11 +83,13 @@ recorded. It cannot use the Docker socket or sudo without the operator. `desktop-02`. That is the residual, and `security.md` carries it. - **The home is on `erebor/apps`, so it is in that dataset's snapshots.** A session's transcript under `~/.claude` holds what the session read, kept - for the snapshot task's two weeks after it is deleted. One read on - 2026-11-13 printed the NUT monitor password into a transcript. Sessions - must read secrets by existence and permissions only, and a value that - reaches a transcript is rotated. The backup pull is not affected: it reads - only the subpaths its table names, and the home is not one of them. + for the snapshot task's two weeks after it is deleted. Sessions must read + secrets by existence and permissions only. One read on 2026-11-13 printed + the NUT monitor password into a transcript. The operator decided not to + rotate it: it logs a subscriber in as `secondary`, which reads the UPS's + state and cannot command a shutdown, and only the subscribing hosts reach + the server's `3493`. The backup pull is not affected: it reads only the + subpaths its table names, and the home is not one of them. - **The root-run scripts must stay owned by root.** On 2026-11-25 the redeploy block was first run as `gerrrt`, which left the stack directory's files owned by it until they were changed back. A `.sh` there that @@ -87,6 +99,9 @@ recorded. It cannot use the Docker socket or sudo without the operator. change: clear its role and its sudo, remove its key, and delete the home. Nothing in the stack depends on it, and the pass on `morpheus` can go with it. -- **The API key the audit found, `ClaudeCode2` on `truenas_admin`, is not - part of this decision.** No session in this account uses it. It is to be - revoked. +- **Whoever holds `ClaudeCode2` holds `smaug`, from any Hicks address.** It + lives on the Windows desktop, in the MCP server's configuration. A + compromise of that desktop is a compromise of `smaug`, as it already was + through `gerrrt`'s key and the `desktop-02` pass. Revoking the key under + *Credentials → API Keys* ends the path at once. If the MCP server's use + ends, revoke the key with it. diff --git a/docs/security.md b/docs/security.md index 7a9b52f90..e262a49a5 100644 --- a/docs/security.md +++ b/docs/security.md @@ -34,7 +34,7 @@ What this network is actually built to survive: | A rooted range target reaching `gandalf` itself | **Dropped at `vmbr1`, before the host firewall.** The host has no address on the range bridge, but Linux answers ARP for its addresses on any interface and accepts a packet for them on any interface. So a target that adds an on-link route to `10.0.30.30` was reaching the host, and only the Proxmox firewall dropped it. `gandalf`'s own `pve-firewall-state` collector watches that firewall now ([ADR-0126](adr/0126-monitor-gandalf-now-that-it-stays-on.md), [#1651](https://github.com/Gerrrt/HomeLab/issues/1651)). A netdev `ingress` table on `vmbr1` now drops every frame the bridge passes up to the host, ARP included, without touching guest-to-guest traffic ([`build-the-playground.md`](runbooks/build-the-playground.md) §2, proved by §8 check four). Behind it, `gandalf` holds no estate credential, no GitHub login, no personal tooling and no third-party apt repository (§4, *Nothing else on `gandalf`*), so the host gives nothing beyond itself. The audits of 2026-11-13 and 2026-11-22 found credentials, then tooling and two third-party repositories. The credentials were gone by 2026-11-22 and the `.claude` footprint by 2026-11-23. **The `vmbr1` table is applied (verified live).** Root's SSH key is Proxmox's node key; the audit found it had reached github, so it was regenerated fresh on 2026-11-23, minutes after a too-broad deletion that day briefly broke self-SSH ([changelog](changelog.md)). The new key is not one github recognises, so no host credential reaches the repository — revoking the old key on github, if it was ever a deploy key, is off-host | | Someone on Winterfell or Hicks logging in to `trinity` | **Key-only `sshd` since 2026-11-20; no host firewall by decision.** `trinity` holds the household's data and the sensitive tier's age key, and its `sshd` answers Hicks (by [ADR-0031](adr/0031-narrow-hicks-to-a-named-list-on-winterfell-and-leave-the-lab-open.md)'s list) and every host on VLAN 99, between which pfSense never filters. [`build-the-sensitive-tier-host.md`](runbooks/build-the-sensitive-tier-host.md) §3 now makes `sshd` key-only through a drop-in that outranks cloud-init's, refuses root and X11 forwarding, and keeps `authorized_keys` to `prometheus`'s key and Hicks's. The audit of 2026-11-13 found it taking passwords, with X11 forwarding on and 17 keys imported from GitHub. The step was applied on 2026-11-20: a password-only login is refused with `Permission denied (publickey)`, and three keys remain, `prometheus`'s, Hicks's and the operator's laptop, the last kept by decision. Agent sessions run on `trinity` as the operator, by decision ([ADR-0123](adr/0123-keep-agent-sessions-on-trinity.md)). `ufw` is installed and stays disabled, unlike `phoenix`'s ([ADR-0117](adr/0117-give-phoenix-a-key-only-sshd-and-a-default-deny-inbound-policy.md)): the other two ports `trinity` answers, `443` and `53`, are published by Docker, whose rules run ahead of `ufw`'s, so a policy would govern `22` alone, which the drop-in already closes to anything without a key. Nothing routes through `trinity`, and as the spare firewall a host policy is one more thing to get in the way the day it stands in for `morpheus`. What reaches `443` and `53` is set by pfSense and by the stack's bind addresses | | Someone on Winterfell or Hicks logging in to `prometheus` | **Key-only `sshd` since 2026-11-23; no host firewall by decision.** `prometheus` holds the estate's CA key and the age key that opens every volume backup set, and converge runs as the operator, who is in `sudo` and `docker`. Its `sshd` answers all of Hicks (by `morpheus`'s pass for `22` to the segment) and every host on VLAN 99. The audit's root-only reads on 2026-11-23 found it taking passwords, with X11 forwarding on and `ufw` inactive. [ADR-0128](adr/0128-give-prometheus-a-key-only-sshd-and-no-host-firewall.md) makes `sshd` key-only through a drop-in that outranks cloud-init's, refusing root and X11 forwarding ([`restore-the-stack.md`](runbooks/restore-the-stack.md#make-sshd-key-only)). It adds no host firewall, because Docker's rules run ahead of `ufw`'s for the published ports, so a policy would cover `22` alone. Those ports stay fenced as before: by `morpheus` by destination, by the ingest proxy's tokens on `9090` and `3100`, and on `6514` by the syslog listener's pinned client certificate and its sender list. The step was applied the same day. `sshd -T` read `no` for all four settings, a password login and a keyboard-interactive login were each refused with `Permission denied (publickey)`, and a key login from Hicks succeeded after the reload. | -| Someone on Hicks or Winterfell logging in to `smaug` | **Key-only `sshd` since 2026-11-24.** `smaug` holds the household's media and the `erebor` pool. Two hosts reach its `22`, each by a host-scoped pass on `morpheus` ([`network.md`](network.md)): `prometheus`, as the read-only backup user `frodo`, and `desktop-02` on Hicks, as the administrator `gerrrt`. From 2026-11-13 `gerrrt` logged in by password, allowed both on the user and in the SSH service's *Password Login Groups*, while the documents said `frodo` was the only user. Both settings were cleared in the TrueNAS UI on 2026-11-24. `sshd_config` then had no `Match` block left, and a connection as `gerrrt` or `root` was offered `publickey` alone. `gerrrt` is kept by [ADR-0138](adr/0138-keep-gerrrt-as-smaugs-administrator-account.md): `FULL_ADMIN` and sudo for all commands, with the password asked every time, and a checkout of this repository that can neither push nor decrypt. Its key and its password together are root on `smaug`; that is the residual. | +| Someone on Hicks or Winterfell logging in to `smaug` | **Key-only `sshd` since 2026-11-24.** `smaug` holds the household's media and the `erebor` pool. Two hosts reach its `22`, each by a host-scoped pass on `morpheus` ([`network.md`](network.md)): `prometheus`, as the read-only backup user `frodo`, and `desktop-02` on Hicks, as the administrator `gerrrt`. From 2026-11-13 `gerrrt` logged in by password, allowed both on the user and in the SSH service's *Password Login Groups*, while the documents said `frodo` was the only user. Both settings were cleared in the TrueNAS UI on 2026-11-24. `sshd_config` then had no `Match` block left, and a connection as `gerrrt` or `root` was offered `publickey` alone. `gerrrt` is kept by [ADR-0138](adr/0138-keep-gerrrt-as-smaugs-administrator-account.md): `FULL_ADMIN` and sudo for all commands, with the password asked every time, and a checkout of this repository that can neither push nor decrypt. Its key and its password together are root on `smaug`; that is the residual. The same ADR keeps `ClaudeCode2`, an API key on `truenas_admin` with no expiry, which the TrueNAS MCP server on the operator's Windows desktop uses. The key alone is `FULL_ADMIN` over the API. The UI allowlist is meant to limit it to Hicks, which has not been tested from CasaBonita. | | Someone with the trusted Wi-Fi key quietly joining | Kea's lease log reaches Loki; `UnknownDeviceOnTrustedSegment` fires the first time a MAC appears on VLAN 50 in seven days ([ADR-0019](adr/0019-read-device-joins-from-the-dhcp-server.md)) | | Losing visibility of a failure | 215 alert rules, 30 days of metrics and logs | | Someone on a reachable VLAN silencing an alert to hide a failure | Alertmanager binds to `127.0.0.1`; silences go through authenticated Grafana | From 674406a9f7dbeffd7fc953f667a2c89aa59cc5cf Mon Sep 17 00:00:00 2001 From: Garrett Allen <98648590+Gerrrt@users.noreply.github.com> Date: Wed, 25 Nov 2026 21:24:54 -0800 Subject: [PATCH 3/3] docs(smaug): ADR-0139 keeps the MCP server's API key and leaves the NUT password as it is ADR-0138 merged in #1761 before its amendment did, so it is accepted and not edited. This puts it back as main has it, adds a back-link note, and records the two decisions in a new ADR. Co-Authored-By: Claude Opus 5.5 --- README.md | 4 +- ...-gerrrt-as-smaugs-administrator-account.md | 8 +++ ...9-keep-the-mcp-servers-api-key-on-smaug.md | 55 +++++++++++++++++++ docs/security.md | 2 +- 4 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 docs/adr/0139-keep-the-mcp-servers-api-key-on-smaug.md diff --git a/README.md b/README.md index e6fa28d26..a143d5e8e 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,7 @@ documents for different readers. at all. Every pinned digest is also scanned weekly for fixable HIGH and CRITICAL CVEs, and each image with findings has an open issue until a scan finds it clean. -- **Documented decisions and runbooks.** 138 ADRs covering what was chosen +- **Documented decisions and runbooks.** 139 ADRs covering what was chosen and what was rejected — including the costs accepted knowingly; 57 runbooks for the operations that are easy to get wrong at 1am, one of which is the handover page a successor reads first. Every critical alert links to @@ -236,7 +236,7 @@ inbound passes may still reach it. Data flow and the maintained Mermaid topology │ ├── architecture.md network.md hardware.md │ ├── observability.md security.md roadmap.md changelog.md │ ├── diagrams/ # the network diagram (SVG) and its predecessors -│ ├── adr/ # 138 ADRs — architecture decision records +│ ├── adr/ # 139 ADRs — architecture decision records │ ├── exercises/ # purple-team exercise records — see its README │ └── runbooks/ # 57 runbooks; successor-handover.md is the front door └── Makefile # make help diff --git a/docs/adr/0138-keep-gerrrt-as-smaugs-administrator-account.md b/docs/adr/0138-keep-gerrrt-as-smaugs-administrator-account.md index 435292df2..74f63e0c4 100644 --- a/docs/adr/0138-keep-gerrrt-as-smaugs-administrator-account.md +++ b/docs/adr/0138-keep-gerrrt-as-smaugs-administrator-account.md @@ -5,6 +5,14 @@ whose fourth decision opened SSH on `smaug` for `frodo` "and nothing else", and whose context said the host has "no repository checkout" +> [!NOTE] +> **Two consequences below are amended, 2026-11-25.** `ClaudeCode2` has a +> use, the TrueNAS MCP server on the operator's Windows desktop, and stays. +> The NUT monitor password printed into a transcript on 2026-11-13 is not +> rotated. Both are +> [ADR-0139](0139-keep-the-mcp-servers-api-key-on-smaug.md)'s. The rest of +> this decision is unchanged. + ## Context ADR-0045 turned SSH on for one user, `frodo`, the backup pull's read-only diff --git a/docs/adr/0139-keep-the-mcp-servers-api-key-on-smaug.md b/docs/adr/0139-keep-the-mcp-servers-api-key-on-smaug.md new file mode 100644 index 000000000..6c0085a5e --- /dev/null +++ b/docs/adr/0139-keep-the-mcp-servers-api-key-on-smaug.md @@ -0,0 +1,55 @@ +# ADR-0139: Keep the TrueNAS MCP server's API key on `smaug`, and leave the NUT password that reached a transcript as it is + +**Status:** Accepted · 2026-11 · amends +[ADR-0138](0138-keep-gerrrt-as-smaugs-administrator-account.md), whose last +consequence said the `ClaudeCode2` key was to be revoked and whose second +said a value that reaches a transcript is rotated + +## Context + +The read-only audit of `smaug` on 2026-11-13 found an API key, `ClaudeCode2`, +on `truenas_admin`: created 2026-09-29, with no expiry, and named in no +document. ADR-0138, written when its use was not known, said no session in +`gerrrt` used it and that it was to be revoked. + +It has a use. The TrueNAS MCP server on the operator's Windows desktop holds +it and reaches `smaug`'s API with it. That is how the operator works with +`smaug` from the desktop. It is a separate path from `gerrrt`'s SSH and from +Claude Code running on `smaug`. + +The same audit printed the NUT monitor password into a session's transcript, +by a `midclt` read on 2026-11-13. ADR-0138 made rotating any such value the +rule. + +## Decision + +**1. `ClaudeCode2` stays, for the TrueNAS MCP server, with no expiry.** It is +the second administrative path to `smaug` besides `gerrrt`, and the one that +bypasses sudo: the key alone acts as `truenas_admin`, with `FULL_ADMIN`. +What limits it is the source address. The API is served on the UI's port, +and [`build-the-nas.md`](../runbooks/build-the-nas.md) §6.13's allowlist +admits Hicks alone. That the allowlist refuses the API as well as the UI has +not been tested from another segment: the box admits its own address, so a +test from `smaug` proves nothing. A host on CasaBonita is the test. + +**2. The NUT monitor password is not rotated.** It logs a subscriber in as +`secondary`, which reads the UPS's state and cannot command a shutdown, and +only the subscribing hosts reach the server's `3493`. ADR-0138's rule still +holds for every other value: a session reads secrets by existence and +permissions only, and a value that reaches a transcript is rotated unless a +decision like this one says otherwise. + +## Consequences + +- **Whoever holds `ClaudeCode2` holds `smaug`, from any Hicks address.** It + lives on the Windows desktop, in the MCP server's configuration. A + compromise of that desktop is a compromise of `smaug`, as it already was + through `gerrrt`'s key and the `desktop-02` pass. Revoking the key under + *Credentials → API Keys* ends the path at once. If the MCP server's use + ends, revoke the key with it. +- **The NUT password stays in the transcript and in `erebor/apps`'s + snapshots** until the transcript is deleted and the snapshots age out, and + in the conversation's copy off the estate. The operator accepts that. +- **A future audit will find both and should not raise them again.** It + should check that the key is still the only one, still on `truenas_admin`, + and still used. diff --git a/docs/security.md b/docs/security.md index 7a9b52f90..e66a9599b 100644 --- a/docs/security.md +++ b/docs/security.md @@ -34,7 +34,7 @@ What this network is actually built to survive: | A rooted range target reaching `gandalf` itself | **Dropped at `vmbr1`, before the host firewall.** The host has no address on the range bridge, but Linux answers ARP for its addresses on any interface and accepts a packet for them on any interface. So a target that adds an on-link route to `10.0.30.30` was reaching the host, and only the Proxmox firewall dropped it. `gandalf`'s own `pve-firewall-state` collector watches that firewall now ([ADR-0126](adr/0126-monitor-gandalf-now-that-it-stays-on.md), [#1651](https://github.com/Gerrrt/HomeLab/issues/1651)). A netdev `ingress` table on `vmbr1` now drops every frame the bridge passes up to the host, ARP included, without touching guest-to-guest traffic ([`build-the-playground.md`](runbooks/build-the-playground.md) §2, proved by §8 check four). Behind it, `gandalf` holds no estate credential, no GitHub login, no personal tooling and no third-party apt repository (§4, *Nothing else on `gandalf`*), so the host gives nothing beyond itself. The audits of 2026-11-13 and 2026-11-22 found credentials, then tooling and two third-party repositories. The credentials were gone by 2026-11-22 and the `.claude` footprint by 2026-11-23. **The `vmbr1` table is applied (verified live).** Root's SSH key is Proxmox's node key; the audit found it had reached github, so it was regenerated fresh on 2026-11-23, minutes after a too-broad deletion that day briefly broke self-SSH ([changelog](changelog.md)). The new key is not one github recognises, so no host credential reaches the repository — revoking the old key on github, if it was ever a deploy key, is off-host | | Someone on Winterfell or Hicks logging in to `trinity` | **Key-only `sshd` since 2026-11-20; no host firewall by decision.** `trinity` holds the household's data and the sensitive tier's age key, and its `sshd` answers Hicks (by [ADR-0031](adr/0031-narrow-hicks-to-a-named-list-on-winterfell-and-leave-the-lab-open.md)'s list) and every host on VLAN 99, between which pfSense never filters. [`build-the-sensitive-tier-host.md`](runbooks/build-the-sensitive-tier-host.md) §3 now makes `sshd` key-only through a drop-in that outranks cloud-init's, refuses root and X11 forwarding, and keeps `authorized_keys` to `prometheus`'s key and Hicks's. The audit of 2026-11-13 found it taking passwords, with X11 forwarding on and 17 keys imported from GitHub. The step was applied on 2026-11-20: a password-only login is refused with `Permission denied (publickey)`, and three keys remain, `prometheus`'s, Hicks's and the operator's laptop, the last kept by decision. Agent sessions run on `trinity` as the operator, by decision ([ADR-0123](adr/0123-keep-agent-sessions-on-trinity.md)). `ufw` is installed and stays disabled, unlike `phoenix`'s ([ADR-0117](adr/0117-give-phoenix-a-key-only-sshd-and-a-default-deny-inbound-policy.md)): the other two ports `trinity` answers, `443` and `53`, are published by Docker, whose rules run ahead of `ufw`'s, so a policy would govern `22` alone, which the drop-in already closes to anything without a key. Nothing routes through `trinity`, and as the spare firewall a host policy is one more thing to get in the way the day it stands in for `morpheus`. What reaches `443` and `53` is set by pfSense and by the stack's bind addresses | | Someone on Winterfell or Hicks logging in to `prometheus` | **Key-only `sshd` since 2026-11-23; no host firewall by decision.** `prometheus` holds the estate's CA key and the age key that opens every volume backup set, and converge runs as the operator, who is in `sudo` and `docker`. Its `sshd` answers all of Hicks (by `morpheus`'s pass for `22` to the segment) and every host on VLAN 99. The audit's root-only reads on 2026-11-23 found it taking passwords, with X11 forwarding on and `ufw` inactive. [ADR-0128](adr/0128-give-prometheus-a-key-only-sshd-and-no-host-firewall.md) makes `sshd` key-only through a drop-in that outranks cloud-init's, refusing root and X11 forwarding ([`restore-the-stack.md`](runbooks/restore-the-stack.md#make-sshd-key-only)). It adds no host firewall, because Docker's rules run ahead of `ufw`'s for the published ports, so a policy would cover `22` alone. Those ports stay fenced as before: by `morpheus` by destination, by the ingest proxy's tokens on `9090` and `3100`, and on `6514` by the syslog listener's pinned client certificate and its sender list. The step was applied the same day. `sshd -T` read `no` for all four settings, a password login and a keyboard-interactive login were each refused with `Permission denied (publickey)`, and a key login from Hicks succeeded after the reload. | -| Someone on Hicks or Winterfell logging in to `smaug` | **Key-only `sshd` since 2026-11-24.** `smaug` holds the household's media and the `erebor` pool. Two hosts reach its `22`, each by a host-scoped pass on `morpheus` ([`network.md`](network.md)): `prometheus`, as the read-only backup user `frodo`, and `desktop-02` on Hicks, as the administrator `gerrrt`. From 2026-11-13 `gerrrt` logged in by password, allowed both on the user and in the SSH service's *Password Login Groups*, while the documents said `frodo` was the only user. Both settings were cleared in the TrueNAS UI on 2026-11-24. `sshd_config` then had no `Match` block left, and a connection as `gerrrt` or `root` was offered `publickey` alone. `gerrrt` is kept by [ADR-0138](adr/0138-keep-gerrrt-as-smaugs-administrator-account.md): `FULL_ADMIN` and sudo for all commands, with the password asked every time, and a checkout of this repository that can neither push nor decrypt. Its key and its password together are root on `smaug`; that is the residual. | +| Someone on Hicks or Winterfell logging in to `smaug` | **Key-only `sshd` since 2026-11-24.** `smaug` holds the household's media and the `erebor` pool. Two hosts reach its `22`, each by a host-scoped pass on `morpheus` ([`network.md`](network.md)): `prometheus`, as the read-only backup user `frodo`, and `desktop-02` on Hicks, as the administrator `gerrrt`. From 2026-11-13 `gerrrt` logged in by password, allowed both on the user and in the SSH service's *Password Login Groups*, while the documents said `frodo` was the only user. Both settings were cleared in the TrueNAS UI on 2026-11-24. `sshd_config` then had no `Match` block left, and a connection as `gerrrt` or `root` was offered `publickey` alone. `gerrrt` is kept by [ADR-0138](adr/0138-keep-gerrrt-as-smaugs-administrator-account.md): `FULL_ADMIN` and sudo for all commands, with the password asked every time, and a checkout of this repository that can neither push nor decrypt. Its key and its password together are root on `smaug`; that is the residual. [ADR-0139](adr/0139-keep-the-mcp-servers-api-key-on-smaug.md) keeps `ClaudeCode2`, an API key on `truenas_admin` with no expiry, which the TrueNAS MCP server on the operator's Windows desktop uses. The key alone is `FULL_ADMIN` over the API. The UI allowlist is meant to limit it to Hicks, which has not been tested from CasaBonita. | | Someone with the trusted Wi-Fi key quietly joining | Kea's lease log reaches Loki; `UnknownDeviceOnTrustedSegment` fires the first time a MAC appears on VLAN 50 in seven days ([ADR-0019](adr/0019-read-device-joins-from-the-dhcp-server.md)) | | Losing visibility of a failure | 215 alert rules, 30 days of metrics and logs | | Someone on a reachable VLAN silencing an alert to hide a failure | Alertmanager binds to `127.0.0.1`; silences go through authenticated Grafana |