Compare commits

..
Author SHA1 Message Date
Mike Reeves 3743173c88 Start the queue with Valkey settings and a longer stop timeout 2026-11-25 10:14:36 -05:00
Matthew Wright 8c899ef367 Merge pull request #16423 from Security-Onion-Solutions/mc-wright/551
Onion AI Notifications Tools
2026-11-24 16:05:43 -05:00
Jason Ertel ad0c0f454b Merge pull request #16424 from Security-Onion-Solutions/jertel/wip
Upgrade registry version
2026-11-24 15:56:05 -05:00
Jason Ertel ba3282a963 Merge branch '3/dev' into jertel/wip 2026-11-24 15:53:27 -05:00
Jason Ertel 462a5d9cd1 upgrade to newer registry 2026-11-24 15:49:18 -05:00
Matthew Wright 7d8edebf0e field reword 2026-11-24 15:39:09 -05:00
Matthew Wright 26d503cb1e query_notifications configurable defaults annotations 2026-11-24 09:36:58 -05:00
Mike Reeves e79b61f7ab Merge pull request #16422 from Security-Onion-Solutions/TOoSmOotH/599
FEATURE: Missing Postgres metrics graphs on the Grid metrics tab
2026-11-23 18:03:29 -05:00
Mike Reeves 5c77862e65 Give Telegraf the host process and mount info for disk and process metrics 2026-11-23 16:07:30 -05:00
Jorge Reyes 5c70f097dc Merge pull request #16414 from Security-Onion-Solutions/reyesj2/612
[expedite] Map event_data numbers and booleans as keyword in detection alerts
2026-11-20 14:43:32 -06:00
reyesj2 1b4a9d2a3f Map event_data numbers and booleans as keyword in detection alerts
Add an event_data.* dynamic template mapping long, double and boolean to keyword, and roll over logs-detections.alerts-so in post_to_3.5.0 so
upgraded grids pick it up immediately.
2026-11-20 14:28:25 -06:00
Jason Ertel 9a0e88f8d2 Merge branch '3/dev' into jertel/wip 2026-11-11 15:42:51 -05:00
reyesj2 d37241376a Surface ILM policy validation errors in highstate
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
2026-11-11 15:40:50 -05:00
reyesj2 3d8e6d0c6e Wait for Elasticsearch and retry ILM policy loads
Require wait_for_so-elasticsearch, check ES is responsive before
dispatch, and retry each policy PUT so soup no longer fails with
empty output when ES is not ready yet.

Fixes https://github.com/Security-Onion-Solutions/securityonion/issues/16369
2026-11-11 15:40:50 -05:00
reyesj2 ddf168f062 Skip leftover ISO registry.tar when tags do not match SOVERSION
Fixes #16372
2026-11-11 15:40:50 -05:00
Doug Burks 693f7917ae Install securityonion-so-crates on Security Onion Desktop 2026-11-11 15:40:50 -05:00
Mike Reeves 3682e0fde6 Remove x86-64-v3 CPU check from soup 2026-11-11 15:40:50 -05:00
Mike Reeves 161d0d145f Add version 3.5.0 to discussion template 2026-11-11 15:40:50 -05:00
Mike Reeves c04f06af1e Bump version from 3.4.0 to 3.5.0 2026-11-11 15:40:49 -05:00
Mike Reeves 7b2c44e965 3.4.0 2026-11-11 15:40:49 -05:00
Mike Reeves 9895dfbe7f 3.4.0 2026-11-11 15:40:49 -05:00
Corey Ogburn a21d4b5f1b New Configurable Timeouts for Detection Engine Syncs
Each engine now has timeouts for how long to allow a sync to go on after detections are modified.
2026-11-11 15:40:49 -05:00
Mike Reeves f5edb1f6a4 Use the host CA trust store for sensor, strelka and idh containers
Mount the host trust store into zeek, suricata, tcpreplay, the strelka
containers and idh, and restart them when it changes. Point the Python
requests clients in strelka-backend and idh at it instead of certifi.

Remove the frozen /opt/so/conf/ca bundles from every node in ca.trust
rather than only on the manager in soup.
2026-11-11 15:40:49 -05:00
Mike Reeves 708b872583 Use the host CA trust store for all grid containers
Anchor the grid CA and blocklist the eMudhra roots in the host trust
store (new ca.trust state, also used by the desktop role), then mount the
extracted store into each container instead of the frozen copies made by
so-catrust. Containers restart when the host trust changes.
2026-11-11 15:40:49 -05:00
Mike Reeves 844ca33aed Remove unused elasticsearch.p12/sokeys keystore 2026-11-11 15:40:49 -05:00
Josh Patterson 45046b946e Add custom_bind_mounts to so-kafka and so-soc
Every container in docker/defaults.yaml exposes custom_bind_mounts via
soc_docker.yaml, but kafka and soc enabled.sls never appended them to
binds, so the setting was silently ignored for those two containers.
2026-11-11 15:40:49 -05:00
9 changed files with 139 additions and 536 deletions

No files matched your search

+79 -530
View File
@@ -10,17 +10,6 @@
# NOTE: This script depends on so-common
IMAGEREPO=security-onion-solutions
STATUS_CONF='/opt/so/conf/so-status/so-status.conf'
# PIDs of the current launch_pool children, so the INT/TERM trap can kill them.
POOL_PIDS=()
_pool_tree=()
IMAGE_PARALLEL_JOBS=4
IMAGE_INSPECT_TIMEOUT=120
IMAGE_RETRIES=5
IMAGE_RETRY_DELAY=30
# The preflight is a quick check, not a retry budget: one retry at most, and a
# definite answer from the registry ends it right away.
PREFLIGHT_ATTEMPTS=2
PREFLIGHT_RETRY_DELAY=10
# shellcheck disable=SC2120
container_list() {
@@ -90,420 +79,6 @@ container_list() {
fi
}
registry_host() {
if [ -z "$HOSTNAME" ]; then
HOSTNAME=$(hostname)
fi
printf '%s' "$HOSTNAME"
}
manifest_blob_digests() {
jq -r '(.config.digest // empty), (.layers[]? | .digest)' "$1"
}
# Registries link blobs per repo and buildx cannot mount across registries, so
# pre-link shared layers or every image re-downloads them from ghcr.io.
mount_shared_blobs() {
local host=$1
local target_repo=$2
local manifest_file=$3
local log_file=$4
local -n blob_repo=$5
local digest source_repo code
while IFS= read -r digest; do
if [ -z "$digest" ]; then
continue
fi
source_repo="${blob_repo[$digest]:-}"
if [ -z "$source_repo" ] || [ "$source_repo" == "$target_repo" ]; then
continue
fi
code=$(curl -sk --connect-timeout 5 --max-time 30 -o /dev/null -w '%{http_code}' -X POST \
"https://${host}:5000/v2/${IMAGEREPO}/${target_repo}/blobs/uploads/?mount=${digest}&from=${IMAGEREPO}/${source_repo}" \
2>> "$log_file")
if [ "$code" != "201" ]; then
echo "Could not pre-link $digest from $source_repo into $target_repo (HTTP ${code:-error}), buildx will download it" >> "$log_file"
fi
done < <(manifest_blob_digests "$manifest_file")
}
record_shared_blobs() {
local target_repo=$1
local manifest_file=$2
local -n blob_repo=$3
local digest
while IFS= read -r digest; do
if [ -n "$digest" ] && [ -z "${blob_repo[$digest]:-}" ]; then
blob_repo["$digest"]=$target_repo
fi
done < <(manifest_blob_digests "$manifest_file")
}
image_ref() { # image_ref <image:tag> => the full registry reference
printf '%s/%s/%s' "$CONTAINER_REGISTRY" "$IMAGEREPO" "$1"
}
# One small function per inspect: retry_cmd logs its attempts on stdout, so the
# command's own output is redirected to its file here.
fetch_manifest() { # fetch_manifest <ref> <out file>
timeout "$IMAGE_INSPECT_TIMEOUT" docker buildx imagetools inspect --raw "$1" >"$2"
}
# buildx's --format output is the contract with the signed .txt, so it stays in
# one place that is easy to adjust.
fetch_config() { # fetch_config <ref> <out file>
timeout "$IMAGE_INSPECT_TIMEOUT" docker buildx imagetools inspect \
--format '{{json .Image}}' "$1" >"$2"
}
# The ES image follows the elasticsearch version, everything else the SO
# version. Prints "<image>:<tag> <signature url>".
resolve_image() { # resolve_image <image>
local i=$1
local image_version
if [[ " ${IMAGES_USING_ES_VERSION[*]} " =~ [[:space:]]${i}[[:space:]] ]]; then
# this is an es container so use version defined in elasticsearch defaults.yaml
local UPDATE_DIR='/tmp/sogh/securityonion'
if [ ! -d "$UPDATE_DIR" ]; then
UPDATE_DIR=/securityonion
fi
local v1=0
local v2=0
if [[ -f "$UPDATE_DIR/salt/elasticsearch/defaults.yaml" ]]; then
v1=$(grep -E " +version: " "$UPDATE_DIR/salt/elasticsearch/defaults.yaml" | awk -F: '{print $2}' | tr -d '[:space:]')
fi
if [[ -f "$DEFAULT_SALT_DIR/salt/elasticsearch/defaults.yaml" ]]; then
v2=$(grep -E " +version: " "$DEFAULT_SALT_DIR/salt/elasticsearch/defaults.yaml" | awk -F: '{print $2}' | tr -d '[:space:]')
fi
image_version=$(compare_es_versions "$v1" "$v2")
printf '%s:%s%s https://sigs.securityonion.net/es-%s/%s:%s%s.sig\n' \
"$i" "$image_version" "$IMAGE_TAG_SUFFIX" "$image_version" "$i" "$image_version" "$IMAGE_TAG_SUFFIX"
else
# this is not an es container so use the so version for the version
image_version=$VERSION
printf '%s:%s%s https://sigs.securityonion.net/%s/%s:%s%s.sig\n' \
"$i" "$image_version" "$IMAGE_TAG_SUFFIX" "$image_version" "$i" "$image_version" "$IMAGE_TAG_SUFFIX"
fi
}
verify_trusted_image() {
local i=$1
local IMAGE_LOG=$SIGNPATH/$i.verify.log
local image sig_url
read -r image sig_url < <(resolve_image "$i")
local image_name=$i
local manifest_file=$SIGNPATH/$image.manifest
local config_file=$SIGNPATH/$image.config
local REF
REF=$(image_ref "$image")
local VERIFIED_REF
local rc=0
local digest_re='^sha256:[a-f0-9]{64}$'
retry_cmd "$IMAGE_RETRIES" "$IMAGE_RETRY_DELAY" fetch_manifest "$REF" "$manifest_file" >>"$IMAGE_LOG" 2>&1 || rc=$?
if [ "$rc" -ne 0 ]; then
echo "Could not fetch manifest for $image, please ensure connectivity to $CONTAINER_REGISTRY" >>"$IMAGE_LOG" 2>&1
echo "Command failed with error $rc" >>"$IMAGE_LOG" 2>&1
return 1
fi
if [ ! -s "$manifest_file" ] || ! jq -e . "$manifest_file" >/dev/null 2>&1; then
echo "Unable to read the manifest for $image: empty or not JSON" >>"$IMAGE_LOG" 2>&1
return 1
fi
# The sig covers these exact bytes, so an index would sign the wrong document.
if jq -e '.manifests | type == "array"' "$manifest_file" >/dev/null 2>&1; then
echo "$image manifest is a multi-platform index, expected a single manifest" >>"$IMAGE_LOG" 2>&1
return 1
fi
local manifest_digest
manifest_digest=$(sha256sum "$manifest_file" | awk '{print $1}')
local config_digest
config_digest=$(jq -r '.config.digest // empty' "$manifest_file")
if [ -z "$manifest_digest" ] || [ -z "$config_digest" ] || [ "$config_digest" = "null" ]; then
echo "Unable to read the manifest for $image: no config digest" >>"$IMAGE_LOG" 2>&1
return 1
fi
# Every digest ends up in a URL (blob fetches, blob mounts, the wave
# planner), so one malformed digest rejects the whole manifest.
if [[ ! $config_digest =~ $digest_re ]]; then
echo "Unable to inspect $image: invalid config digest '$config_digest'" >>"$IMAGE_LOG" 2>&1
return 1
fi
local layer_digest
while IFS= read -r layer_digest; do
if [ -z "$layer_digest" ]; then
continue
fi
if [[ ! $layer_digest =~ $digest_re ]]; then
echo "Unable to inspect $image: invalid layer digest '$layer_digest'" >>"$IMAGE_LOG" 2>&1
return 1
fi
done < <(jq -r '.layers[]? | .digest' "$manifest_file")
rc=0
# By digest, not by tag: a tag can be re-pushed between the two calls, and the
# .txt must describe the manifest bytes that sha256sum and the sig cover.
VERIFIED_REF="${CONTAINER_REGISTRY}/${IMAGEREPO}/${image_name}@sha256:${manifest_digest}"
retry_cmd "$IMAGE_RETRIES" "$IMAGE_RETRY_DELAY" fetch_config "$VERIFIED_REF" "$config_file" >>"$IMAGE_LOG" 2>&1 || rc=$?
if [ "$rc" -ne 0 ]; then
echo "Could not fetch image config for $image, please ensure connectivity to $CONTAINER_REGISTRY" >>"$IMAGE_LOG" 2>&1
echo "Command failed with error $rc" >>"$IMAGE_LOG" 2>&1
return 1
fi
if [ ! -s "$config_file" ]; then
echo "Unable to read the config for $image" >>"$IMAGE_LOG" 2>&1
return 1
fi
# Get signature
rc=0
curl --fail --connect-timeout 10 --max-time 120 --retry 5 --retry-delay 60 -sSL \
-A "$CURLTYPE/$CURRENTVERSION/$OS/$(uname -r)" \
--output "$SIGNPATH/$image.sig" "$sig_url" >>"$IMAGE_LOG" 2>&1 || rc=$?
if [ "$rc" -ne 0 ]; then
echo "Could not pull signature file for $image, please ensure connectivity to https://sigs.securityonion.net " >>"$IMAGE_LOG" 2>&1
echo "Command failed with error $rc" >>"$IMAGE_LOG" 2>&1
return 1
fi
# .txt layout must stay byte-identical to the old `docker inspect | jq` output
# because the gpg signature is verified against it.
if ! printf '%s\n' "\"${VERIFIED_REF}\"" >"$SIGNPATH/$image.txt"; then
echo "Unable to write the signed ref line for $image" >>"$IMAGE_LOG" 2>&1
return 1
fi
if ! jq ".created, .rootfs.diff_ids" "$config_file" >>"$SIGNPATH/$image.txt"; then
echo "Unable to extract created and diff_ids for $image" >>"$IMAGE_LOG" 2>&1
return 1
fi
local GPGTEST
if ! GPGTEST=$(gpg --verify "$SIGNPATH/$image.sig" "$SIGNPATH/$image.txt" 2>&1); then
echo "Signature verification failed for $image. Details:" >>"$IMAGE_LOG" 2>&1
echo "$GPGTEST" >>"$IMAGE_LOG" 2>&1
return 1
fi
printf '%s\n%s\n%s\n' "$image" "$VERIFIED_REF" "$manifest_file" >"$SIGNPATH/$i.ref"
return 0
}
# retry()/run_check_net_err() eval their command string, so the argv helper is
# used for anything that must not be re-parsed by the shell.
retry_cmd() {
local max_attempts=$1
local delay=$2
shift 2
local attempt=1 rc=0
while :; do
if "$@"; then
return 0
else
rc=$?
fi
echo "Command failed with error $rc (attempt $attempt of $max_attempts): $*"
if [ "$attempt" -ge "$max_attempts" ]; then
return $rc
fi
attempt=$((attempt + 1))
sleep "$delay"
done
}
copy_verified_image() {
local i=$1
local IMAGE_LOG=$SIGNPATH/$i.copy.log
local image VERIFIED_REF manifest_file
{
read -r image
read -r VERIFIED_REF
read -r manifest_file
} <"$SIGNPATH/$i.ref"
local host
host=$(registry_host)
mount_shared_blobs "$host" "$i" "$manifest_file" "$IMAGE_LOG" pushed_blob_repo
# imagetools create, not docker push: Docker 29's containerd store cannot push a
# freshly pulled image. GODEBUG prefix keeps http2client=0 local (#16342).
# It reads from ghcr.io, so it gets the same budget as the verify fetches.
retry_cmd "$IMAGE_RETRIES" "$IMAGE_RETRY_DELAY" env GODEBUG="${GODEBUG:+${GODEBUG},}http2client=0" \
docker buildx imagetools create --tag "${host}:5000/${IMAGEREPO}/${image}" "$VERIFIED_REF" \
>>"$IMAGE_LOG" 2>&1 || {
echo "Unable to copy $image to embedded registry" >>"$IMAGE_LOG" 2>&1
return 1
}
return 0
}
pull_verified_image() {
local i=$1
local IMAGE_LOG=$SIGNPATH/$i.pull.log
local image VERIFIED_REF
{
read -r image
read -r VERIFIED_REF
} <"$SIGNPATH/$i.ref"
local host
host=$(registry_host)
# Pull by the digest that gpg verified, not by the mutable tag a compromised
# grid node could have re-pushed. Keep the tag name visible to `docker images`
# and to the salt checks that look for it.
local digest=${VERIFIED_REF#*@}
local digest_ref="${host}:5000/${IMAGEREPO}/${image%:*}@${digest}"
local tag_ref="${host}:5000/${IMAGEREPO}/${image}"
retry_cmd 3 10 docker pull "$digest_ref" >>"$IMAGE_LOG" 2>&1 || {
echo "Unable to pull $image from embedded registry" >>"$IMAGE_LOG" 2>&1
return 1
}
if ! docker tag "$digest_ref" "$tag_ref" >>"$IMAGE_LOG" 2>&1; then
echo "Unable to tag $image" >>"$IMAGE_LOG" 2>&1
return 1
fi
return 0
}
log_downloading() {
echo "Downloading $1" >> "$LOG_FILE" 2>&1
}
# Kill a pool job and everything it spawned: in a non-interactive shell the
# background docker/curl children ignore SIGINT, so killing only the subshell
# would leave them writing to $SIGNPATH. Only PIDs the pool started are walked.
pool_collect_tree() { # pool_collect_tree <pid>; appends to _pool_tree
local pid=$1
local child
_pool_tree+=("$pid")
while IFS= read -r child; do
if [ -n "$child" ]; then
pool_collect_tree "$child"
fi
done < <(pgrep -P "$pid" 2>/dev/null)
}
_pool_abort() { # _pool_abort <exit code>
local code=$1
local pid
trap '' INT TERM
_pool_tree=()
# Skipping reaped PIDs matters: their numbers may already belong to an
# unrelated process, whose tree would then be killed as root.
for pid in "${POOL_PIDS[@]}"; do
if kill -0 "$pid" 2>/dev/null; then
pool_collect_tree "$pid"
fi
done
for pid in "${_pool_tree[@]}"; do
kill -TERM "$pid" 2>/dev/null || true
done
sleep 2
for pid in "${_pool_tree[@]}"; do
kill -KILL "$pid" 2>/dev/null || true
done
exit "$code"
}
# Fail fast: once a finished job of this pool failed, no new job is launched, so
# an unreachable registry costs one round of retries instead of one per image.
pool_failed() { # pool_failed <phase> <image>...
local phase=$1
shift
local img rc
for img in "$@"; do
# No .rc yet means the job is still running, so it is not a failure.
if rc=$(cat "$SIGNPATH/$img.$phase.rc" 2>/dev/null) && [ "$rc" != "0" ]; then
return 0
fi
done
return 1
}
# Append one phase's per-image logs, then name what failed or was skipped.
pool_collect() { # pool_collect <phase> <image>...; non-zero if any did not pass
local phase=$1
shift
local img failed=0
local -a bad=() skipped=()
for img in "$@"; do
cat "$SIGNPATH/$img.$phase.log" >> "$LOG_FILE" 2>/dev/null
if [ ! -f "$SIGNPATH/$img.$phase.rc" ]; then
skipped+=("$img")
failed=1
elif [ "$(cat "$SIGNPATH/$img.$phase.rc" 2>/dev/null)" != "0" ]; then
bad+=("$img")
failed=1
fi
done
if [ "$failed" -ne 0 ]; then
echo "$phase failed: ${bad[*]:-none}; skipped: ${skipped[*]:-none}" >> "$LOG_FILE" 2>&1
return 1
fi
return 0
}
launch_pool() {
local func=$1
local phase=$2
local jobs=$3
local hook=$4
shift 4
local -a active=() still=() launched=()
local img pid rc
local stop=0
POOL_PIDS=()
local saved_int saved_term
saved_int=$(trap -p INT)
saved_term=$(trap -p TERM)
trap '_pool_abort 130' INT
trap '_pool_abort 143' TERM
for img in "$@"; do
if [ "$stop" -ne 0 ]; then
# No .rc is written, so the caller counts this image as failed too.
echo "Skipped $img: an earlier image failed" >>"$SIGNPATH/$img.$phase.log" 2>&1
continue
fi
if [ -n "$hook" ]; then
"$hook" "$img"
fi
(
("$func" "$img") >>"$SIGNPATH/$img.$phase.log" 2>&1
rc=$?
# Write then rename: a truncated .rc reads as a failure to pool_failed.
echo "$rc" >"$SIGNPATH/$img.$phase.rc.tmp"
mv "$SIGNPATH/$img.$phase.rc.tmp" "$SIGNPATH/$img.$phase.rc"
) &
pid=$!
POOL_PIDS+=("$pid")
active+=("$pid")
launched+=("$img")
while [ ${#active[@]} -ge "$jobs" ]; do
wait -n "${active[@]}" 2>/dev/null || true
still=()
for pid in "${active[@]}"; do
if kill -0 "$pid" 2>/dev/null; then
still+=("$pid")
fi
done
active=("${still[@]}")
if [ "$stop" -eq 0 ] && pool_failed "$phase" "${launched[@]}"; then
stop=1
fi
done
done
# Only wait on PIDs started here: soup may run its own background jobs in this
# shell (e.g. the grid highstate), and a bare `wait` would block on those.
if [ ${#POOL_PIDS[@]} -gt 0 ]; then
wait "${POOL_PIDS[@]}" 2>/dev/null || true
fi
# Restore whatever the caller had; soup installs its own EXIT/ERR handlers.
eval "${saved_int:-trap - INT}"
eval "${saved_term:-trap - TERM}"
}
update_docker_containers() {
local CURLTYPE=$1
local IMAGE_TAG_SUFFIX=$2
@@ -555,117 +130,91 @@ update_docker_containers() {
grep -q "so-logscan" "$STATUS_CONF" && TRUSTED_CONTAINERS+=("so-logscan")
fi
local -A pushed_blob_repo=()
# Download the containers from the interwebs
for i in "${TRUSTED_CONTAINERS[@]}"
do
if [ -z "$PROGRESS_CALLBACK" ]; then
echo "Downloading $i" >> "$LOG_FILE" 2>&1
else
$PROGRESS_CALLBACK $i
fi
local jobs=$IMAGE_PARALLEL_JOBS
if [[ " ${IMAGES_USING_ES_VERSION[*]} " =~ [[:space:]]${i}[[:space:]] ]]; then
# this is an es container so use version defined in elasticsearch defaults.yaml
local UPDATE_DIR='/tmp/sogh/securityonion'
if [ ! -d "$UPDATE_DIR" ]; then
UPDATE_DIR=/securityonion
fi
local v1=0
local v2=0
if [[ -f "$UPDATE_DIR/salt/elasticsearch/defaults.yaml" ]]; then
v1=$(egrep " +version: " "$UPDATE_DIR/salt/elasticsearch/defaults.yaml" | awk -F: '{print $2}' | tr -d '[:space:]')
fi
if [[ -f "$DEFAULT_SALT_DIR/salt/elasticsearch/defaults.yaml" ]]; then
v2=$(egrep " +version: " "$DEFAULT_SALT_DIR/salt/elasticsearch/defaults.yaml" | awk -F: '{print $2}' | tr -d '[:space:]')
fi
local highest_es_version=$(compare_es_versions "$v1" "$v2")
local image=$i:$highest_es_version$IMAGE_TAG_SUFFIX
local sig_url=https://sigs.securityonion.net/es-$highest_es_version/$image.sig
else
# this is not an es container so use the so version for the version
local image=$i:$VERSION$IMAGE_TAG_SUFFIX
local sig_url=https://sigs.securityonion.net/$VERSION/$image.sig
fi
# Pull down the trusted docker image
run_check_net_err \
"docker pull $CONTAINER_REGISTRY/$IMAGEREPO/$image" \
"Could not pull $image, please ensure connectivity to $CONTAINER_REGISTRY" >> "$LOG_FILE" 2>&1
# Nothing is copied or pulled unless every image verified (a bad signature
# publishes nothing). The hook runs in the parent: it mutates caller globals.
local progress_hook
if [ -z "$PROGRESS_CALLBACK" ]; then
progress_hook=log_downloading
else
progress_hook=$PROGRESS_CALLBACK
fi
# One preflight before the pool, so every verify job does not spend the long
# retry budget in parallel. It is a quick check: a definite answer from the
# registry ends it at once, and only an unclear error gets one more try.
# Upstream registry, not :5000. --foreground keeps it in this shell's process
# group, so Ctrl-C reaches it before launch_pool installs its own trap.
if [ ${#TRUSTED_CONTAINERS[@]} -gt 0 ]; then
local preflight_image preflight_ref preflight_out
local attempt=1 preflight_ok=0 preflight_kind=transient
read -r preflight_image _ < <(resolve_image "${TRUSTED_CONTAINERS[0]}")
preflight_ref=$(image_ref "$preflight_image")
while [ "$attempt" -le "$PREFLIGHT_ATTEMPTS" ]; do
if preflight_out=$(timeout --foreground "$IMAGE_INSPECT_TIMEOUT" \
docker buildx imagetools inspect --raw "$preflight_ref" 2>&1); then
preflight_ok=1
break
fi
# A registry answer never changes on a retry; anything else might.
case "$preflight_out" in
*"not found"*|*"manifest unknown"*) preflight_kind=notfound ;;
*denied*|*unauthorized*) preflight_kind=denied ;;
esac
if [ "$preflight_kind" != transient ]; then
break
fi
attempt=$((attempt + 1))
if [ "$attempt" -le "$PREFLIGHT_ATTEMPTS" ]; then
sleep "$PREFLIGHT_RETRY_DELAY"
fi
done
if [ "$preflight_ok" -ne 1 ]; then
echo "Could not inspect $preflight_ref on $CONTAINER_REGISTRY" >>"$LOG_FILE" 2>&1
case "$preflight_kind" in
notfound) echo "The image or tag for $preflight_image was not found" >>"$LOG_FILE" 2>&1 ;;
denied) echo "Access to $preflight_ref was denied by $CONTAINER_REGISTRY" >>"$LOG_FILE" 2>&1 ;;
*) echo "Check connectivity to $CONTAINER_REGISTRY or the proxy" >>"$LOG_FILE" 2>&1 ;;
esac
echo "$preflight_out" >>"$LOG_FILE" 2>&1
# Get signature
run_check_net_err \
"curl --retry 5 --retry-delay 60 -A '$CURLTYPE/$CURRENTVERSION/$OS/$(uname -r)' $sig_url --output $SIGNPATH/$image.sig" \
"Could not pull signature file for $image, please ensure connectivity to https://sigs.securityonion.net " \
noretry >> "$LOG_FILE" 2>&1
# Dump our hash values
DOCKERINSPECT=$(docker inspect $CONTAINER_REGISTRY/$IMAGEREPO/$image)
echo "$DOCKERINSPECT" | jq ".[0].RepoDigests[] | select(. | contains(\"$CONTAINER_REGISTRY\"))" > $SIGNPATH/$image.txt
echo "$DOCKERINSPECT" | jq ".[0].Created, .[0].RootFS.Layers" >> $SIGNPATH/$image.txt
if [[ $? -ne 0 ]]; then
echo "Unable to inspect $image" >> "$LOG_FILE" 2>&1
exit 1
fi
fi
launch_pool verify_trusted_image verify "$jobs" "$progress_hook" "${TRUSTED_CONTAINERS[@]}"
pool_collect verify "${TRUSTED_CONTAINERS[@]}" || exit 1
# Verify only from here: no copy and no local pull.
if [[ -n "$SKIP_TAGPUSH" ]]; then
return 0
fi
local -A ref_manifest=()
for i in "${TRUSTED_CONTAINERS[@]}"; do
{ read -r _; read -r _; read -r ref_manifest["$i"]; } < "$SIGNPATH/$i.ref"
done
# Copy in waves: a wave's images share no unstored blob, so each layer is
# downloaded once. The parent must record the blob map (subshells can't).
local -a remaining=("${TRUSTED_CONTAINERS[@]}")
local wave_no=0
while [ ${#remaining[@]} -gt 0 ]; do
wave_no=$((wave_no + 1))
local -a wave=() deferred=()
local -A claimed=()
local img digest conflict
for img in "${remaining[@]}"; do
conflict=0
while IFS= read -r digest; do
[ -z "$digest" ] && continue
[ -n "${pushed_blob_repo[$digest]:-}" ] && continue
if [ -n "${claimed[$digest]:-}" ]; then
conflict=1
break
GPGTEST=$(gpg --verify $SIGNPATH/$image.sig $SIGNPATH/$image.txt 2>&1)
if [[ $? -eq 0 ]]; then
if [[ -z "$SKIP_TAGPUSH" ]]; then
# Tag it with the new registry destination
if [ -z "$HOSTNAME" ]; then
HOSTNAME=$(hostname)
fi
done < <(manifest_blob_digests "${ref_manifest[$img]}")
if [ "$conflict" -eq 0 ]; then
wave+=("$img")
while IFS= read -r digest; do
[ -n "$digest" ] && claimed["$digest"]=1
done < <(manifest_blob_digests "${ref_manifest[$img]}")
else
deferred+=("$img")
docker tag $CONTAINER_REGISTRY/$IMAGEREPO/$image $HOSTNAME:5000/$IMAGEREPO/$image >> "$LOG_FILE" 2>&1 || {
echo "Unable to tag $image" >> "$LOG_FILE" 2>&1
exit 1
}
# Push to the embedded registry via a registry-to-registry copy. Avoids
# `docker push`, which on Docker 29.x with the containerd image store
# represents freshly-pulled images as an index whose layer content
# isn't reachable through the push path. The local `docker tag` above
# is preserved so so-image-pull's `:5000` existence check still works.
# Pin to the digest already gpg-verified above so we copy exactly the
# bytes we approved.
local VERIFIED_REF
VERIFIED_REF=$(echo "$DOCKERINSPECT" | jq -r ".[0].RepoDigests[] | select(. | contains(\"$CONTAINER_REGISTRY\"))" | head -n 1)
if [ -z "$VERIFIED_REF" ] || [ "$VERIFIED_REF" = "null" ]; then
echo "Unable to determine verified digest for $image" >> "$LOG_FILE" 2>&1
exit 1
fi
docker buildx imagetools create --tag $HOSTNAME:5000/$IMAGEREPO/$image "$VERIFIED_REF" >> "$LOG_FILE" 2>&1 || {
echo "Unable to copy $image to embedded registry" >> "$LOG_FILE" 2>&1
exit 1
}
fi
done
if [ ${#wave[@]} -eq 0 ]; then
wave=("${remaining[0]}")
deferred=("${remaining[@]:1}")
else
echo "There is a problem downloading the $image image. Details: " >> "$LOG_FILE" 2>&1
echo "" >> "$LOG_FILE" 2>&1
echo $GPGTEST >> "$LOG_FILE" 2>&1
exit 1
fi
echo "Copying images (batch $wave_no): ${wave[*]}" >> "$LOG_FILE" 2>&1
launch_pool copy_verified_image copy "$jobs" "" "${wave[@]}"
pool_collect copy "${wave[@]}" || exit 1
for img in "${wave[@]}"; do
record_shared_blobs "$img" "${ref_manifest[$img]}" pushed_blob_repo
done
remaining=("${deferred[@]}")
done
launch_pool pull_verified_image pull "$jobs" "" "${TRUSTED_CONTAINERS[@]}"
pool_collect pull "${TRUSTED_CONTAINERS[@]}" || exit 1
}
@@ -140,7 +140,23 @@
}
}
}
}
},
"dynamic_templates": [
{
"event_data_scalars_as_keyword": {
"path_match": "event_data.*",
"match_mapping_type": [
"long",
"double",
"boolean"
],
"mapping": {
"type": "keyword",
"ignore_above": 1024
}
}
}
]
}
},
"_meta": {
+2
View File
@@ -1241,6 +1241,8 @@ remove_localrules_portgroup() {
post_to_3.5.0() {
telegraf_repair
rollover_index "logs-detections.alerts-so"
set_postversion 3.5.0
}
### 3.5.0 End ###
+3 -1
View File
@@ -19,6 +19,8 @@ so-redis:
docker_container.running:
- image: {{ GLOBALS.registry_host }}:5000/{{ GLOBALS.image_repo }}/so-redis:{{ GLOBALS.so_version }}
- restart_policy: unless-stopped
- shutdown_timeout: 180
- stop_timeout: 180
- hostname: so-redis
- user: socore
- networks:
@@ -60,7 +62,7 @@ so-redis:
- {{ ULIMIT.name }}={{ ULIMIT.soft }}:{{ ULIMIT.hard }}
{% endfor %}
{% endif %}
- entrypoint: "redis-server /usr/local/etc/redis/redis.conf"
- entrypoint: "redis-server /usr/local/etc/redis/redis.conf --rdb-version-check relaxed"
- watch:
- cmd: ca_trust_extract
- file: trusttheca
+1 -1
View File
@@ -18,7 +18,7 @@ include:
# Install the registry container
so-dockerregistry:
docker_container.running:
- image: ghcr.io/security-onion-solutions/registry:3.1.1
- image: ghcr.io/security-onion-solutions/registry:3.1.2
# Intentionally `always`-- registry is critical and must
# come back up even if it was manually stopped.
- restart_policy: always
+6
View File
@@ -1638,6 +1638,12 @@ soc:
- "user.effective.name"
- "weird.name"
- "tags"
queryNotifications:
defaultLimit: 10
maxLimit: 50
summaryMaxLength: 1000
fieldValueMaxLength: 200
maxEntries: 25
onionconfig:
saltstackDir: /opt/so/saltstack
bypassEnabled: false
+26
View File
@@ -1112,6 +1112,32 @@ soc:
description: A whitelist of fields to return when OnionAI uses the query_events tool. All other fields are removed. One field per line.
global: True
multiline: True
queryNotifications:
defaultLimit:
description: Number of notifications Onion AI reads with the query_notifications tool when it doesn't ask for a specific number. Must be greater than 0. Values above maxLimit use maxLimit.
global: True
advanced: True
forcedType: int
maxLimit:
description: Maximum number of notifications Onion AI may read with one query_notifications call. Must be greater than 0. Higher values put more notification text into the model's context.
global: True
advanced: True
forcedType: int
summaryMaxLength:
description: Maximum number of characters of each notification summary that query_notifications returns to Onion AI. Must be greater than 0. Longer summaries are shortened.
global: True
advanced: True
forcedType: int
fieldValueMaxLength:
description: Maximum number of characters of each notification field value that query_notifications returns to Onion AI. Must be greater than 0. Longer values are shortened. Link values are never shortened.
global: True
advanced: True
forcedType: int
maxEntries:
description: Maximum number of fields, of links, and of attachment names, each counted separately, per notification that query_notifications returns to Onion AI. Must be greater than 0. The result tells Onion AI how many were left out.
global: True
advanced: True
forcedType: int
client:
assistant:
enabled:
+2
View File
@@ -24,6 +24,8 @@ so-telegraf:
- environment:
- HOST_ETC=/host/etc
- HOST_SYS=/host/sys
- HOST_PROC=/host/proc
- HOST_PROC_MOUNTINFO=/proc/1
- HOST_MOUNT_PREFIX=/host
- GODEBUG=x509ignoreCN=0
{% if DOCKERMERGED.containers['so-telegraf'].extra_env %}
+3 -3
View File
@@ -9,9 +9,9 @@ export REDISCLI_AUTH={{ REDIS_PASS }}
# if this script isn't already running
if [[ ! "`pidof -x $(basename $0) -o %PPID`" ]]; then
UNPARSED=$(redis-cli llen logstash:unparsed | awk '{print $1}')
PARSED=$(redis-cli llen logstash:parsed | awk '{print $1}')
MEM_USED=$(redis-cli info memory | grep used_memory_peak_perc | cut -d ":" -f2 | sed "s/%//")
UNPARSED=$(valkey-cli llen logstash:unparsed | awk '{print $1}')
PARSED=$(valkey-cli llen logstash:parsed | awk '{print $1}')
MEM_USED=$(valkey-cli info memory | grep used_memory_peak_perc | cut -d ":" -f2 | sed "s/%//")
echo "redisqueue unparsed=$UNPARSED,parsed=$PARSED,mem_used=$MEM_USED"