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 @@ -101,7 +101,7 @@ documents for different readers.
can't run an agent (firewall, switch, UPS, iLO). One agent config, deployed
identically everywhere. [How](docs/architecture.md#observability-data-flow)
- **Dashboards and alerting as code.** 8 provisioned dashboards, 156 panels, and
192 alert rules — 166 metric-based in Prometheus, 26 log-based in Loki — sharing
199 alert rules — 173 metric-based in Prometheus, 26 log-based in Loki — sharing
one Alertmanager routing tree. No dashboard exists only in a database.
- **Secrets encrypted in-repo with SOPS + age.** Per-device credentials,
decrypted at deploy time into gitignored paths, with `git log` showing which
Expand Down Expand Up @@ -207,7 +207,7 @@ inbound passes may still reach it. Data flow and the maintained Mermaid topology
.
├── stacks/
│ ├── observability/ # the estate's stack on prometheus — ten services
│ │ ├── prometheus/ # config, file_sd targets, 166 alert rules
│ │ ├── prometheus/ # config, file_sd targets, 173 alert rules
│ │ ├── alertmanager/ # routing and inhibition
│ │ ├── loki/ # single-binary config + 26 LogQL rules
│ │ ├── alloy/ # the agent config directory, shipped to every host
Expand Down
26 changes: 25 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,31 @@ docstring gives: it is a record, not a claim about now.
blacklisted with its two buses. After that, no unit had failed, no target
was down, and the USB NIC stayed up. `restore-the-stack.md` gains *Trim what
the laptop does not use*, so a rebuild does the same.

- **The range monitoring of ADR-0126 is built in the repository, not yet
deployed ([#1651](https://github.com/Gerrrt/HomeLab/issues/1651)).** A new
collector, `scripts/collect-range-state.sh`, reads `gandalf`'s own controls
— the `vmbr1_host_in` ingress barrier, `vmbr0` and `sshd` forwarding, and the
`ragnarok` stop timer with the deadline it set. The deadline comes from one
place: `ragnarok-stop.sh` gains a `deadline-epoch` subcommand so the monitor
reads the timer's own effective deadline rather than a second copy of its
logic. `stacks/observability/prometheus/rules/range.rules.yaml` adds seven
alerts — `PveFirewallZeroRules` (the firewall on with no host rules, which
the collector measured but nothing read), the ingress barrier down,
`vmbr0`/`sshd` forwarding on, the stop timer failing
(`RagnarokStopTimerInactive`, `RagnarokPastDeadline`, which excludes a dpkg
wait so a protected install is not mistaken for a failed timer), and
`RangeStateStale` for the collector itself stopping — each with a firing and
a quiet promtool test. Host uptime is deliberately not alerted: an always-on
host has no "up too long" fault. `install-agent-collectors.sh` gains the
`range-state` row and `systemd/agent/` its unit pair, and
`build-the-playground.md` §7 gains the install steps, host-only (no
`guest-disk-state`, which reads inside a guest) and upgrading the stop helper
first.
- Still to deploy, needing the lab and the firewall: the `morpheus` pass
(`10.0.30.30 → 10.0.99.20:9090`, metrics only), a **metrics-only** Alloy
config and deploy check so the range host ships no logs, and installing
the collectors on `gandalf` plus a converge. The runbook marks these *not
yet deployed*.
- **The range host will be monitored now that it stays on
([ADR-0126](adr/0126-monitor-gandalf-now-that-it-stays-on.md),
[#1651](https://github.com/Gerrrt/HomeLab/issues/1651)).** ADR-0125 made
Expand Down
9 changes: 5 additions & 4 deletions docs/observability.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ separates a quiet stream from a stopped one.

## Alerting

192 rules in total: 166 metric-based in `prometheus/rules/`, and 26 log-based in
199 rules in total: 173 metric-based in `prometheus/rules/`, and 26 log-based in
`loki/rules/`.

### Log-based (Loki ruler)
Expand Down Expand Up @@ -540,7 +540,7 @@ argument and for what to do when it exits 1.

### Metric-based (Prometheus)

166 rules across twelve files in `prometheus/rules/`:
173 rules across 13 files in `prometheus/rules/`:

| File | Covers |
| --- | --- |
Expand All @@ -555,6 +555,7 @@ argument and for what to do when it exits 1.
| `backup.rules.yaml` | Whether the scheduled maintenance jobs are still being run at all — staleness, failure, never-ran, and the page: `ScheduledJobStaleCritical` at three of a job's own periods and never under a day, because the warning reaches only the in-house channel and a backup that stopped in week one was otherwise a notification repeating on the same network for as long as nobody acted (2026-10-14) — whether the CA key's offline copy has been proved lately ([#496](https://github.com/Gerrrt/HomeLab/issues/496)), and whether the newest backup sets have been carried onto the second recipient's medium within ninety days ([ADR-0048](adr/0048-carry-the-estates-backup-sets-with-the-second-recipient.md)) |
| `deploy.rules.yaml` | Whether each host that pulls — `prometheus` and `trinity` ([#533](https://github.com/Gerrrt/HomeLab/issues/533)) — is running what the repository says: an uncommitted edit made on the host, a revision that did not verify, and how far behind `main` it is, and a host whose record stopped arriving. Reads the record `scripts/converge.sh` writes hourly ([#99](https://github.com/Gerrrt/HomeLab/issues/99), [ADR-0021](adr/0021-converge-on-a-timer-instead-of-deploying-over-ssh.md)). Also whether convergence had to start a stack service that something stopped — `DeployServiceRevived` — and whether one has been left stopped for two hours, held or under a backup — `DeployServicesStopped` ([ADR-0087](adr/0087-start-a-stopped-stack-service-from-the-converge-timer.md)) |
| `internet.rules.yaml` | Why the internet is slow ([#914](https://github.com/Gerrrt/HomeLab/issues/914)): three scheduled speed tests in a row under 400 Mbit/s down or 100 up, the WAN held above 85% of what it can carry, frames arriving corrupted on the WAN port — `WanReceiveErrors`, the fault found the day these were written, when a cable between the XB7 and `morpheus` cut downloads to ~2 Mbit/s — and `speedtest-tracker` itself going quiet or unreachable. Also records `homelab_wan_bits_per_second` from pf's own em0 counters. Download thresholds are against the ~940 Mbit/s the 1000baseT WAN port can carry, not the plan's 2000. `speedtest-tracker` is left out of `InstanceDown`, so its outage is a warning and not a page |
| `range.rules.yaml` | The range host `gandalf`'s own controls, now that it stays on ([ADR-0126](adr/0126-monitor-gandalf-now-that-it-stays-on.md), [#1651](https://github.com/Gerrrt/HomeLab/issues/1651)): the `vmbr1_host_in` ingress barrier, `vmbr0` forwarding and `sshd` forwarding being off (`build-the-playground.md` §2, §4), and the attack-VM stop timer (ADR-0125) — read by `scripts/collect-range-state.sh`. `PveFirewallZeroRules` is here too: the firewall collector exports the rule count but no other rule reads it |
| `ids.rules.yaml` | Whether Suricata is running on each interface it is declared for, read from the firewall's process table over SNMP — the fast, per-interface half; `SuricataLogsStopped` in `loki/rules/security.rules.yaml` is the slow, aggregate half ([#90](https://github.com/Gerrrt/HomeLab/issues/90), [#441](https://github.com/Gerrrt/HomeLab/issues/441)) |

**Every critical alert links to a runbook** ([#842](https://github.com/Gerrrt/HomeLab/issues/842)).
Expand All @@ -576,8 +577,8 @@ as loaded and healthy and could not fire for any input ([#63](https://github.com
`prometheus/tests/*.test.yaml` holds `promtool test rules` unit tests, which
feed a rule synthetic series and assert it fires — paired with a case asserting
it stays quiet, because a test that only ever expects silence would have passed
against the broken rule too. Coverage is 166 rules of 166 so far ([#843](https://github.com/Gerrrt/HomeLab/issues/843)) — all twelve
in `blackbox.rules.yaml`, all three in `dns.rules.yaml`, `GatewayFilesystemCritical`, `ContainerHighMemory`,
against the broken rule too. Coverage is 173 rules of 173 so far ([#843](https://github.com/Gerrrt/HomeLab/issues/843)) — all twelve
in `blackbox.rules.yaml`, all three in `dns.rules.yaml`, all seven in `range.rules.yaml`, `GatewayFilesystemCritical`, `ContainerHighMemory`,
`ContainerNearMemoryLimit`, `ContainerRestartLoop`, `ContainerCpuThrottled`,
the three container-state rules from
[#838](https://github.com/Gerrrt/HomeLab/issues/838) and
Expand Down
64 changes: 64 additions & 0 deletions docs/runbooks/build-the-playground.md
Original file line number Diff line number Diff line change
Expand Up @@ -1424,6 +1424,70 @@ should say it is not running, and `range-extend 2` should refuse.
> `logger` under systemd, and was reinstalled. The installed files match the
> repository by `sha256sum`.

### Monitoring the host

`gandalf` stays on, so the per-session read-back above is a gap of days.
[ADR-0126](../adr/0126-monitor-gandalf-now-that-it-stays-on.md) gives it the
same Alloy agent `Saruman` has, reporting *hypervisor state* — the ADR-0028
class, not guest telemetry — to `prometheus`, with alerts for the faults this
section used to catch by hand. **Not yet deployed on `gandalf`.**

**First, the pass.** The agent pushes metrics to `10.0.99.20:9090`. On
`morpheus`, add a host-scoped pass `10.0.30.30 → 10.0.99.20` on `9090`,
**metrics only** — beside the two that already carry ImaginationLAN there, and
above the block to Winterfell. No `3100`: the range host does not ship logs
(below). This is the one crossing ADR-0014 counts, and it is outbound.

**Upgrade the stop helper first.** `collect-range-state.sh` reads the deadline
from `homelab-ragnarok-stop deadline-epoch`, a subcommand added for the
monitor. An older helper without it makes the collector leave the `ragnarok`
metrics out rather than read a false "stopped", so reinstall the current script
(*The attack VM's timer* above does the same) before the collector:

```bash
scp scripts/ragnarok-stop.sh root@10.0.30.30:/usr/local/sbin/homelab-ragnarok-stop
ssh root@10.0.30.30 'chmod 0755 /usr/local/sbin/homelab-ragnarok-stop && homelab-ragnarok-stop deadline-epoch'
```

**Then the collectors**, host-only. From a Hicks workstation, install each by
name with [`install-agent-collectors.sh`](../../scripts/install-agent-collectors.sh),
which runs it once per collector:

```bash
for c in pve-firewall-state range-state guest-state smart-state patch-state pve-version; do
scripts/install-agent-collectors.sh --only "$c" root@10.0.30.30
done
```

**Not** `guest-disk-state` or `guest-service-state`: both read *inside* a guest
through its agent (`qm guest cmd … get-fsinfo`), which on the range would read
a target's filesystem — guest telemetry from the attacker's segment, which
ADR-0126 does not allow. `range-state` is `gandalf`'s own control file
([`collect-range-state.sh`](../../scripts/collect-range-state.sh)): the
`vmbr1_host_in` ingress barrier, `vmbr0` and `sshd` forwarding, and the
`ragnarok` stop timer and the deadline it set.

**Then the agent, metrics only.** `gandalf`'s journal and auth logs can carry
what happens on the attacker's segment, so its agent must not ship them to
Loki. The estate's standard `config.alloy` pushes both metrics and logs, so a
metrics-only variant (no `loki.*`, no `3100`) and a deploy check that requires
only metrics are what [`deploy-agent.sh`](../../scripts/deploy-agent.sh) needs
for this host — **still to build (#1651)**; until it exists, do not deploy the
standard agent here, which would ship the range's logs.

**What it watches.** Once the collectors report, `gandalf` joins the
`PveFirewall*` alerts in `host.rules.yaml`, and
[`range.rules.yaml`](../../stacks/observability/prometheus/rules/range.rules.yaml)
adds: the firewall enabled with zero host rules (`PveFirewallZeroRules`), the
ingress barrier down, `vmbr0` or `sshd` forwarding on, and the stop timer
failing — `ragnarok` running with the timer inactive, or past the deadline the
timer itself set (a dpkg wait inside the VM is excluded, so a protected install
is not mistaken for a failed timer). `RangeStateStale` catches the collector
itself stopping, so a barrier that falls after it goes quiet is not read as
healthy. `DisposableGuestOutlived` also begins covering any
`disposable`-tagged guest here. Host uptime is deliberately not alerted: an
always-on host has no "up too long" fault (ADR-0126).

---

## 8. Check the four properties
Expand Down
2 changes: 1 addition & 1 deletion docs/runbooks/deploy-stack.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Then in the UI:
1. **Prometheus → Status → Targets.** Every job `UP`. The four `snmp` targets
take up to 45 seconds on their first scrape.
2. **Prometheus → Status → Rules.** Every rule loaded, none in error. The
page lists 172: the 166 alert rules this repository counts everywhere
page lists 179: the 173 alert rules this repository counts everywhere
else, plus the six recording rules:
`homelab_suricata_expected_interface`,
`homelab_battery_runtime_seconds`, and the two directions each of
Expand Down
2 changes: 1 addition & 1 deletion docs/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ What this network is actually built to survive:
| 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 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 | 192 alert rules, 30 days of metrics and logs |
| Losing visibility of a failure | 199 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 |
| Mains power loss | **The rack, yes; the monitoring path, yes — on two laptop cells that were measured for the first time on 2026-09-12.** A pack fitted to `mjolnir` on 2026-08-28 passed its self-test; the TP-Link carrying `prometheus` and `oracle` has been on UPS power since 2026-09-08 ([#110](https://github.com/Gerrrt/HomeLab/issues/110)); the laptops ride a cut out on their own batteries, which `HostBatteryHealthLow` in `host.rules.yaml` now reads — `prometheus`'s cell was replaced on 2026-09-18 and reads 101 % of design, `oracle`'s was replaced on 2026-09-29 and reads 100 %, its design figure rather than a learned one ([#531](https://github.com/Gerrrt/HomeLab/issues/531)) — and **each runtime was measured once: `prometheus`'s on 2026-09-19, about 2.5 hours from full at the stack's load, and `oracle`'s on 2026-09-29, about 5.2 hours**; since the same day the projection is recorded on every cut and pages under thirty minutes (`HostBatteryRuntimeLow`, [#532](https://github.com/Gerrrt/HomeLab/issues/532)), but neither pack reports a moving cell temperature, so this row is answered for both hosts' runtime and for neither's cell temperature — see below. **What happens when the cut outlasts the pack is configured and accepted without a live test.** Since 2026-09-23 the firewall's NUT server reads `mjolnir`, and `Saruman` and `smaug` subscribe to it on their own gateway addresses, so a real cut would now try to run the sequence [ADR-0049](adr/0049-shut-down-on-the-ups-from-a-nut-server-on-the-firewall.md) decides: `Saruman` and `smaug` halt first and `morpheus` last. Since the move into the 32U rack on 2026-11-06 the PDU also carries `trinity`, `gandalf` (off until its build) and the console, with `smaug` racked and on the PDU directly rather than by its old long cord to the media room. [ADR-0107](adr/0107-subscribe-trinity-to-the-ups-and-bound-saruman-s-guest-stop.md) makes `trinity` a third subscriber and bounds `Saruman`'s guest stop. `Saruman`'s half was applied on 2026-11-13 (`down=90` on the four ordered guests, and its monitor stays logged in until they are down); `trinity`'s subscription, `HOSTSYNC 600` on `morpheus` and the card's 16-minute threshold followed on 2026-11-20, so all three subscribers would now halt before the pack empties; `gandalf`, the console and `neo` are left to the pack by decision. The pack itself is unmeasured: about 47 minutes at 21 % load is the card's own estimate. Neither the forced-shutdown proof nor a mains pull will be run ([ADR-0121](adr/0121-accept-the-ups-shutdown-without-a-live-test.md)) |
| The estate being down while the person who runs it is unavailable | **Documentation, yes; data, no copy outside the house, by decision.** ADR-0011 puts the emergency tier on paper; [ADR-0023](adr/0023-keep-the-household-recovery-path-outside-the-estate.md) extends the same reasoning to the sensitive tier's data. That tier has held real photographs since 2026-09-28. [ADR-0122](adr/0122-drop-the-household-copy.md) dropped their copy outside the estate, so a loss of the house loses them — see below |
Expand Down
Loading
Loading