Compare commits

..
9 changed files with 57 additions and 78 deletions

No files matched your search

@@ -140,23 +140,7 @@
}
}
}
},
"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,8 +1241,6 @@ 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 ###
@@ -20,6 +20,8 @@ CRITICAL_AGENTS_FILE="/opt/so/conf/agents/critical-agents.txt"
OFFLINE_THRESHOLD_HOURS={{ OFFLINE_THRESHOLD_HOURS }}
REALERT_THRESHOLD={{ REALERT_THRESHOLD }}
PAGE_SIZE="{{ PAGE_SIZE }}"
# Safety limit on pagination loops. Very large fleets should raise page_size instead.
MAX_PAGES=100
log_message() {
local level="$1"
@@ -135,14 +137,16 @@ main() {
local page=1
local total_agents=0
local processed_agents=0
local agents_in_page=0
local agents=()
local current_timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
{%- if CUSTOM_KQUERY != None and CUSTOM_KQUERY | length > 0 %}
log_message "INFO" "Using custom kquery: {{ CUSTOM_KQUERY }}"
FLEET_QUERY="${FLEET_API}?kuery={{ CUSTOM_KQUERY | urlencode }}&perPage=${PAGE_SIZE}&page=${page}"
FLEET_QUERY="${FLEET_API}?kuery={{ CUSTOM_KQUERY | urlencode }}&perPage=${PAGE_SIZE}"
{%- else %}
log_message "INFO" "Using default query (all offline or degraded agents)"
FLEET_QUERY="${FLEET_API}?kuery=status%3Aoffline%20OR%20status%3Adegraded&perPage=${PAGE_SIZE}&page=${page}"
FLEET_QUERY="${FLEET_API}?kuery=status%3Aoffline%20OR%20status%3Adegraded&perPage=${PAGE_SIZE}"
{%- endif %}
while true; do
@@ -150,27 +154,48 @@ main() {
if ! response_body=$(curl -K "$CURL_CONFIG" \
-s --fail \
"$FLEET_QUERY" \
"${FLEET_QUERY}&page=${page}" \
-H 'kbn-xsrf: true' 2>/dev/null); then
log_message "ERROR" "Failed to query Fleet API (page $page)"
exit 1
fi
# pagination info
current_total=$(echo "$response_body" | jq -r '.total // 0')
current_page=$(echo "$response_body" | jq -r '.page // 1')
agents_in_page=$(echo "$response_body" | jq -r '.list | length')
# Validate the response before parsing it so a bad response can never be
# mistaken for an empty page.
if ! echo "$response_body" | jq -e 'type == "object"' >/dev/null 2>&1; then
log_message "ERROR" "Malformed Fleet API response on page $page: not a valid JSON object"
exit 1
fi
# Update total
if ! current_total=$(echo "$response_body" | jq -e '.total | select(type == "number" and . >= 0 and . == floor)' 2>/dev/null); then
log_message "ERROR" "Malformed Fleet API response on page $page: missing or invalid total"
exit 1
fi
# Fleet 9.x returns agents under "items"; older responses used "list".
if ! agents_json=$(echo "$response_body" | jq -c '(.items // .list) | if type == "array" then .[] else error("no agent array") end' 2>/dev/null); then
log_message "ERROR" "Malformed Fleet API response on page $page: missing or invalid agent collection (items/list)"
exit 1
fi
# Use the latest page's total: agents changing status between pages
# (e.g. coming back online) shrink the offline/degraded result set.
total_agents="$current_total"
if [ "$page" -eq 1 ]; then
total_agents="$current_total"
log_message "INFO" "Found $total_agents total agents across all pages"
fi
log_message "INFO" "Processing page $current_page with $agents_in_page agents"
# Process agents from current page
mapfile -t agents < <(echo "$response_body" | jq -c '.list[]')
agents=()
agents_in_page=0
if [ -n "$agents_json" ]; then
while IFS= read -r agent; do
agents+=("$agent")
agents_in_page=$((agents_in_page + 1))
done <<< "$agents_json"
fi
log_message "INFO" "Processing page $page with $agents_in_page agents"
for agent in "${agents[@]}"; do
# Grab agent details
@@ -234,20 +259,28 @@ main() {
processed_agents=$((processed_agents + agents_in_page))
if [ "$agents_in_page" -eq 0 ] || [ "$processed_agents" -ge "$total_agents" ]; then
log_message "INFO" "Completed processing all pages. Total processed: $processed_agents agents"
if [ "$processed_agents" -ge "$total_agents" ]; then
break
fi
if [ "$agents_in_page" -eq 0 ]; then
log_message "ERROR" "Incomplete agent scan: page $page was empty after $processed_agents of $total_agents agents"
exit 1
fi
page=$((page + 1))
# Limit pagination loops incase of any issues. If agent count is high enough increase page_size in SOC manager.agent_monitoring.config.page_size
if [ "$page" -gt 100 ]; then
log_message "ERROR" "Reached maximum page limit (100). Issue with script or extremely large fleet deployment. Consider increasing page_size in SOC -> manager.agent_monitoring.config.page_size"
break
if [ "$page" -gt "$MAX_PAGES" ]; then
log_message "ERROR" "Reached maximum page limit ($MAX_PAGES) after $processed_agents of $total_agents agents. Issue with script or extremely large fleet deployment. Consider increasing page_size under Administration -> Configuration -> manager -> agent_monitoring -> config -> page_size (enable 'Show advanced settings')."
exit 1
fi
done
if [ "$total_agents" -gt 0 ] && [ "$processed_agents" -eq 0 ]; then
log_message "ERROR" "Incomplete agent scan: Fleet reported $total_agents agents but none were examined"
exit 1
fi
log_message "INFO" "Fleet agent status check completed. Processed $processed_agents out of $total_agents agents"
}
+1 -3
View File
@@ -19,8 +19,6 @@ 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:
@@ -62,7 +60,7 @@ so-redis:
- {{ ULIMIT.name }}={{ ULIMIT.soft }}:{{ ULIMIT.hard }}
{% endfor %}
{% endif %}
- entrypoint: "redis-server /usr/local/etc/redis/redis.conf --rdb-version-check relaxed"
- entrypoint: "redis-server /usr/local/etc/redis/redis.conf"
- 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.2
- image: ghcr.io/security-onion-solutions/registry:3.1.1
# Intentionally `always`-- registry is critical and must
# come back up even if it was manually stopped.
- restart_policy: always
-6
View File
@@ -1638,12 +1638,6 @@ 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,32 +1112,6 @@ 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,8 +24,6 @@ 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=$(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/%//")
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/%//")
echo "redisqueue unparsed=$UNPARSED,parsed=$PARSED,mem_used=$MEM_USED"