Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.** 122 ADRs covering what was chosen
- **Documented decisions and runbooks.** 123 ADRs covering what was chosen
and what was rejected — including the costs accepted knowingly; 53
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
Expand Down Expand Up @@ -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/ # 122 ADRs — architecture decision records
│ ├── adr/ # 123 ADRs — architecture decision records
│ ├── exercises/ # purple-team exercise records — see its README
│ └── runbooks/ # 53 runbooks; successor-handover.md is the front door
└── Makefile # make help
Expand Down
58 changes: 58 additions & 0 deletions docs/adr/0123-keep-agent-sessions-on-trinity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# ADR-0123: Keep agent sessions on `trinity`

**Status:** Accepted · 2026-11

## Context

`trinity` holds the sensitive tier: the household's photographs, documents,
budget and vault, and the tier's age key in the operator's home directory.
The operator account is in `sudo`, `docker` and `lxd`, so anything that runs
as that account can reach root and every secret on the host.

The audit of 2026-11-13 found `trinity` also used as a development host: 41
worktrees in the deployment checkout, Go and npm caches, two upstream forks
and their toolchains, language runtimes under `mise`, and Claude Code sessions
working in the checkout. Third-party code and agents ran as the user holding
the key. The repository said nothing about it either way.

`fenrir` met the same finding the same week and was cleared to an appliance,
Claude Code included (`security.md`, the sensor row).

## Decision

On 2026-11-21 the development tooling left `trinity`: the worktrees, `~/go`,
`~/.npm`, `~/code/upstream`, the `golang` package, the `mise` languages and the
development caches. The operator's shell (the dotfiles and their tools) stays.

**Claude Code stays.** Sessions on `trinity` are how the operator inspects and
maintains the host: reading its state, running the repository's checks, and
preparing pull requests from a scratch clone. That is accepted with its cost.

- Sessions work in a scratch clone for anything they change. The deployment
checkout is converge's, and changes reach it only through `main`.
- Language toolchains and upstream forks do not return, and neither does
`pipx`. `scripts/lint.sh` runs some checks in pinned containers, which
`homelab-prune-images` clears weekly when unused, and others (yamllint,
ansible-lint, ruff) through host-side `pipx`. Without `pipx` those skip on
`trinity`, and CI runs them with `--require-all`. `scripts/validate.sh`
still runs the repository's own Python scripts on the host.
- A later audit reads Claude Code on `trinity` as this decision, not as a
finding.

## Consequences

- **An agent session runs as the account that holds the age key and the
`docker` group.** A compromised session, or a session that does the wrong
thing, can read every secret on the tier and reach root. The mitigation is
the operator watching what each session does and approving its actions; no
control on the host separates the two.
- The agent's own dependencies (the Claude Code binary and its updates) are a
supply chain into the sensitive tier that `compose.yaml` does not pin.
- Moving agent work to `prometheus` would take the agent's installation and
its supply chain off `trinity`. It would not take away its reach: `prometheus`'s
key logs in to the same operator account, with `docker` and `lxd`, so a
session there could still read the tier's secrets and reach root over SSH.
Separating the two would need a key or account on `trinity` that cannot do
that. Either change supersedes this ADR.
- `fenrir` stays an appliance. The difference is that `trinity` is maintained
interactively by the operator, and `fenrir` is not.
18 changes: 18 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@ docstring gives: it is a record, not a claim about now.

## 2026-11-21

- **`trinity` re-checked after its audit, and what the re-check found.**
Every finding of 2026-11-13 was read again on the host and holds: key-only
`sshd`, three keys, the UPS client on line, USB boot off, the development
tooling gone and SMART collected. The re-check found what the fixes had
missed. `homelab-patch-state` was never installed on `trinity`: only
`prune-images` was, on 2026-10-07, so `RebootRequired` and the pending-update
alerts could not see the host. The build runbook's §9 now installs the
collectors by name, because the bare form would also install the agent
`smart-state`, which writes the same file as `smart-state-sensitive`.
[ADR-0123](adr/0123-keep-agent-sessions-on-trinity.md) records that Claude
Code stays on `trinity` while the development tooling left it, and what that
costs. `security.md`'s `trinity` login row still said the `sshd` step was
not applied; it was, on 2026-11-20. The roadmap's #404 list named the second
age recipient and ADR-0022's record as left, though both were done (on
2026-10-03 and by ADR-0075); only ADR-0023's *Independent* test is left.
#132 closes: it stayed open on #455, which ADR-0122 closed, and its restore
was rehearsed on 2026-09-28. Its roadmap entry leaves.

- **The wall's big type is smaller, so its panels have room.** With the
context card, the week and the Home row added, the wall had begun to look
crowded. Nothing was taken off it. The largest type shrank by about a
Expand Down
13 changes: 6 additions & 7 deletions docs/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,21 @@ The milestone has no order between its issues.

## trinity

Closes when #404 and #132 close.
Closes when #404 closes.

- **[#404](https://github.com/Gerrrt/HomeLab/issues/404) Build the tier's
host.** **Built and deployed 2026-09-28**
([ADR-0034](adr/0034-run-the-sensitive-tier-on-the-prodesk-and-make-it-the-spare-hardware.md),
→ [runbook](runbooks/build-the-sensitive-tier-host.md)). What is left:
- the step 10 gate: the second age recipient, ADR-0022's
identity-provider record and ADR-0023's *Independent* test. There is no
off-estate copy to wait for:
- §13's last item, ADR-0023's *Independent* test: the household's own
credentials open Vaultwarden from the other person's device, without the
operator present. The second age recipient (2026-10-03) and ADR-0022's
record ([ADR-0075](adr/0075-re-accept-the-sso-deferral-once-the-tier-holds-real-data.md))
are done. There is no off-estate copy to wait for:
[ADR-0122](adr/0122-drop-the-household-copy.md) dropped it, and the
originals' only copy beyond the USB disk is the nightly one to `oracle`,
in the same room
([ADR-0064](adr/0064-copy-immichs-library-to-oracle-until-the-off-estate-copy-exists.md)).
- **[#132](https://github.com/Gerrrt/HomeLab/issues/132) Immich**, the one of
ADR-0008's nine still open; the issue says what is left. Its restore is
rehearsed (→ [runbook](runbooks/restore-the-sensitive-tier.md#restore-immich)).

## exercises

Expand Down
25 changes: 18 additions & 7 deletions docs/runbooks/build-the-sensitive-tier-host.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ holds the household's data. `trinity` has no host firewall by decision
([`security.md`](../security.md)), so this drop-in is the control on `22`.

Keep `~/.ssh/authorized_keys` to the machines you administer it from:
`prometheus`'s key, put there by `ssh-copy-id` above, and Hicks's. Install
`prometheus`'s key, put there by `ssh-copy-id` above, Hicks's, and the
operator's laptop's, which was kept by decision on 2026-11-20. Install
Hicks's now, from Hicks, while a password still works:

```bash
Expand All @@ -164,7 +165,8 @@ ssh-copy-id <you>@10.0.99.40

Delete every other line in the file, including any `gh:` import. Before
going further, prove a fresh key login from each machine; run this on
`prometheus` and on Hicks, and both must succeed with no password prompt:
`prometheus`, on Hicks and on the laptop, and each must succeed with no
password prompt:

```bash
ssh -o ControlPath=none -o PreferredAuthentications=publickey -o PasswordAuthentication=no <you>@10.0.99.40 true
Expand Down Expand Up @@ -564,11 +566,18 @@ The agent, from `prometheus`:

```bash
./scripts/deploy-agent.sh <you>@10.0.99.40
make install-agent-collectors AGENT=<you>@10.0.99.40
make install-agent-collectors AGENT=<you>@10.0.99.40 ARGS='--only patch-state'
make install-agent-collectors AGENT=<you>@10.0.99.40 ARGS='--only prune-images'
```

The first needs no privilege on `trinity`. The second asks for your `sudo`
password there, which is why it is separate. Within a minute
The first needs no privilege on `trinity`. The other two ask for your `sudo`
password there, which is why they are separate. They are named one by one
because the bare form also installs the agent `smart-state`, which writes the
same `smart-state-trinity.prom` as the sensitive profile's
`smart-state-sensitive` (§12): two timers would race on one file.
`patch-state` is what lets `RebootRequired` and the pending-update alerts see
`trinity`; the audit of 2026-11-13 found only `prune-images` installed, and
`apt-patch-state.prom` missing. Within a minute
`up{instance=~"trinity.*"}` is 1 in Prometheus.

## 10. Trust the root, then the first logins
Expand Down Expand Up @@ -711,7 +720,7 @@ gets a row of its own while it is attached.
These four are the gate on the data, not on the containers, and each is
written in a document that already exists. The gate was passed with most of it
open: Immich's first real photographs arrived on 2026-09-28, and the stack
README's warning records it. Items 1 and 3 are done. There was a fifth, the
README's warning records it. Items 1, 2 and 3 are done. There was a fifth, the
off-estate copy, and
[ADR-0122](../adr/0122-drop-the-household-copy.md) dropped it: ADR-0064's
copy to `oracle` is the library's only copy off the host. ADR-0022's
Expand All @@ -726,7 +735,9 @@ admin since 2026-09-29, and Vaultwarden and Paperless-ngx by 2026-10-02.
([ADR-0024](../adr/0024-hold-a-second-age-recipient-and-prove-each-one-separately.md)).
Run `make secrets-add-recipient STACK=sensitive PUBKEY=age1…`, then one
more `make backup STACK=sensitive`, so a set exists that the second key
opens.
opens. Done on 2026-10-03
([#866](https://github.com/Gerrrt/HomeLab/pull/866)); every nightly set
since is encrypted to both.
3. **ADR-0022's decision recorded.** Either an identity provider, or the
deferral re-accepted with reasons. Done on 2026-10-02: re-accepted, by
[ADR-0075](../adr/0075-re-accept-the-sso-deferral-once-the-tier-holds-real-data.md).
Expand Down
2 changes: 1 addition & 1 deletion docs/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ What this network is actually built to survive:
| Someone on the lab segment reaching `eden`'s SSH | **Key-only, unfenced, and accepted.** `eden` holds the map of the weak domain's attack paths, and its `sshd` answers all of VLAN 30, the six domain guests included: the guest runs with `firewall=0` and no host firewall, and nothing in this repository fences `sshd` on any Linux lab guest. What bounds it is the key. `sshd` refuses passwords, and `garnet` takes two keys, the operator's and `phoenix`'s, which `tofu/` installs; `root`'s copies are command-restricted by cloud-init. `garnet`'s sudo is `NOPASSWD`, from the default user Proxmox's cloud-init makes on every Linux guest `tofu/` builds, and is accepted with it: on `eden` `garnet` is in the `docker` group, which is root already. A fence by source address, as the domain's six have for `phoenix`, would be its own decision for every Linux guest, not `eden`'s alone |
| Someone on the lab segment reaching the lab's Grafana or BloodHound, or a detonation reaching `diabolos`'s UIs | **Scoped by address, as the SOC's are.** `alexander`'s Grafana (`3000`) is published by the lab stack's `caddy`, and `eden`'s BloodHound (`8443`) by the bloodhound stack's own `caddy`; each answers Hicks's `10.0.50.0/24` and refuses the rest of VLAN 30, the six domain guests included. `diabolos`, not yet built, has soc's fence for its dashboard and GUI. Until then Grafana and BloodHound answered all of VLAN 30, where BloodHound's graph is the domain's attack-path map ([#1428](https://github.com/Gerrrt/HomeLab/issues/1428)). The residuals are the SOC row's: Hicks is a whole /24, and an address on VLAN 30 can be spoofed for a one-way packet but not for the TLS session the UIs need |
| A range target with a path out | It has none — `gandalf`'s targets sit on a bridge with no physical port, on `172.30.30.0/24`, which the firewall does not route and on which nothing has a default route at all ([ADR-0014](adr/0014-put-ifrit-on-imaginationlan-and-give-the-targets-no-route.md), [ADR-0017](adr/0017-buy-ifrit-for-iops-and-keep-the-range-disposable.md)) |
| Someone on Winterfell or Hicks logging in to `trinity` | **Open until the runbook's `sshd` step is applied; 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, and that is still the host's state: the step was written on 2026-11-20 and has not been applied. Until it is, a guessed password is root. `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 closes once applied. 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 `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 |
Comment thread
Gerrrt marked this conversation as resolved.
Resolved
| 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 | 182 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 |
Expand Down