Skip to content

fix(soc): first bring-up perms — velociraptor config dir, root-ca.pem, mount check - #681

Merged
Gerrrt merged 3 commits into
mainfrom
gerrrt/soc-bringup-perms
Sep 27, 2026
Merged

Gerrrt merged 3 commits into
mainfrom
gerrrt/soc-bringup-perms

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Sep 27, 2026

Copy link
Copy Markdown
Owner

Building odin (#266/#267) was the first real bring-up of the soc stack, and three things needed fixing. Velociraptor and alloy both run as root with cap_drop: [ALL] — so no CAP_DAC_OVERRIDE, and they're bound by ordinary file permissions:

  1. Velociraptor config dir. It writes server.config.yaml on first start, but the checkout's stacks/soc/velociraptor/etc is owned by the deploy user. Root-without-DAC_OVERRIDE can't create a file there, so init.vql's write_file returns null (silently) and the container crash-loops on open /etc/velociraptor/server.config.yaml: no such file. Runbook §3 now chown root:roots that dir, matching the datastore (/srv/soc-data/velociraptor) which §2 already makes root's.

  2. root-ca.pem perms. alloy reads the CA's public cert to verify wazuh.indexer (rather than skip verification), but the generator leaves it 0400 owned by uid 1000 — unreadable by capless root, so alloy restarts on Couldn't load root certificate … permission denied. Runbook §6 now chmod 0444s the public cert (never a key).

  3. check_mounted_config.py (run by make up) read every host-side mount source, including the manager's certs (uid 999, 0400), and crashed with PermissionError — failing make up after the stack was already healthy. It now skips a cert the deploy user can't read: generated once, never edited, so the edit-then-reload drift this guard exists to catch can't reach it.

Plus an ordering fix: the §6 cert generator shares the stack's compose.yaml, and compose resolves every ${VAR:?} in the file before running any one service — so .env must exist first. §6 now runs make render STACK=soc before the generator.

All four containers + alloy verified healthy on odin after these changes.

🤖 Generated with Claude Code

Gerrrt and others added 3 commits September 27, 2026 07:27
…, mount check

Three things surfaced building odin (#266/#267), the first real bring-up of
the soc stack. Velociraptor and alloy both run as root with cap_drop: [ALL],
so they have no CAP_DAC_OVERRIDE and are bound by ordinary file permissions:

- Velociraptor writes server.config.yaml on first start, but the checkout's
  stacks/soc/velociraptor/etc is owned by the deploy user, so root-without-
  DAC_OVERRIDE cannot create a file in it. The generate step fails silently
  (write_file returns null) and the container crash-loops on "no such file".
  Runbook §3 now chowns that dir to root, like the datastore already is.

- alloy reads root-ca.pem (the CA's PUBLIC cert) to verify wazuh.indexer, but
  the generator leaves it 0400 owned by uid 1000, unreadable by capless root.
  Runbook §6 now chmods the public cert (never a key) to 0444.

- check_mounted_config.py, run by `make up`, read every host-side mount source
  including the manager's certs (owned uid 999, 0400) and crashed with
  PermissionError, failing `make up` after the stack was already healthy.
  It now skips a cert the deploy user cannot read — generated once, never
  edited, so the edit-then-reload drift this guard catches cannot reach it.

Also: §6's cert generator shares the stack's compose.yaml, so compose resolves
every ${VAR:?} in it before running the service — `.env` must exist first.
§6 now runs `make render STACK=soc` before the generator.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Wazuh vulnerability detection downloads its content (~400 MB) and unpacks it to
an ~8.5 GB tar in /var/ossec/tmp before importing it. That path was on the
manager container's writable layer, so the first start filled odin's 30 GB OS
disk to 100% (every other service healthy). §0's hardware note already puts
"the vulnerability feed" on the 96 GB data disk; this routes the staging there,
as a bind-backed volume beside indexer-data and velociraptor-datastore, and §2
creates /srv/soc-data/manager-tmp (uid 999, the manager's wazuh user).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Follow-on to the manager-tmp fix: the ~8.5 GB the feed unpacks to (manager-tmp)
was only half of it. Vulnerability detection then builds a persistent content
database under /var/ossec/queue/vd that is itself ~8.5 GB and grows with the
feed, and /var/ossec/queue was a plain named volume on the 30 GB OS disk — so
the first import filled / to 100% and wedged the guest a second time, after the
staging tar had been moved off. Bind-back manager-queue to the data disk, where
§0 already accounts for "the vulnerability feed"; §2 creates the directory
(uid 999). The agent event queue lives here too and wants the data disk anyway.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Gerrrt
Gerrrt merged commit bd5133d into main Sep 27, 2026
7 checks passed
@Gerrrt
Gerrrt deleted the gerrrt/soc-bringup-perms branch September 27, 2026 14:58
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.

1 participant