Verify and copy now retry 5 times 30 s apart, matching the old pull budget. The preflight stays quick: it stops at once on not found or
access denied, retries other errors once, and takes Ctrl-C. A job that leaves no result counts as failed, .rc files are written atomically, and each failed phase ends with one line naming the failed and skipped images. Job count and timeouts are internal constants instead of env overrides.
One inspect preflight turns an unreachable registry into about a
minute of retries instead of one round per image. The pool stops
launching after a finished job fails and logs every skipped image;
the caller's rc loop still reports the failures.
Read the manifest with imagetools inspect --raw and the config by
manifest digest, each under timeout and retry_cmd. Every failure in
this path gets its own message, and the .sig download is bounded by
timeouts and --fail.
Track the pool PIDs and their descendants, TERM then KILL them, and
exit 130/143. Restore the caller's traps afterwards, since soup
installs its own EXIT and ERR handlers.
Add retry_cmd, which runs an argv array instead of an eval'd command
string, and use it for the buildx copy and the local pull. Pull the
digest gpg verified and tag it, so a re-pushed tag cannot be installed.
Drop the embedded-registry shortcut from both scripts so they match
3/dev byte for byte, and delete the three so-image-common helpers
that only those shortcuts used.
Run each step with up to SO_IMAGE_PARALLEL images at a time (default 4).
Copies run in waves whose images share no layer that is not stored yet,
so each layer is still downloaded once. Nothing is copied or pulled unless
every image verified. Only the pool's own PIDs are waited on, because soup
can have its own background jobs in the same shell.
The registry links blobs per repository and buildx cannot mount across
registries, so a layer shared by several images was still downloaded once
per image. Before each copy, link layers an earlier image already stored
into the target repository.
update_docker_containers ran docker pull on every image for the gpg check,
then the buildx copy fetched the same layers from ghcr.io again, so each
image was downloaded about twice. Build the signed .txt from the manifest
and config blob instead, byte-identical to the old docker inspect layout,
copy the verified digest once, and fill the local image store from the
embedded registry. so-image-pull and so-tcpreplay load from the embedded
registry when it already has the image.
Exporting GODEBUG leaked http2client=0 into every later Go program the
script runs, and prepending it let an existing http2client setting win. Set
it as a prefix assignment on the copy only, and append it so it takes
effect. The docker push fallback cannot work on Docker 29 with the
containerd image store, which is why the copy uses buildx imagetools
create, so retry the copy instead.
getKeyValue and removeKey now return early when a parent of the key is
null or not a mapping, so get, remove and purgelistitem report the key as
missing instead of crashing on a hand-edited pillar such as
`firewall: null`.
so-push-drainer computed a record's age before the per-record
try/except. A record whose dispatched_at or checked_at was not a number
raised TypeError there, so every pass exited before the drain and
auto-apply stopped. The traceback went to the stderr of a schedule with
return_job: False, so nothing reached so-push-drainer.log.
Only the drainer writes these records, so this takes a hand-edited file,
but result tracking is not supposed to be able to block the drain. Log a
warning and remove the record, as is already done for unreadable JSON
and a missing jid.
Also reword the so-log-check exclusion comment, which said the queued
state run "still completes" where the drainer only claims it may have,
and note at the drainer's warning that so-log-check matches its text.
so-push-drainer logs "push result unknown" as a WARNING when salt-master
restarts while a pushed state run is queued: the orchestration's next
publish fails with AuthenticationError, but the minion still runs the
queued state. so-log-check matches any line containing "error", so the
quoted exception still failed the check.
Reproduced on a distributed 3.5.0 grid: a sensoroni push queued behind a
150s state run on the manager, then salt-master was restarted. The
orchestration (which runs under salt-minion.service, so it survives the
restart) raised AuthenticationError 9s later, the drainer logged the
WARNING, and the queued state run completed with 0 failed states.
so-log-check --unknown flagged the line.
The pattern requires AuthenticationError so an unknown result from any
other raised exception, e.g. a bug in a state module, is still reported.
For a setting saved for a single node, push_pillar replaced the app's
target from pillar_push_map.yaml with the node id. The app's state was
then applied to that node even if the node does not run the app.
Seen in the lab: the SOC config test saves
elasticsearch.config.cluster.routing.allocation.disk.threshold_enabled
for the first node SOC lists, and SOC lists nodes in random order. When
that node was a sensor, the elasticsearch state was applied to it and
failed to render (so_roles has no so-sensor entry), and so-push-drainer
logged "push failed".
Narrow the app's target to the node instead of replacing it:
"L@<node> and ( <app target> )". A node outside the app's target then
matches nothing, and so-push-drainer skips the action.
so-push-drainer dispatched every queued action, even when its target
matched no accepted minion. The orchestration's saltutil.refresh_pillar
step then failed with "No minions responded", and the drainer logged a
push failure that so-log-check reports as an ERROR.
Seen on a fresh distributed manager: the first drain after setup sent
strelka and suricata rule pushes targeting sensor roles before any
sensor had joined the grid. Nothing had failed; no node held the role.
Before dispatch, resolve each action's target with the master's
CkMinions (accepted keys and cached grains) and drop the ones that
match nothing, logging each at INFO. If none remain, clear the intents
without dispatching. Uncached minions still count as a match, and a
lookup error keeps the action, so pushes are never dropped when the
answer is uncertain.
Fail 4xx ILM PUTs immediately (retry 429/5xx/connect), print the
Elasticsearch reason in the salt summary, and retry the load on the
next highstate via /opt/so/state/esilm.txt when the last run failed.
Fixes https://github.com/Security-Onion-Solutions/sos/issues/277