Files
securityonion/setup
Josh Patterson 803158485a FIX: keep pushes off a node until its first highstate completes
A push dispatched while a node was being added ran a single state on a
node where nothing else had been applied, and the drainer logged "push
failed" as an ERROR, which fails so-log-check.

Seen on a distributed 3.5.0 install: so-minion accepted the sensor's key
at 03:22:37, after which it matched G@role:so-sensor, but
orch.deploy_newnode did not highstate it until 03:32:31 because its
manager steps queued behind the searchnode's elasticsearch,soc run. A
suricata rules change drained at 03:31:29 and state.sls suricata ran on
the sensor at 03:31:33. Three states failed with "file not found" for
/opt/so/conf/so-status/so-status.conf: file.append touches a missing
file without makedirs, and the directory is created by common, which had
not run. The push also created the so-suricata container about a minute
ahead of the highstate.

Setup now writes a first_highstate_pending grain next to role, and
salt.lasthighstate removes it at the end of a highstate. The drainer
wraps each compound target as
"( <tgt> ) and not G@first_highstate_pending:True", so a node is left
alone until a highstate has completed on it, whichever one that is. The
master matches on its cached grains, which grains.absent refreshes when
it removes the grain. Nodes installed before this change never have the
grain and are targeted as before.

The grain is set for every node type, so a manager's pushes to itself are
also skipped until its first full highstate finishes. A change that lands
during a node's first highstate, after the state it affects has run,
waits for the next scheduled highstate. Hypervisor VMs do not go through
configure_minion and are not covered.

On the same grid, with the grain set on the sensor by hand, the drainer
skipped the suricata action and still dispatched to the other nodes;
after grains.absent removed it the sensor was targeted again. That check
was run before the grain was renamed from highstate_pending. A fresh node
join has not been tested.
2026-11-18 14:48:21 -05:00
..
2022-09-07 09:06:25 -04:00
2026-10-07 11:26:32 -04:00