Commit Graph
33 Commits
Author SHA1 Message Date
Josh Patterson 72f60fcaa9 FIX: remove the docker socket from so-telegraf
so-telegraf mounted /var/run/docker.sock and joined the host docker group on
every node type. The :ro flag blocks write() to the inode, not connect() plus
HTTP over the socket, so any code execution inside the container could reach
POST /containers/create with Privileged:true and become root on the host.

No telegraf script used the socket; the only consumer was the native
[[inputs.docker]] plugin, and group_add 920 existed solely to feed it.
Container metrics now come from so-container-stats, a collector that runs on
the host from cron and writes influx line protocol to a file telegraf already
had mounted. This is the pattern so-status, so-raid-status and
so-elasticagent-status already use, so the privileged docker access stays on
the host side where root cron already ran it.

The collector runs as somon, a service account in the docker group with no
login shell and a locked password, rather than root. Docker group membership
is still root-equivalent on the host, so this is defense in depth rather than
a privilege boundary.

The telegraf scripts were root:939 mode 770, letting socore rewrite them for
code execution inside the container; they are now 750, which still allows the
read and execute telegraf needs. The container also ran with no group, giving
it gid 0, and now runs as 939:939. That alone would have broken
lasthighstate.sh, which reached /opt/so/log/salt only via the root group and
could not tell an unreadable file from a missing one, so it silently reported
a 56 year highstate age. Only the lasthighstate file is bind mounted now, and
the script tests readability instead of existence.

Everything inputs.docker collected beyond the five fields the shipped
dashboards query is available per stat under telegraf:container_stats,
annotated for SOC so an operator can enable it without editing files. Defaults
reproduce the previous output exactly. With every stat enabled the emitted
field set matches what inputs.docker wrote, verified by running the plugin
against the live socket and diffing: 53 fields, no type mismatches, no field
present on one side only.

Two deliberate differences: max_usage carries the real cgroup peak where the
daemon reports 0 on cgroup v2, and host-network containers emit no
docker_container_net row, matching inputs.docker. Docker label tags are not
restored, since nothing queries them and they cost significant cardinality.

so-status, the influxdb size cron, so-elasticagent-status, so-raid-status and
so-common-status-check truncated their output in place while telegraf read it,
so telegraf periodically saw an empty file and logged a parse error or emitted
empty values. They now write aside and rename. Measured on a live manager, the
old so-status cron left status.log empty for 215 of 10997 reads.

Tested on a fresh install, a converted grid and a 3.0 upgrade.
2026-09-24 14:30:25 -04:00
Josh Patterson 9e7e6edae0 Add unit tests for _beacons and wire into CI
Add 100%-coverage unit tests for the three custom salt beacons
(postgres_pillar_beacon, rules_beacon, zeek) and add salt/_beacons to
the python-test workflow's paths trigger and matrix.

To pass the workflow's flake8 lint over the whole directory:
- zeek.py: reindent to 4 spaces, drop trailing blank line, noqa the
  Salt-injected __salt__ references (F821); no logic change.
- postgres_pillar_beacon.py: noqa C901 on beacon() (complexity 13 > 12).
2026-07-16 15:28:22 -04:00
Jason Ertel e4ba3d6a2a pr/workflow changes 2026-04-01 10:47:59 -04:00
Jason Ertel 812f65eee8 revisit workflows 2026-03-27 16:11:31 -04:00
Mike Reeves 625bfb3ba7 Rebuild analyzer source-packages wheels for Python 3.14
The so-soc Dockerfile base image moved to python:3.14.3-slim but
analyzer source-packages still contained cp313 wheels for pyyaml and
charset_normalizer, causing pip install failures at container startup.

Replace all cp313 wheels with cp314 builds (pyyaml 6.0.3,
charset_normalizer 3.4.6) across all 14 analyzers and update the
CI python-test workflow to match.
2026-03-16 18:58:23 -04:00
Jason Ertel 7c45db2295 add support to so-yaml for using yaml file content for values 2025-11-11 16:57:54 -05:00
Jason Ertel 95d8e0f318 stop double workflow runs 2025-05-01 15:46:04 -04:00
Jason Ertel ba4df4c8b6 dep updates 2025-05-01 15:36:20 -04:00
Jason Ertel 86eab6fda2 dep updates 2025-05-01 15:31:26 -04:00
Jason Ertel bf19c6e730 ca download; ignore shard errors on startup; clarify oidc id 2025-02-05 15:04:04 -05:00
Jason Ertel 89cb8b79fd restrict workflows to so 2024-04-29 08:07:19 -04:00
Jason Ertel af5b3feb96 re-schedule lock jobs 2024-03-18 07:34:18 -04:00
Jason Ertel 6c6a362fcc add lock threads 2024-02-20 19:14:18 -05:00
Jason Ertel 196d59869a Merge pull request #11998 from Security-Onion-Solutions/kilo
upgrade cla action
2023-12-13 10:18:39 -05:00
Jason Ertel 03279732b7 upgrade cla action 2023-12-13 10:09:36 -05:00
Jason Ertel bc044fa2d5 more coverage 2023-11-08 18:42:06 -05:00
Jason Ertel 84b815c2ef add yaml helper script; refactor python testing 2023-11-08 18:30:05 -05:00
Jason Ertel 1ab44a40d3 add yaml helper script; refactor python testing 2023-11-08 18:29:06 -05:00
Jason Ertel 0dc5e7e714 try paths with wildcard 2023-01-24 10:38:59 -05:00
Jason Ertel 62b96c3698 rework filter for action 2023-01-24 10:31:02 -05:00
Jason Ertel cfc232eafa try paths filter on both even though docs only mention support for push 2023-01-24 10:23:42 -05:00
Jason Ertel 675ace21f5 Add gh action for contrib check 2022-06-27 11:11:15 -04:00
Josh Brower b8ee896f8a pin v1.6.0 2022-06-17 12:38:54 -04:00
Jason Ertel b45b6b198b Improved unit test coverage of new analyzers; Utilize localized summaries; Require 100% code coverage on analyzers 2022-05-12 16:32:47 -04:00
weslambert efb229cfcb Update to match configuration in analyzer dir 2022-05-02 16:35:21 -04:00
Jason Ertel d2fa80e48a Update status codes to match SOC 2022-04-05 07:20:23 -04:00
Jason Ertel d2bf6d5618 Add build script to help pre-validate analyzers before pushing 2022-03-29 14:04:23 -04:00
Jason Ertel cb491630ae Analyzer CI 2022-03-29 13:40:56 -04:00
Jason Ertel 0a8d24a225 Add automated CI for analyzers 2022-03-29 13:10:04 -04:00
Jason Ertel 8ebeeb497f add configuration to override leak detector defaults 2022-03-15 09:43:09 -04:00
Jason Ertel 43e0c3a60b Apply action on PR only now that PRs are mandatory 2021-02-22 12:35:17 -05:00
Jason Ertel 79cbc747ea Run leaktest on any branch 2020-11-11 15:52:48 -05:00
Jason Ertel eb7e8079ec Create leaktest.yml 2020-11-11 15:39:06 -05:00