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.** 124 ADRs covering what was chosen
- **Documented decisions and runbooks.** 125 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/ # 124 ADRs — architecture decision records
│ ├── adr/ # 125 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
11 changes: 11 additions & 0 deletions docs/adr/0017-buy-ifrit-for-iops-and-keep-the-range-disposable.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

**Status:** Accepted · 2026-09

> [!NOTE]
> **The host stays on; the attack VM is what stops.**
> [ADR-0125](0125-keep-gandalf-on-and-stop-ragnarok-on-a-timer.md), which
> supersedes ADR-0124, keeps `gandalf` on and stops `ragnarok` at a deadline:
> six hours after it starts, or what a session's last extension set, up to
> twelve hours ahead. "Off between sessions" no longer holds for the host,
> so *No monitoring*'s reason is gone. Monitoring is
> [#1651](https://github.com/Gerrrt/HomeLab/issues/1651), which needs its own
> ADR to supersede *No monitoring*. The note below about ADR-0124 is
> superseded with it. The text below is left as written, per ADR-0001.
>
> [!NOTE]
> **"Off between sessions" is enforced by a timer.** Two audits found the
> range host left on for days, against the discipline that *No monitoring*
Expand Down
11 changes: 9 additions & 2 deletions docs/adr/0124-power-gandalf-off-on-a-timer.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# ADR-0124: Power `gandalf` off on a timer

**Status:** Accepted · 2026-11 · amends
[ADR-0017](0017-buy-ifrit-for-iops-and-keep-the-range-disposable.md)
**Status:** Superseded · 2026-11 · by
[ADR-0125](0125-keep-gandalf-on-and-stop-ragnarok-on-a-timer.md) · accepted 2026-11

> [!NOTE]
> Wholly superseded: [ADR-0125](0125-keep-gandalf-on-and-stop-ragnarok-on-a-timer.md)
> keeps `gandalf` on and puts the timer on the attack VM, `ragnarok`, instead
> of the host. The host power-off timer described here was installed on
> 2026-11-22, never proved, and removed the same day. The text here is left
> as written, per ADR-0001 and ADR-0115.

## Context

Expand Down
97 changes: 97 additions & 0 deletions docs/adr/0125-keep-gandalf-on-and-stop-ragnarok-on-a-timer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# ADR-0125: Keep `gandalf` on, and stop `ragnarok` on a timer

**Status:** Accepted · 2026-11 · supersedes
[ADR-0124](0124-power-gandalf-off-on-a-timer.md) and amends
[ADR-0017](0017-buy-ifrit-for-iops-and-keep-the-range-disposable.md)

## Context

[ADR-0124](0124-power-gandalf-off-on-a-timer.md) answered two audits that
found `gandalf` left on for days. It had the host power itself off six hours
after boot, or at the deadline a session's last `range-extend` set. It was
installed on 2026-11-22 and never proved.

Living with it the same day showed that the host is the wrong thing to turn
off:

- **Starting a session means walking to the rack.** `gandalf`'s BIOS
powers on only at the button (`build-the-playground.md` §1), and its AMT is
disabled ([ADR-0106](0106-name-the-range-host-gandalf-and-leave-ifrit-to-its-disabled-amt.md)).
A host that turns itself off makes every session start at the rack.
- **The exposure is the attack VM, not the host.** ADR-0124's own Context
names what the left-on host cost. `ragnarok` shares VLAN 30 with the estate
(ADR-0014), and the host firewall goes unchecked while the box is up. The
targets are on `vmbr1`, which has no port, and since 2026-11-22 the host
drops everything `vmbr1` passes up to it (§2, `vmbr1_host_in`). A target
left running reaches only the other guests on that bridge.
- **The host's own hardening no longer depends on being off.** After the
2026-11-22 audit, `gandalf` has keys-only SSH with no forwarding, no
workstation tooling, no forwarding on `vmbr0`, and the ingress table.
Those hold whether it is up for an hour or a month.

What a host left on still lacks is anything watching it. ADR-0017 gave it no
monitoring because it was off by design: every rule watching it would be
"permanently firing or permanently silenced". A host that stays on has a
normal state, up, and a rule shape for it.

## Decision

**`gandalf` stays on. The attack VM, `ragnarok` (VMID 130), stops itself a
fixed time after it starts, or after the last extension a session asks
for.** The mechanism is ADR-0124's, aimed at the VM.

- **The deadline is six hours after `ragnarok` starts.** It is counted from
the QEMU process's start, not the host's boot.
- **A session can replace it.** `range-extend H` on the host sets the
deadline H hours from now, H from 1 to 12, as before. The extension is
stored with the running VM's process ID, so a stop and a start always
begin again from six hours, and it is cleared when the VM stops.
- **It warns before it acts.** `wall` at 30 and 5 minutes, on the host and,
through the guest agent, inside `ragnarok`, where the session is.
- **It never stops the VM in the middle of a package install.** Past the
deadline it asks the guest agent whether `dpkg`'s lock is held inside the
VM, and waits for the next run if it is. An agent that does not answer
counts as not busy, so a hung agent cannot hold the VM up.
- **The stop is `qm shutdown` with a forced stop after three minutes.**
- **A systemd timer runs the check every minute, under one lock**, as in
ADR-0124. The script is `scripts/ragnarok-stop.sh` and its units are in
`systemd/range/`. §7 installs them in place of ADR-0124's, and its
read-back checks the timer is enabled and active.
- **The targets are not on the timer.** They have no route off `vmbr1`. They
are reverted to `clean` at the start of each session, as before.
- **Monitoring the host is needed, and is its own decision.** It is
[#1651](https://github.com/Gerrrt/HomeLab/issues/1651). It crosses the
boundary ADR-0014 counts, so it needs its own ADR, which would supersede
ADR-0017's "no monitoring". Until it lands, §7's read-back is the check.

Built under [#1647](https://github.com/Gerrrt/HomeLab/issues/1647).

## Consequences

- **A forgotten session ends the attack VM, not the range.** `ragnarok`'s
time on VLAN 30 is bounded by its deadline, about a minute late, plus any
`dpkg` wait inside the VM. The host and any running targets stay up.
- **The host firewall goes unchecked between sessions, for as long as the
host is up.** ADR-0124 bounded that window at six to twelve hours. This
decision leaves it unbounded until #1651 lands. The ingress table and
keys-only SSH sit behind the firewall, and nothing on VLAN 30 but
`ragnarok`, Hicks and the estate can reach the host, but nothing reports
if the firewall goes off. That is the cost this decision accepts, and the
reason #1651 is not optional.
- **Proxmox's updates are no longer applied at each power-on.** §7 applied
them when a session started, and the box was off between sessions.
`unattended-upgrades` covers Debian's packages daily now that the box is up.
Proxmox's own still need `apt full-upgrade` by hand, and #1651 is where
pending ones become visible.
- **The range SSD runs every hour now.** On 2026-11-22 it read 49,443
power-on hours and 8 reallocated sectors. Always on, it ages about 730
hours a month. The range is disposable (ADR-0017), so its failure costs a
rebuild, not data. #1651 should watch its SMART counters.
- **After a power cut it stays off.** The BIOS setting stays at *Power Off*.
Changing it to *Power On* is a visit to the box, and with nothing yet
watching `gandalf`, a host that comes back by itself is one nobody knows
is up. It is reopened with #1651.
- **`range-extend` now needs `ragnarok` running.** It refuses while the VM is
stopped, because there is no run to attach the deadline to.
- **This decision is reopened** if the targets start needing a bound of their
own, which would mean something on `vmbr1` can reach past it.
2 changes: 1 addition & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ hole from the monitoring VLAN into the monitored one.
| --- | --- | --- | --- |
| `prometheus` (10.0.99.20) | 🔴 99 | [`stacks/observability`](../stacks/observability) | Prometheus, Alertmanager, Loki, Grafana, snmp-exporter, blackbox-exporter, speedtest-tracker, docker-socket-proxy, Alloy, and Caddy as `ingest-proxy` in front of Prometheus and Loki ([#182](https://github.com/Gerrrt/HomeLab/issues/182)) |
| `Saruman` (10.0.30.20) | 🟢 30 | *(none — and none intended)* | Proxmox VE 9, hosting twenty-one guests: `alexander`, built 2026-09-05 ([#262](https://github.com/Gerrrt/HomeLab/issues/262)); `phoenix`, built 2026-09-20 ([#436](https://github.com/Gerrrt/HomeLab/issues/436)); `odin`, built 2026-09-27 for the security tooling (ADR-0030); `fenrir`, built 2026-09-30 as the Zeek sensor ([#437](https://github.com/Gerrrt/HomeLab/issues/437)); `golem`, built 2026-10-03 as the backup server ([#485](https://github.com/Gerrrt/HomeLab/issues/485)); `eden`, built 2026-10-07 as the BloodHound guest ([#451](https://github.com/Gerrrt/HomeLab/issues/451)), off between sessions; `garuda`, built 2026-10-10 as the analyst workstation ([#921](https://github.com/Gerrrt/HomeLab/issues/921)); and ADR-0029's six-machine domain, built by hand 2026-09-24 to 2026-09-25 ([#414](https://github.com/Gerrrt/HomeLab/issues/414)), of which `carbuncle` and `siren` run per session; and all eight of [ADR-0090](adr/0090-test-the-dotfiles-os-layers-on-on-demand-saruman-guests.md)'s on-demand dotfiles test VMs, `dot-debian`, `dot-fedora` and `dot-windows`, built 2026-10-08, and `dot-opensuse`, `dot-arch`, `dot-alpine`, `dot-gentoo` and `dot-nixos`, built 2026-10-09 ([#920](https://github.com/Gerrrt/HomeLab/issues/920)). Alloy agent (native package). It runs no compose stack by decision, not by omission: Docker would rewrite the iptables its own firewall relies on ([ADR-0014](adr/0014-put-ifrit-on-imaginationlan-and-give-the-targets-no-route.md)), which is why the agent here is the native package and why `stacks/lab` runs in a guest |
| `gandalf` (10.0.30.30) | 🟢 30 | *(none — and none intended)* | Proxmox VE 9, the range host, installed 2026-11-07 ([#421](https://github.com/Gerrrt/HomeLab/issues/421)). The attack VM `ragnarok` (VMID 130), declared in [`tofu/`](../tofu/README.md) on `gandalf`'s aliased provider and finished by [`scripts/finish-attack-vm.sh`](../scripts/finish-attack-vm.sh) ([ADR-0116](adr/0116-build-the-range-attack-vm-with-opentofu-and-prove-it-with-a-script.md)), from template 902 and dual-homed: a DHCP lease on VLAN 30, and `172.30.30.10` on `vmbr1`. Three targets, VMIDs 100–102 on `vmbr1` only, made 2026-11-10; the list is [`build-the-playground.md`](runbooks/build-the-playground.md) §6's. Guest disks go on the ZFS pool `range`, targets go on the portless `vmbr1`, and it is off between sessions ([ADR-0017](adr/0017-buy-ifrit-for-iops-and-keep-the-range-disposable.md), [ADR-0106](adr/0106-name-the-range-host-gandalf-and-leave-ifrit-to-its-disabled-amt.md)) |
| `gandalf` (10.0.30.30) | 🟢 30 | *(none — and none intended)* | Proxmox VE 9, the range host, installed 2026-11-07 ([#421](https://github.com/Gerrrt/HomeLab/issues/421)). The attack VM `ragnarok` (VMID 130), declared in [`tofu/`](../tofu/README.md) on `gandalf`'s aliased provider and finished by [`scripts/finish-attack-vm.sh`](../scripts/finish-attack-vm.sh) ([ADR-0116](adr/0116-build-the-range-attack-vm-with-opentofu-and-prove-it-with-a-script.md)), from template 902 and dual-homed: a DHCP lease on VLAN 30, and `172.30.30.10` on `vmbr1`. Three targets, VMIDs 100–102 on `vmbr1` only, made 2026-11-10; the list is [`build-the-playground.md`](runbooks/build-the-playground.md) §6's. Guest disks go on the ZFS pool `range`, targets go on the portless `vmbr1`, and it stays on, while `ragnarok` stops itself six hours after it starts unless a session extends it ([ADR-0125](adr/0125-keep-gandalf-on-and-stop-ragnarok-on-a-timer.md); [ADR-0017](adr/0017-buy-ifrit-for-iops-and-keep-the-range-disposable.md), [ADR-0106](adr/0106-name-the-range-host-gandalf-and-leave-ifrit-to-its-disabled-amt.md)) |
| `alexander` (10.0.30.40) | 🟢 30 | [`stacks/lab`](../stacks/lab) | Prometheus, Loki, Grafana, Alloy and its Docker socket proxy, and Caddy as the ingest proxy in front of the first two ([#834](https://github.com/Gerrrt/HomeLab/issues/834)) — the lab's own observability, which never remote-writes to VLAN 99 ([ADR-0007](adr/0007-defensive-estate-and-offensive-range.md), [ADR-0020](adr/0020-run-the-lab-stack-in-a-guest-with-its-own-prometheus.md)). A guest on `Saruman`, not the hypervisor; Alloy agent (Docker) |
| `odin` (10.0.30.60) | 🟢 30 | [`stacks/soc`](../stacks/soc) | Wazuh (indexer, manager, dashboard), Velociraptor and Alloy: the security half of ADR-0007, placed by [ADR-0030](adr/0030-give-the-security-tooling-its-own-guest-and-its-own-stack.md) on a second guest on `Saruman` because `alexander`'s 8 GiB cannot hold both. Built 2026-09-27 by [`build-the-soc-guest.md`](runbooks/build-the-soc-guest.md), the stack authored and CI-validated ahead of the guest the way `stacks/lab` was ahead of `alexander` ([#266](https://github.com/Gerrrt/HomeLab/issues/266), [#267](https://github.com/Gerrrt/HomeLab/issues/267)); the six domain machines enrol as agents by GPO, which is the day those two issues close. Its Alloy pushes to `alexander`, never to VLAN 99, and the indexer's health is the one series that crosses into the lab's Prometheus. Alloy agent (Docker) |
| `fenrir` (10.0.30.90) | 🟢 30 | [`stacks/sensor`](../stacks/sensor) | Zeek on a `tc` mirror of `Saruman`'s lab bridge, so that the domain's east-west traffic, which crosses no router and so never reaches Suricata on `morpheus`, is observed at all ([#437](https://github.com/Gerrrt/HomeLab/issues/437), [ADR-0068](adr/0068-mirror-the-lab-bridge-to-zeek-with-tc-not-open-vswitch.md)). A guest on `Saruman`, VMID 190, with a second NIC alone on the port-less `vmbr1` that receives only the mirror's copies. Its logs go to `alexander`, never to VLAN 99; whether the mirror is delivering is answered on the hypervisor by `homelab_zeek_mirror_active`. Built 2026-09-30 by [`build-the-sensor-guest.md`](runbooks/build-the-sensor-guest.md), and proved by rebooting `Saruman` with the mirror's timer disabled: the gauge fell to 0 and `ZeekMirrorInactive` fired. Alloy agent (Docker) |
Expand Down
62 changes: 62 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,68 @@ docstring gives: it is a record, not a claim about now.

## 2026-11-22

- **`gandalf` stays on, and the attack VM stops on a timer instead
([ADR-0125](adr/0125-keep-gandalf-on-and-stop-ragnarok-on-a-timer.md),
[#1647](https://github.com/Gerrrt/HomeLab/issues/1647)).** ADR-0125
supersedes ADR-0124 the day it was accepted. The host power-off timer was
installed at 17:44 and removed at 19:26, never having fired. The exposure
ADR-0124 bounded is `ragnarok` on VLAN 30, and a host that turns itself off
makes every session start at the rack. `scripts/range-poweroff.sh` becomes
`scripts/ragnarok-stop.sh`. The deadline is six hours after the VM starts,
and an extension is stored with the QEMU process's PID, so it never carries
into the next start. The warnings also go inside the VM through the guest
agent. The `dpkg` wait asks the agent about the VM's lock, and the stop is
`qm shutdown` with a forced stop after three minutes. `build-the-playground.md`
§7 now installs it and removes the old timer, and §1's *After Power Loss*
stays at *Power Off*, with ADR-0125's reason.
- The `--self-test` has 27 fixtures. Three deliberate breaks each failed
at least one: an extension that ignores the PID, a stopped VM that keeps
its extension, and a stop without the PID read again.
- Review on the PR caught three things:
- The check now reads the PID again just before `qm shutdown`, so a VM
restarted during the guest-agent calls is not stopped by the old run's
deadline.
- The default deadline comes from the QEMU process's start in
`/proc/<pid>/stat`, not `now` minus `ps -o etimes`. The old way could
move by a second between runs and repeat a warning.
- §7 now enables the timer last, after `status` and a chance to extend.
- Installed on `gandalf` at 19:26, and proved at 19:32 with a deadline
written a few minutes out. The timer sent the 5-minute warning, then shut
`ragnarok` down with ACPI in 2 seconds and cleared its state, and
`range-extend` refused afterwards. A `wall` reaching a shell inside the VM
was sent but not seen, because none was open. The run logged every line
twice, which ADR-0124's script also did, so `say` no longer calls
`logger` under systemd.
- Monitoring the host is [#1651](https://github.com/Gerrrt/HomeLab/issues/1651),
opened the same day. ADR-0017's reason for none, a host that is off by
design, no longer holds.
- This corrects the entry below on the timer being built: what it built is
replaced, not proved.
- **The 2026-11-22 audit's fixes are applied on `gandalf`
([#421](https://github.com/Gerrrt/HomeLab/issues/421)).** These are the
steps the audit entry below wrote into `build-the-playground.md`, each then
marked *Not yet applied*.
- **§2** at 19:19: `ip-forward off` and `ip6-forward off` on `vmbr0`, and
the `vmbr1_host_in` table. A reboot at 19:21 proved them: both forwarding
flags `0`, the table loaded, `vmbr1` without an address.
- **§4** at 19:19: the SSH drop-in with both forwardings off, checked with a
password login refused and a key login accepted. The first password test
"passed" through this workstation's shared SSH connection, which never
re-authenticates, so the runbook's tests now carry `-o ControlPath=none`.
- **§4, *Nothing else on `gandalf`*,** at 19:20: root's shell is bash, the
1Password and Charm repositories and 14 packages are gone, and so is the
dotfiles install. The runbook's `rm` missed about a third of it (atuin's
user unit, Go's and npm's caches, mise, tmux and zsh files), so a second
`rm` was added. About 5 GB came off the root disk.
- **§8 check four** at 19:25, from a throwaway clone of `tpl-kali` at `.199`:
no route, the host unreachable with the `dropped` counter rising, and
`ragnarok` still reaching the target. The clone had no DHCP stanza, which
proves #1341 on the template rebuilt that day.
- The audit's last finding, leftovers with no runbook step, is still open
for two of them: the `PhoenixIsoCleanup` role, revoked from the token but
never deleted, and an empty `local-lvm`. The Kali installer ISO the audit
also listed is not a leftover. `packer/kali.pkr.hcl` builds template 902
from it (`kali_iso_file`). `/root/.claude/remote` went with the dotfiles.
- **`gandalf`'s power-off timer is built, not installed
([#1647](https://github.com/Gerrrt/HomeLab/issues/1647)).** This builds
ADR-0124 in the repository. `scripts/range-poweroff.sh` holds the deadline
Expand Down
Binary file modified docs/diagrams/current/rack-32u.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading