diff --git a/docs/changelog.md b/docs/changelog.md index 2a027510..97304fcb 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -19,6 +19,17 @@ docstring gives: it is a record, not a claim about now. ## 2026-11-16 +- **`odin`'s sshd is written down as keys only.** The 2026-11-13 audit of + `odin` found `sshd` offering passwords, and `sshd -T` with sudo on + 2026-11-15 read `passwordauthentication yes` and `x11forwarding yes`. + Both are what the installer's OpenSSH ships, and nothing in this + repository said otherwise for `odin`. `build-the-soc-guest.md` §2 now + writes `10-homelab.conf`, as `alexander`'s §2 does, with password, + keyboard-interactive and root logins off and X11 forwarding off. §10 checks + it, and `security.md` has a row for it. Every SSH login to `odin` in its + journal since the build was by key. This records the change, not the + deploy: the step has not run on `odin`. + - **`eden`'s first collection, and how it was really done.** The rebuilt guest held an empty graph (1 node, 0 edges) until a SharpHound run was ingested on 2026-11-16: 370 nodes and 3,914 edges — 48 users, 73 groups, diff --git a/docs/runbooks/build-the-soc-guest.md b/docs/runbooks/build-the-soc-guest.md index 901b57a1..9c66e36f 100644 --- a/docs/runbooks/build-the-soc-guest.md +++ b/docs/runbooks/build-the-soc-guest.md @@ -131,6 +131,49 @@ the 96 GB disk untouched in the installer. It becomes the data disk next, outside LVM, so it can be read on any machine without reassembling a volume group. +### SSH: keys only + +`alexander`'s §2 makes its `sshd` key-only, and this guest needs the same +step for the same reasons. It is installed by hand from the ISO, so it does not +inherit the template's `allow-pw: false`. Its `sshd` answers all of VLAN 30, +where the weak domain lives and ARP spoofing is expected. And it holds the SOC +certificate authority's key and its own age key (§5, §6). OpenSSH takes +passwords unless told otherwise, and the installer also writes +`/etc/ssh/sshd_config.d/50-cloud-init.conf`. The drop-in below sorts before +that file, and `sshd` keeps the first value it reads, so the drop-in wins over +whatever cloud-init wrote. + +Log in from Hicks with your key and keep that session open, so a mistake +cannot lock you out. Then: + +```bash +sudo tee /etc/ssh/sshd_config.d/10-homelab.conf > /dev/null <<'EOF' +# Keys only (build-the-soc-guest.md §2). Read before sshd_config's own lines +# and before cloud-init's 50-cloud-init.conf, and sshd keeps the first value +# it reads, so these win. +PasswordAuthentication no +KbdInteractiveAuthentication no +PermitRootLogin no +X11Forwarding no +EOF +sudo sshd -t && sudo systemctl reload ssh +``` + +Then, from Hicks, in a new terminal, prove both halves. `ControlPath=none` +makes each probe open a fresh connection instead of reusing the session you +kept open: + +```bash +ssh -o ControlPath=none -o PubkeyAuthentication=no -o PreferredAuthentications=password barnabas@10.0.30.60 true +``` + +```bash +ssh -o ControlPath=none -o PreferredAuthentications=publickey -o PasswordAuthentication=no barnabas@10.0.30.60 true +``` + +The first must fail with `Permission denied (publickey)`, and the second must +succeed. + ### The data disk The indexer's data and Velociraptor's datastore live here @@ -599,6 +642,15 @@ Its verification mode is `full`, so a certificate issued for a name other than `wazuh.indexer` fails exactly here. The node-wide number above stays healthy through it. +**And that `sshd` still refuses passwords** (§2). The drop-in outranks any +later edit of `sshd_config` or cloud-init's file, but only while it exists: + +```bash +sudo sshd -T | grep -E '^(passwordauthentication|kbdinteractiveauthentication|permitrootlogin|x11forwarding) ' +``` + +All four must read `no`. + ## 11. Agents, by GPO — the second evening, and after #414 > [!NOTE] diff --git a/docs/security.md b/docs/security.md index fa84dd7d..dc5ebee8 100644 --- a/docs/security.md +++ b/docs/security.md @@ -20,6 +20,7 @@ What this network is actually built to survive: | Someone on the lab segment reaching the domain's configuration path | **Scoped, key-only, and accepted for `phoenix` itself.** Each of ADR-0029's six listens on `22` for `ansible/` ([ADR-0077](adr/0077-configure-the-lab-domain-with-ansible-from-phoenix.md)). The rule admits `10.0.30.70` alone, `sshd` refuses passwords, and the only administrators' key is `phoenix`'s, installed by the template and never by hand on a clone. The residual: whoever owns `phoenix` owns the lab domain. That was already true through its Proxmox token, so it adds reach to nothing. Host keys are not pinned, because every rebuild replaces them. `phoenix`'s own way in is narrowed to match by [ADR-0117](adr/0117-give-phoenix-a-key-only-sshd-and-a-default-deny-inbound-policy.md): its `sshd` takes keys only, and its `ufw` admits `22` from Hicks and the tunnel's peers and nothing from the rest of VLAN 30. Until [#1496](https://github.com/Gerrrt/HomeLab/issues/1496) applies it on the host, the installer's password login and an open segment are what stand there | | Someone on the lab segment logging in to the sensor | **Authored, and live only once applied.** `fenrir` listens on `22` to the whole segment and has no host firewall. [`build-the-sensor-guest.md`](runbooks/build-the-sensor-guest.md) §3 makes `sshd` key-only for one user, refuses root and X11 forwarding, and keeps `authorized_keys` to the machines that administer the guest. Until that step has run on `fenrir`, the installer's `sshd` defaults are the running state. The source address stays open: anyone on the segment can still offer a key | | Someone on the lab segment logging in to `alexander` | **Closed at `sshd`.** `alexander` holds the lab's only age key, and its `sshd` answers all of VLAN 30 with no host firewall. It is installed by hand from the ISO, so it does not inherit the template's `allow-pw: false`. [`build-the-lab-guest.md`](runbooks/build-the-lab-guest.md) §2 makes `sshd` key-only through a drop-in, refuses root and X11 forwarding, and keeps `garnet`'s `authorized_keys` to Hicks's key and `phoenix`'s; §7 checks it with `sshd -T`. A read on 2026-11-15 found it taking passwords; the step was applied the same day, and `sshd -T` read `no` for all four settings. The source address stays open: anyone on the segment can still offer a key | +| Someone on the lab segment logging in to `odin` | **Authored, and live only once applied.** `odin` holds the SOC's certificate authority key and its own age key, and its `sshd` answers all of VLAN 30 with no host firewall. It is installed by hand from the ISO, so OpenSSH's default of taking passwords stands. [`build-the-soc-guest.md`](runbooks/build-the-soc-guest.md) §2 makes `sshd` key-only through a drop-in that outranks cloud-init's, and refuses root and X11 forwarding; §10 checks it with `sshd -T`. A read on 2026-11-15 found it taking passwords and X11 forwarding. Every login since the build has used a key, so the step locks no one out. Until the step has run on `odin`, the installer's defaults are the running state. The source address stays open: anyone on the segment can still offer a key | | Someone on the lab segment reading the domain's metrics | **Scoped, unauthenticated, and accepted.** `windows_exporter` listens on `9182` on all six of ADR-0029's guests, on the segment that exists to hold attackers. Each guest's Windows Firewall admits `10.0.30.40` (`alexander`) alone ([`build-the-lab-domain.md`](runbooks/build-the-lab-domain.md) §7). That rule is the difference between an endpoint a `/24` sweep finds and one you have to go looking for, and it is a residual, not a control: the exporter has no authentication, so whoever owns `alexander` reads every gauge. It has no write API, so what leaks is the shape of the host (services, disks, uptime, the licence clock), the same class as `node_exporter` on the NAS below | | Someone on the lab segment fetching a Velociraptor client package | **Scoped by address, and accepted.** `odin`'s `caddy` service (container `soc-agent-msi`) serves the two agent MSIs `ansible/` installs, and the two Debian packages `garuda` installs, on `8448` ([#1068](https://github.com/Gerrrt/HomeLab/issues/1068), [ADR-0092](adr/0092-enrol-garuda-in-odins-soc-with-debian-packages-staged-on-odin.md)). Its Caddyfile answers the six domain addresses, `.50`–`.55`, and `garuda`'s `.62`, and refuses everyone else, Hicks's route from VLAN 50 included. The Velociraptor MSI and the Velociraptor `.deb` each carry the client config: the server URL, its CA, and the enrolment nonce. Whoever holds either can enrol a rogue client, which is why #864 took the MSI out of SYSVOL. The residual: an address on this segment can be spoofed, and any of the seven can fetch either package. What the nonce buys is noise in Velociraptor's client list, the same class as the Wazuh enrolment password. Rotating it means a new server config, a rebuilt MSI with the role's pin moved, and the staged `.deb` deleted so that `scripts/stage-agent-msis.sh` builds it again. The two Wazuh packages carry no secret | | An OpenVAS plugin on `garuda` reaching a non-target | **Fenced at layer 2** ([ADR-0093](adr/0093-run-openvas-on-garuda-on-demand-scoped-to-the-domain-by-nftables.md)). OpenVAS scans the domain's six only. While a scan runs, the scanner runs in a network namespace whose one route to the segment is a macvlan, `scan0` at `10.0.30.63`, behind an nftables `netdev` egress hook that drops every frame — IP, ARP (`send_arp_request`) and raw (`send_frame`) — to anything but the six. So the AF_PACKET paths that bypass an IP filter are caught here. Proved: a GVM scan of an out-of-scope host raised the egress drop counter with 0 open ports, and an `arping` from the namespace to an out-of-scope host was dropped while an in-scope host answered. `gvmd`, `notus`, `redis` and `mosquitto` stay on the host; only MQTT crosses to the namespace, on a veth that routes nowhere else |