Skip to content

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

Merged
Gerrrt merged 2 commits into
mainfrom
gerrrt/soc-agent-msi-1068-refs
Oct 8, 2026
Merged

Gerrrt merged 2 commits into
mainfrom
gerrrt/soc-agent-msi-1068-refs

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Replaces #1070, whose commit message carried a close keyword for #1068 ("No close keyword in prose" failed, rightly). Same tree, one commit, message corrected.

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.

Refs #1068: it closes once odin serves the MSIs and a fresh guest installs from it.

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

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

Configurable paths and ports can diverge between staging, Compose, and Ansible, and cleanup can leave unintended served files.

4 open findings
What changed in this PR

Adds an address-restricted MSI service on odin so fresh lab-domain guests can install pinned SOC agents.

Changes:

  • Adds hardened Caddy-based MSI hosting.
  • Adds verified MSI staging and Ansible URLs.
  • Documents deployment, security, and architecture impacts.
File Description
stacks/​soc/​README.md Documents the new service.
stacks/​soc/​compose.yaml Defines the hardened Caddy container.
stacks/​soc/​Caddyfile Restricts MSI access to six guests.
stacks/​soc/​.env.example Adds the published port setting.
scripts/​stage-agent-msis.sh Fetches, verifies, and stages MSIs.
scripts/​README.md Documents the staging script.
docs/​security.md Records the accepted security residual.
docs/​runbooks/​build-the-soc-guest.md Adds MSI staging instructions.
docs/​runbooks/​build-the-lab-domain.md Adds staged MSIs as a prerequisite.
docs/​changelog.md Records the change.
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 MSI-source documentation.
ansible/​inventory/​group_vars/​all.yaml Configures agent download URLs.

🧠 Review effort: Balanced


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

Comment thread scripts/stage-agent-msis.sh Resolved
Comment thread scripts/stage-agent-msis.sh Resolved
Comment thread stacks/soc/.env.example Resolved
Comment thread stacks/soc/README.md Resolved
…ck's data dir (#1068)

- check_caddyfile.sh finds a stack's Caddy image by the service name
  `caddy`, so Validate configs failed on `agent-msi`. Renamed; the
  container is still soc-agent-msi.
- 8448 is fixed in compose.yaml: group_vars names it in both URLs, so a
  tunable could only drift from them. AGENT_MSI_PORT is gone.
- stage-agent-msis.sh reads SOC_DATA_DIR from the environment, then the
  stack's .env, then .env.example, the way compose.yaml gets it.
- Its cleanup removes every other entry, hidden files and directories
  included, since whatever is left is served.
- stacks/soc/README.md's Layout block names the Caddyfile and seven
  services.

Refs #1068

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gerrrt
Gerrrt merged commit 1850765 into main Oct 8, 2026
8 checks passed
@Gerrrt
Gerrrt deleted the gerrrt/soc-agent-msi-1068-refs branch October 8, 2026 03:04
Gerrrt added a commit that referenced this pull request Oct 8, 2026
#1071's first deploy on odin crash-looped ('exec caddy failed:
Operation not permitted'): the image's caddy binary carries
cap_net_bind_service as a file capability, and the compose had dropped
every capability. Nothing in CI started the container, so odin was the
first place it showed. The hardened-boot job now boots soc/caddy like
the sensitive tier's five, with stacks/soc/compose.yaml in the proof
cache's key.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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