mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2026-12-04 09:46:07 +01:00
Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
086f5c5e51 | ||
|
|
62a7ba40f6 | ||
|
|
7ec2dec143 | ||
|
|
df44fe7670 | ||
|
|
2773b8479f | ||
|
|
da7bdd63cd | ||
|
|
5a59a83fef | ||
|
|
dfcfa580e5 | ||
|
|
99ee0d9750 | ||
|
|
80c5c38cd5 | ||
|
|
4fa5b48035 | ||
|
|
ce91c5249b | ||
|
|
4f9981ebf9 |
No files matched your search
@@ -164,6 +164,7 @@ if [[ $EXCLUDE_FALSE_POSITIVE_ERRORS == 'Y' ]]; then
|
||||
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|syncing rule" # false positive (rule sync log line includes rule name which can contain 'error')
|
||||
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|request_unauthorized" # false positive (login failures to Hydra result in an 'error' log)
|
||||
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|adding index lifecycle policy" # false positive (elasticsearch policy names contain 'error')
|
||||
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|updating index lifecycle policy" # false positive (elasticsearch policy names contain 'error')
|
||||
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|adding ingest pipeline" # false positive (elasticsearch ingest pipeline names contain 'error')
|
||||
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|updating index template" # false positive (elasticsearch index or template names contain 'error')
|
||||
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|updating component template" # false positive (elasticsearch index or template names contain 'error')
|
||||
@@ -179,6 +180,7 @@ if [[ $EXCLUDE_FALSE_POSITIVE_ERRORS == 'Y' ]]; then
|
||||
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|Static assets preprocessor only supports GET and HEAD requests" # expected WARN log lines indicating invalid auth header
|
||||
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|respondError" # respondError is a function name, output via http middleware as standard request logging
|
||||
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|GET /kibana/" # Ignore Kibana queries with triggered words
|
||||
EXCLUDED_ERRORS="$EXCLUDED_ERRORS|error-logs" # Elastic indexes can contain error-logs in their names, which can trigger false positives in log checks
|
||||
fi
|
||||
|
||||
if [[ $EXCLUDE_KNOWN_ERRORS == 'Y' ]]; then
|
||||
|
||||
@@ -20,11 +20,17 @@ 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; Fleet page-based results are also capped at 10000 agents.
|
||||
MAX_PAGES=100
|
||||
|
||||
log_message() {
|
||||
local level="$1"
|
||||
local message="$2"
|
||||
echo "$(date -u +"%Y-%m-%dT%H:%M:%SZ") [$level] $message" >&2
|
||||
# ERROR also goes to syslog: cron output is not monitored, and syslog is shipped to Elasticsearch.
|
||||
if [ "$level" = "ERROR" ]; then
|
||||
logger -t so-elastic-agent-monitor -p user.err -- "ERROR: $message" 2>/dev/null || true
|
||||
fi
|
||||
}
|
||||
|
||||
matches_critical_pattern() {
|
||||
@@ -135,42 +141,70 @@ 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
|
||||
if (( page * PAGE_SIZE > 10000 )); then
|
||||
log_message "ERROR" "Fleet page-based results are limited to 10000 agents (page $page x page_size $PAGE_SIZE); $processed_agents of $total_agents agents were checked. Narrow the agents being monitored with custom_kquery under Administration -> Configuration -> manager -> agent_monitoring -> config (enable 'Show advanced settings')."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log_message "INFO" "Fetching page $page (${PAGE_SIZE} agents per page)"
|
||||
|
||||
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,17 +268,20 @@ 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
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ http {
|
||||
|
||||
server_tokens off;
|
||||
|
||||
ssl_ecdh_curve X25519MLKEM768:SecP256r1MLKEM768:SecP384r1MLKEM1024/X25519:secp521r1:secp384r1;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
@@ -84,7 +86,6 @@ http {
|
||||
ssl_session_cache shared:SSL:1m;
|
||||
ssl_session_timeout 10m;
|
||||
ssl_ciphers TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256:TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256:TLS_RSA_WITH_AES_256_GCM_SHA384:TLS_RSA_WITH_AES_256_CCM:TLS_RSA_WITH_ARIA_256_GCM_SHA384:TLS_RSA_WITH_AES_128_GCM_SHA256:TLS_RSA_WITH_AES_128_CCM:TLS_RSA_WITH_ARIA_128_GCM_SHA256;
|
||||
ssl_ecdh_curve X25519:secp521r1:secp384r1;
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
}
|
||||
@@ -111,7 +112,6 @@ http {
|
||||
ssl_session_cache shared:SSL:1m;
|
||||
ssl_session_timeout 10m;
|
||||
ssl_ciphers TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256:TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256:TLS_RSA_WITH_AES_256_GCM_SHA384:TLS_RSA_WITH_AES_256_CCM:TLS_RSA_WITH_ARIA_256_GCM_SHA384:TLS_RSA_WITH_AES_128_GCM_SHA256:TLS_RSA_WITH_AES_128_CCM:TLS_RSA_WITH_ARIA_128_GCM_SHA256;
|
||||
ssl_ecdh_curve X25519:secp521r1:secp384r1;
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
location / {
|
||||
@@ -145,7 +145,6 @@ http {
|
||||
ssl_session_cache shared:SSL:1m;
|
||||
ssl_session_timeout 10m;
|
||||
ssl_ciphers TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256:TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256:TLS_RSA_WITH_AES_256_GCM_SHA384:TLS_RSA_WITH_AES_256_CCM:TLS_RSA_WITH_ARIA_256_GCM_SHA384:TLS_RSA_WITH_AES_128_GCM_SHA256:TLS_RSA_WITH_AES_128_CCM:TLS_RSA_WITH_ARIA_128_GCM_SHA256;
|
||||
ssl_ecdh_curve X25519:secp521r1:secp384r1;
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
|
||||
|
||||
@@ -2557,6 +2557,61 @@ soc:
|
||||
grid:
|
||||
maxUploadSize: 26214400
|
||||
staleMetricsMs: 120000
|
||||
recommendedAlarms:
|
||||
- name: Root Disk Usage
|
||||
metric: disk
|
||||
metricKey: disk_used_root
|
||||
operator: gt
|
||||
threshold: '95'
|
||||
durationSeconds: 300
|
||||
severity: critical
|
||||
clearedSeverity: info
|
||||
enabled: true
|
||||
- name: NSM Disk Usage
|
||||
metric: disk
|
||||
metricKey: disk_used_nsm
|
||||
operator: gt
|
||||
threshold: '95'
|
||||
durationSeconds: 300
|
||||
severity: critical
|
||||
clearedSeverity: info
|
||||
enabled: true
|
||||
- name: Low PCAP Retention
|
||||
metric: pcap_retention
|
||||
metricKey: pcap_retention
|
||||
operator: lt
|
||||
threshold: '1'
|
||||
durationSeconds: 300
|
||||
severity: critical
|
||||
clearedSeverity: info
|
||||
enabled: true
|
||||
- name: Suricata Packet Loss
|
||||
metric: loss
|
||||
metricKey: suricata_loss
|
||||
operator: gt
|
||||
threshold: '5'
|
||||
durationSeconds: 300
|
||||
severity: critical
|
||||
clearedSeverity: info
|
||||
enabled: true
|
||||
- name: Zeek Packet Loss
|
||||
metric: loss
|
||||
metricKey: zeek_loss
|
||||
operator: gt
|
||||
threshold: '5'
|
||||
durationSeconds: 300
|
||||
severity: critical
|
||||
clearedSeverity: info
|
||||
enabled: true
|
||||
- name: Low Monitor Traffic
|
||||
metric: net
|
||||
metricKey: traffic_mon_in
|
||||
operator: lt
|
||||
threshold: '5'
|
||||
durationSeconds: 300
|
||||
severity: critical
|
||||
clearedSeverity: info
|
||||
enabled: true
|
||||
cases:
|
||||
advanced: false
|
||||
aggregationActionsEnabled: false
|
||||
|
||||
@@ -1343,6 +1343,69 @@ soc:
|
||||
staleMetricsMs:
|
||||
description: The age in milliseconds of node metrics when they are considered stale. Stale metrics have a faded appearance on the Grid screen.
|
||||
global: True
|
||||
recommendedAlarms:
|
||||
description: Recommended alarms offered on the Grid page's Alarms tab and Options dialog.
|
||||
global: True
|
||||
advanced: True
|
||||
forcedType: "[]{}"
|
||||
syntax: json
|
||||
helpLink: grid
|
||||
uiElements:
|
||||
- field: name
|
||||
label: Name
|
||||
required: True
|
||||
- field: metric
|
||||
label: Metric
|
||||
required: True
|
||||
- field: metricKey
|
||||
label: Metric Key
|
||||
required: False
|
||||
- field: operator
|
||||
label: Operator
|
||||
required: True
|
||||
options:
|
||||
- gt
|
||||
- gte
|
||||
- lt
|
||||
- lte
|
||||
- eq
|
||||
- ne
|
||||
- contains
|
||||
- field: threshold
|
||||
label: Threshold
|
||||
required: True
|
||||
forcedType: string
|
||||
- field: durationSeconds
|
||||
label: Duration Seconds
|
||||
required: False
|
||||
forcedType: int
|
||||
- field: severity
|
||||
label: Severity
|
||||
required: True
|
||||
options:
|
||||
- critical
|
||||
- high
|
||||
- medium
|
||||
- low
|
||||
- info
|
||||
- field: clearedSeverity
|
||||
label: Cleared Severity
|
||||
required: False
|
||||
options:
|
||||
- none
|
||||
- critical
|
||||
- high
|
||||
- medium
|
||||
- low
|
||||
- info
|
||||
- field: enabled
|
||||
label: Enabled
|
||||
required: False
|
||||
forcedType: bool
|
||||
- field: note
|
||||
label: Note
|
||||
required: False
|
||||
multiline: True
|
||||
case:
|
||||
analyzerNodeId:
|
||||
description: The node ID on which analyzers will be executed.
|
||||
|
||||
Reference in new issue
Block a user