Compare commits

...
10 Commits
Author SHA1 Message Date
Mike Reeves d6a08c776b Retire InfluxDB when Telegraf output is POSTGRES, with soup consent 2026-12-03 09:38:29 -05:00
Jorge Reyes df44fe7670 Merge pull request #16437 from Security-Onion-Solutions/reyesj2-patch-5
so-log-check false positive
2026-12-02 14:12:43 -06:00
reyesj2 2773b8479f so-log-check false positive 2026-12-02 14:08:10 -06:00
Mike Reeves da7bdd63cd Merge pull request #16432 from Security-Onion-Solutions/TOoSmOotH/597
FEATURE: Built-in Postgres alarms matching the InfluxDB alarms
2026-12-02 12:29:26 -05:00
Josh Patterson 5a59a83fef Merge pull request #16417 from Security-Onion-Solutions/m0duspwnens/598
FIX: Auto-applied pushes fail after a salt-master restart or on a newly added node
2026-12-02 11:08:54 -05:00
Mike Reeves dfcfa580e5 Add example alarm definitions to SOC grid settings 2026-12-02 10:22:17 -05:00
Jason Ertel 99ee0d9750 Merge pull request #16436 from Security-Onion-Solutions/jertel/wip
avoid false positive log check
2026-12-02 09:39:45 -05:00
Jason Ertel 80c5c38cd5 avoid false positive log check 2026-12-02 09:36:08 -05:00
Mike Reeves 4fa5b48035 Add example alarm definitions to SOC grid settings 2026-12-01 15:41:31 -05:00
Mike Reeves ce91c5249b Add example alarm definitions to SOC grid settings 2026-11-30 17:53:28 -05:00
18 changed files with 461 additions and 25 deletions

No files matched your search

+2
View File
@@ -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
+5
View File
@@ -1,4 +1,5 @@
{% from 'vars/globals.map.jinja' import GLOBALS %}
{% from 'telegraf/map.jinja' import INFLUX_RETIRED %}
{% if GLOBALS.role == 'so-eval' %}
{% set NODE_CONTAINERS = [
@@ -109,3 +110,7 @@
{% set NODE_CONTAINERS = [] %}
{% endif %}
{% if INFLUX_RETIRED and 'so-influxdb' in NODE_CONTAINERS %}
{% do NODE_CONTAINERS.remove('so-influxdb') %}
{% endif %}
+10
View File
@@ -1,5 +1,6 @@
{% from 'vars/globals.map.jinja' import GLOBALS %}
{% from 'docker/docker.map.jinja' import DOCKERMERGED %}
{% from 'telegraf/map.jinja' import INFLUX_RETIRED %}
{% import_yaml 'firewall/defaults.yaml' as FIREWALL_DEFAULT %}
{# add our ip to self #}
@@ -60,3 +61,12 @@
{% endif %}
{% set FIREWALL_MERGED = salt['pillar.get']('firewall', FIREWALL_DEFAULT.firewall, merge=True) %}
{# filtered after the merge so portgroup lists saved in Configuration lose influxdb too #}
{% if INFLUX_RETIRED and (role.startswith('manager') or role in ['eval', 'standalone', 'import']) %}
{% for hostgroup in FIREWALL_MERGED.role[role].chain['DOCKER-USER'].hostgroups.values() %}
{% if 'influxdb' in hostgroup.get('portgroups', []) %}
{% do hostgroup.update({'portgroups': hostgroup.portgroups | reject('equalto', 'influxdb') | list}) %}
{% endif %}
{% endfor %}
{% endif %}
+4 -1
View File
@@ -4,9 +4,12 @@
# Elastic License 2.0.
{% from 'influxdb/map.jinja' import INFLUXMERGED %}
{% from 'telegraf/map.jinja' import INFLUX_RETIRED %}
include:
{% if INFLUXMERGED.enabled %}
{% if INFLUX_RETIRED %}
- influxdb.retired
{% elif INFLUXMERGED.enabled %}
- influxdb.enabled
{% else %}
- influxdb.disabled
+31
View File
@@ -0,0 +1,31 @@
# Copyright Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one
# or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at
# https://securityonion.net/license; you may not use this file except in compliance with the
# Elastic License 2.0.
{% from 'allowed_states.map.jinja' import allowed_states %}
{% if sls.split('.')[0] in allowed_states %}
include:
- influxdb.disabled
influxdb_data_purged:
file.directory:
- name: /nsm/influxdb
- clean: True
- require:
- docker_container: so-influxdb
influxdb_conf_purged:
file.absent:
- name: /opt/so/conf/influxdb
- require:
- docker_container: so-influxdb
{% else %}
{{sls}}_state_not_allowed:
test.fail_without_changes:
- name: {{sls}}_state_not_allowed
{% endif %}
+1 -1
View File
@@ -1,6 +1,6 @@
influxdb:
enabled:
description: Enables the grid metrics collection storage system. Security Onion grid health monitoring requires this process to remain enabled. WARNING - Disabling the process is unsupported, and will cause unexpected results.
description: Enables the grid metrics collection storage system. Security Onion grid health monitoring requires this process to remain enabled. WARNING - Disabling the process is unsupported, and will cause unexpected results. This setting has no effect when telegraf.output is POSTGRES.
forcedType: bool
helpLink: influxdb
config:
+18 -8
View File
@@ -399,6 +399,16 @@ function syncElastic() {
fi
}
function syncInfluxdbUser() {
local op=$1
local email=$2
if ! docker ps -a --format '{{.Names}}' < /dev/null | grep -qx so-influxdb; then
echo "Skipped InfluxDB $op for $email: the so-influxdb container does not exist, so InfluxDB was not changed." >&2
return 0
fi
so-influxdb-manage "$op" "$email"
}
function syncAll() {
ensureRoleFileExists
@@ -594,9 +604,9 @@ case "${operation}" in
createUser "$email" "${role:-$DEFAULT_ROLE}" "${firstName}" "${lastName}" "${note}"
syncAll
echo "Successfully added new user to SOC"
echo "$password" | so-influxdb-manage useradd "$email"
echo "$password" | syncInfluxdbUser useradd "$email"
if [[ "$role" == "superuser" ]]; then
echo "$password" | so-influxdb-manage userpromote "$email"
echo "$password" | syncInfluxdbUser userpromote "$email"
fi
;;
@@ -616,7 +626,7 @@ case "${operation}" in
syncElastic
echo "Successfully added role to user"
if [[ "$role" == "superuser" ]]; then
echo "$password" | so-influxdb-manage userpromote "$email"
echo "$password" | syncInfluxdbUser userpromote "$email"
fi
fi
;;
@@ -632,7 +642,7 @@ case "${operation}" in
syncElastic
echo "Successfully removed role from user"
if [[ "$role" == "superuser" ]]; then
echo "$password" | so-influxdb-manage userdemote "$email"
echo "$password" | syncInfluxdbUser userdemote "$email"
fi
;;
@@ -644,7 +654,7 @@ case "${operation}" in
updateUserPassword "$email"
syncAll
echo "Successfully updated user password"
echo "$password" | so-influxdb-manage userpass "$email"
echo "$password" | syncInfluxdbUser userpass "$email"
;;
"profile")
@@ -664,7 +674,7 @@ case "${operation}" in
updateStatus "$email" 'active'
syncAll
echo "Successfully enabled user"
so-influxdb-manage userenable "$email"
syncInfluxdbUser userenable "$email"
;;
"disable")
@@ -675,7 +685,7 @@ case "${operation}" in
updateStatus "$email" 'locked'
syncAll
echo "Successfully disabled user"
so-influxdb-manage userdisable "$email"
syncInfluxdbUser userdisable "$email"
;;
"delete")
@@ -686,7 +696,7 @@ case "${operation}" in
deleteUser "$email"
syncAll
echo "Successfully deleted user"
so-influxdb-manage userdel "$email"
syncInfluxdbUser userdel "$email"
;;
"sync")
+212 -2
View File
@@ -361,6 +361,187 @@ check_fleet_server() {
fi
}
TELEGRAF_PILLAR=/opt/so/saltstack/local/pillar/telegraf/soc_telegraf.sls
TELEGRAF_CREDS=/opt/so/saltstack/local/pillar/telegraf/creds.sls
INFLUXDB_DIRS=(/nsm/influxdb /opt/so/conf/influxdb)
telegraf_creds_present() {
local mid=$1
[[ -n $(so-yaml.py get -r "$TELEGRAF_CREDS" "telegraf.postgres_creds.${mid}.user" 2>/dev/null) ]] &&
[[ -n $(so-yaml.py get -r "$TELEGRAF_CREDS" "telegraf.postgres_creds.${mid}.pass" 2>/dev/null) ]]
}
# An unreadable docker or directory state counts as present so the POSTGRES path
# asks, or refuses on -y, rather than letting a highstate delete data unannounced.
influxdb_container_exists() {
local names
names=$(docker ps -a --format '{{.Names}}' 2>/dev/null) || return 0
grep -qx so-influxdb <<< "$names"
}
influxdb_present() {
local dir contents
influxdb_container_exists && return 0
for dir in "${INFLUXDB_DIRS[@]}"; do
[[ -e $dir ]] || continue
contents=$(ls -A "$dir" 2>/dev/null) || return 0
[[ -n $contents ]] && return 0
done
return 1
}
set_influxdb_size() {
local dir
local -a existing=()
for dir in "${INFLUXDB_DIRS[@]}"; do
[[ -e $dir ]] && existing+=("$dir")
done
INFLUXDB_SIZE=0
(( ${#existing[@]} == 0 )) && return 0
if ! INFLUXDB_SIZE=$(set -o pipefail; du -sch "${existing[@]}" 2>/dev/null | tail -n 1 | cut -f1) || [[ -z $INFLUXDB_SIZE ]]; then
FINAL_MESSAGE_QUEUE+=("WARNING: Unable to measure the size of InfluxDB's data in ${INFLUXDB_DIRS[*]}.")
INFLUXDB_SIZE="an unknown amount"
fi
}
influxdb_switch_prompt() {
local output answer mid mids
local -a missing=()
# read the pillar files rather than salt, as influxdb_switch_apply must while salt-master is stopped
output=$(so-yaml.py get -r "$TELEGRAF_PILLAR" telegraf.output 2>/dev/null) ||
output=$(so-yaml.py get -r "$DEFAULT_SALT_DIR/salt/telegraf/defaults.yaml" telegraf.output 2>/dev/null) ||
output=INFLUXDB
output=${output^^}
if [[ "$output" == "POSTGRES" ]]; then
if ! telegraf_creds_present "$MINIONID"; then
echo ""
echo "The metrics output is POSTGRES, but this manager has no Telegraf Postgres credentials."
echo "The upgrade cannot complete without them. soup has not changed anything."
echo ""
echo "Add them, then run soup again:"
echo " sudo so-telegraf-cred add $MINIONID"
echo ""
exit 0
fi
influxdb_present || return 0
set_influxdb_size
if [[ -n $UNATTENDED ]]; then
if [[ -n $DELETES_ACCEPTED ]]; then
INFLUX_DELETE_ACCEPTED=1
echo "InfluxDB ($INFLUXDB_SIZE) is still present on this POSTGRES grid; its deletion was accepted with --deletes-accepted."
return 0
fi
echo ""
echo "The metrics output is POSTGRES, so this upgrade would remove InfluxDB and delete"
echo "all of its data ($INFLUXDB_SIZE). The deletion cannot be undone. soup has not changed anything."
echo ""
echo "To continue, choose one of the following:"
echo " - Accept the deletion: sudo soup -y --deletes-accepted"
echo " - Confirm the deletion at the prompt: sudo soup"
echo " - Save the data if needed and remove InfluxDB by hand, then run sudo soup -y again:"
# the installed release's scheduled highstate would otherwise start InfluxDB again before soup runs
echo " sudo so-yaml.py replace /opt/so/saltstack/local/pillar/minions/$MINIONID.sls influxdb.enabled false"
echo " sudo docker rm -f so-influxdb"
echo " sudo find ${INFLUXDB_DIRS[*]} -mindepth 1 -delete"
echo ""
exit 0
fi
echo ""
echo "The metrics output is POSTGRES, but InfluxDB is still on this manager with $INFLUXDB_SIZE"
echo "of old data. This upgrade removes InfluxDB and deletes all of that data, and the"
echo "deletion cannot be undone."
echo "Exit now if you want to save or export the data first, then run soup again."
echo ""
read -rp "Press C to continue with the upgrade or E to exit: " answer
if [[ "$answer" != [cC] ]]; then
echo "Exiting soup"
exit 0
fi
return 0
fi
# releases before 3.1.0 have no Telegraf credentials; influxdb_switch_apply creates them on a switch
[[ $INSTALLEDVERSION =~ ^(2\.|3\.0\.) ]] && INFLUX_CREATE_CREDS=1
if ! mids=$(salt-key --out=json --list=accepted 2>/dev/null | jq -r '.minions[]?' 2>/dev/null) || [[ -z $mids ]]; then
missing=("(unable to list accepted minions)")
else
INFLUX_SWITCH_MINIONS=$mids
if [[ -z $INFLUX_CREATE_CREDS ]]; then
for mid in $mids; do
telegraf_creds_present "$mid" || missing+=("$mid")
done
fi
fi
if (( ${#missing[@]} > 0 )); then
FINAL_MESSAGE_QUEUE+=("NOTE: soup did not offer to move metrics from InfluxDB to Postgres because these nodes have no Telegraf Postgres credentials: ${missing[*]}")
FINAL_MESSAGE_QUEUE+=(" - Add them with sudo so-telegraf-cred add <minion_id>; the next soup will offer the switch.")
return 0
fi
if [[ -n $UNATTENDED ]]; then
FINAL_MESSAGE_QUEUE+=("NOTE: InfluxDB will be removed in a future Security Onion release, and this grid still stores metrics in it (telegraf.output is $output).")
FINAL_MESSAGE_QUEUE+=(" - Setting telegraf.output to POSTGRES in Configuration switches the grid to Postgres and deletes InfluxDB and all its data.")
return 0
fi
echo ""
echo "InfluxDB will be removed in a future Security Onion release. This grid stores its"
echo "metrics in InfluxDB (telegraf.output is $output)."
echo ""
echo "Every grid must move its metrics to Postgres before that release. Existing InfluxDB"
echo "metrics are not migrated."
echo ""
echo "Switching now points Telegraf at Postgres and removes InfluxDB, deleting all of its"
echo "data, during this upgrade. This cannot be undone, and switching back afterwards is"
echo "not supported. InfluxDB's alarm checks are deleted with it; the Postgres recommended"
echo "alarms can be added from the Grid page."
echo ""
read -rp "Switch metrics to Postgres now? [y/N]: " answer
if [[ "$answer" == [yY] ]]; then
INFLUX_SWITCH_ACCEPTED=1
else
echo "Keeping telegraf.output set to $output."
fi
}
influxdb_switch_apply() {
local mid
local -a failed=()
[[ -n $INFLUX_SWITCH_ACCEPTED ]] || return 0
if [[ -n $INFLUX_CREATE_CREDS ]]; then
echo "Creating Telegraf Postgres credentials for accepted minions."
for mid in $INFLUX_SWITCH_MINIONS; do
bash "$UPDATE_DIR/salt/manager/tools/sbin/so-telegraf-cred" add "$mid" || failed+=("$mid")
done
if (( ${#failed[@]} > 0 )); then
FINAL_MESSAGE_QUEUE+=("WARNING: Unable to create Telegraf Postgres credentials for these nodes, so the grid stays on its current metrics output: ${failed[*]}")
FINAL_MESSAGE_QUEUE+=(" - Once their credentials exist, set telegraf.output to POSTGRES in Configuration to switch.")
return 0
fi
fi
echo "Setting telegraf.output to POSTGRES in $TELEGRAF_PILLAR."
if ! { mkdir -p "$(dirname "$TELEGRAF_PILLAR")" && touch "$TELEGRAF_PILLAR" &&
so-yaml.py replace "$TELEGRAF_PILLAR" telegraf.output POSTGRES; }; then
FINAL_MESSAGE_QUEUE+=("WARNING: Unable to set telegraf.output to POSTGRES in $TELEGRAF_PILLAR, so metrics stay in InfluxDB. Set it in Configuration to switch.")
return 0
fi
chown socore:socore "$TELEGRAF_PILLAR" 2>/dev/null || true
}
influxdb_retire_check() {
[[ "$(so_telegraf_output 2>/dev/null)" == "POSTGRES" ]] || return 0
if influxdb_container_exists; then
FINAL_MESSAGE_QUEUE+=("NOTE: InfluxDB is still on this manager. The next highstate tries again to remove it and delete all its data.")
elif [[ -n $INFLUX_DELETE_ACCEPTED ]]; then
FINAL_MESSAGE_QUEUE+=("NOTE: This upgrade removed InfluxDB and deleted all its data, as accepted with --deletes-accepted.")
fi
}
check_saltmaster_status() {
set +e
echo "Waiting on the Salt Master service to be ready."
@@ -1249,6 +1430,18 @@ remove_auto_apply_batch_wait() {
done
}
check_soc_postgres_upgrade() {
local image
[[ "$(so_telegraf_output 2>/dev/null)" != "INFLUXDB" ]] || return 0
telegraf_creds_present "$MINIONID" || return 0
image=$(docker inspect --format '{{.Config.Image}}' so-soc 2>/dev/null) || image=
if [[ "$image" != *":$NEWVERSION" ]]; then
echo ""
echo "WARNING: SOC was not upgraded to $NEWVERSION because the Telegraf Postgres role setup failed. Fix Postgres, then run a highstate:"
echo " - sudo salt-call state.highstate"
fi
}
post_to_3.5.0() {
# Generate 9.4.10 elastic agent installers
echo "Regenerating Elastic Agent Installers"
@@ -2164,6 +2357,10 @@ main() {
check_cluster_health
check_fleet_server
if [[ "$is_hotfix" != "true" ]]; then
influxdb_switch_prompt
fi
echo "Checking for Salt Master and Minion updates."
upgrade_check_salt
set -e
@@ -2253,6 +2450,7 @@ main() {
echo "Running so-config-backup script."
/sbin/so-config-backup
fi
influxdb_switch_apply
echo ""
echo "Copying new Security Onion code from $UPDATE_DIR to $DEFAULT_SALT_DIR."
@@ -2330,7 +2528,7 @@ main() {
fi
set -e
highstate
highstate || { rc=$?; check_soc_postgres_upgrade; exit $rc; }
check_saltmaster_status
postupgrade_changes
[[ $is_airgap -eq 0 ]] && unmount_update
@@ -2404,6 +2602,8 @@ For more information, please see $DOC_BASE_URL/soup#distributed-deployments.
EOF
fi
influxdb_retire_check
fi
if [ "$NOTIFYCUSTOMELASTICCONFIG" = true ] ; then
@@ -2431,6 +2631,16 @@ fi
echo "### soup has been served at $(date) ###"
}
soup_args=()
for arg in "$@"; do
if [[ "$arg" == "--deletes-accepted" ]]; then
DELETES_ACCEPTED=true
else
soup_args+=("$arg")
fi
done
set -- "${soup_args[@]}"
while getopts ":b:f:y" opt; do
case ${opt} in
b )
@@ -2454,7 +2664,7 @@ while getopts ":b:f:y" opt; do
ISOLOC="$OPTARG"
;;
\? )
echo "Usage: soup [-b] [-y] [-f <iso location>]"
echo "Usage: soup [-b] [-y] [--deletes-accepted] [-f <iso location>]"
exit 1
;;
: )
+3 -2
View File
@@ -1,9 +1,8 @@
{%- from 'vars/globals.map.jinja' import GLOBALS %}
{%- from 'docker/docker.map.jinja' import DOCKERMERGED %}
{%- from 'nginx/map.jinja' import NGINXMERGED %}
{%- from 'telegraf/map.jinja' import INFLUX_RETIRED %}
{%- set role = grains.id.split('_') | last %}
{%- set influxpass = salt['pillar.get']('secrets:influx_pass') %}
{%- set influxauth = ('so:' + influxpass) | base64_encode %}
{%- set all_names = [GLOBALS.hostname, GLOBALS.url_base] + NGINXMERGED.ssl.alt_names %}
{%- set full_server_name = all_names | unique | join(' ') %}
@@ -310,6 +309,7 @@ http {
autoindex_localtime on;
}
{%- if not INFLUX_RETIRED %}
location /influxdb/ {
auth_request /auth/sessions/whoami;
rewrite /influxdb/api/(.*) /api/$1 break;
@@ -323,6 +323,7 @@ http {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cookie_path /api/ /influxdb/api/;
}
{%- endif %}
location /app/dashboards/ {
auth_request /auth/sessions/whoami;
-6
View File
@@ -6,16 +6,12 @@
{% from 'allowed_states.map.jinja' import allowed_states %}
{% if sls.split('.')[0] in allowed_states %}
{% from 'vars/globals.map.jinja' import GLOBALS %}
{% from 'telegraf/map.jinja' import TELEGRAFMERGED %}
{# postgres.enabled declares the so-postgres container and postgres_wait_ready
that the requires below reference. Salt de-duplicates the circular include. #}
include:
- postgres.enabled
{% set TG_OUT = TELEGRAFMERGED.output | upper %}
{% if TG_OUT in ['POSTGRES', 'BOTH'] %}
# Ensure the shared Telegraf database exists. init-db.sh only runs on a
# fresh data dir, so hosts upgraded onto an existing /nsm/postgres volume
# would otherwise never get so_telegraf.
@@ -70,8 +66,6 @@ postgres_telegraf_retention_reconcile:
- cmd: postgres_telegraf_group_role
- file: postgres_sbin
{% endif %}
{% else %}
{{sls}}_state_not_allowed:
+11 -1
View File
@@ -232,10 +232,20 @@ suricata:
- state: suricata
tgt: 'G@role:so-eval or G@role:so-heavynode or G@role:so-import or G@role:so-sensor or G@role:so-standalone'
# telegraf: universal.
# telegraf: universal, then the manager states that follow the output setting.
# They run after telegraf so InfluxDB is retired and SOC switches metrics
# modules only once the nodes already point at the new output.
telegraf:
- state: telegraf
tgt: '*'
- state: influxdb
tgt: 'G@role:so-eval or G@role:so-import or G@role:so-manager or G@role:so-managerhype or G@role:so-managersearch or G@role:so-standalone'
- state: nginx
tgt: 'G@role:so-eval or G@role:so-import or G@role:so-manager or G@role:so-managerhype or G@role:so-managersearch or G@role:so-standalone'
- state: firewall
tgt: 'G@role:so-eval or G@role:so-import or G@role:so-manager or G@role:so-managerhype or G@role:so-managersearch or G@role:so-standalone'
- state: soc
tgt: 'G@role:so-eval or G@role:so-import or G@role:so-manager or G@role:so-managerhype or G@role:so-managersearch or G@role:so-standalone'
# versionlock: universal (top-of-file '*' branch in salt/top.sls).
versionlock:
+9
View File
@@ -5,9 +5,14 @@
{% from 'allowed_states.map.jinja' import allowed_states %}
{% if sls.split('.')[0] in allowed_states %}
{% from 'soc/merged.map.jinja' import SOCMERGED %}
{% set use_pg_metrics = 'postgresmetrics' in SOCMERGED.config.server.modules %}
include:
- manager.sync_es_users
{% if use_pg_metrics %}
- postgres.telegraf_users
{% endif %}
sigmarepodir:
file.directory:
@@ -77,6 +82,10 @@ socconfig:
- mode: 600
- template: jinja
- show_changes: False
{% if use_pg_metrics %}
- require:
- sls: postgres.telegraf_users
{% endif %}
socmotd:
file.managed:
+55
View File
@@ -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
+2 -2
View File
@@ -7,7 +7,7 @@
{% from 'soc/defaults.map.jinja' import SOCDEFAULTS with context %}
{% from 'elasticsearch/config.map.jinja' import ELASTICSEARCH_NODES %}
{% from 'manager/map.jinja' import MANAGERMERGED %}
{% from 'telegraf/map.jinja' import TELEGRAFMERGED %}
{% from 'telegraf/map.jinja' import PG_METRICS_READY %}
{% from 'elastalert/map.jinja' import ELASTALERTMERGED %}
{%- set PG_ENTRY = salt['pillar.get']('telegraf:postgres_creds:' ~ grains.id, {}) %}
{%- set PG_USER = PG_ENTRY.get('user', '') %}
@@ -129,7 +129,7 @@
{% endif %}
{# Define the postgresmetrics module if telegraf is setup to only use Postgres #}
{% if TELEGRAFMERGED.output != 'INFLUXDB' and PG_USER and PG_PASS %}
{% if PG_METRICS_READY %}
{% do SOCMERGED.config.server.modules.update({
'postgresmetrics': {
'database': 'so_telegraf',
+63
View File
@@ -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.
+19
View File
@@ -158,6 +158,21 @@ tgraf_sbin_jinja:
- defaults:
CONTAINER_STATS: {{ TELEGRAFMERGED.container_stats }}
{% set tg_output = TELEGRAFMERGED.output | upper %}
{% set pg_creds = salt['pillar.get']('telegraf:postgres_creds:' ~ GLOBALS.minion_id, {}) %}
{% set pg_creds_missing = tg_output in ['POSTGRES', 'BOTH'] and not (pg_creds.get('user') and pg_creds.get('pass')) %}
{% if pg_creds_missing %}
{% set pg_creds_text = 'Telegraf Postgres credentials for ' ~ GLOBALS.minion_id ~ ' are missing from the pillar. On the manager, run so-telegraf-cred add ' ~ GLOBALS.minion_id ~ ', then run a highstate on this node.' %}
telegraf_postgres_creds_missing:
{% if tg_output == 'POSTGRES' %}
test.fail_without_changes:
- comment: {{ pg_creds_text | tojson }}
{% else %}
test.show_notification:
- text: {{ pg_creds_text | tojson }}
{% endif %}
{% endif %}
tgrafconf:
file.managed:
- name: /opt/so/conf/telegraf/etc/telegraf.conf
@@ -171,6 +186,10 @@ tgrafconf:
GLOBALS: {{ GLOBALS }}
TELEGRAFMERGED: {{ TELEGRAFMERGED }}
LOGSTASH_MERGED: {{ LOGSTASH_MERGED }}
{% if pg_creds_missing %}
- require:
- test: telegraf_postgres_creds_missing
{% endif %}
# this file will be read by telegraf to send node details (management interface, monitor interface, etc)
# into influx
+14
View File
@@ -6,6 +6,13 @@
{% from 'vars/globals.map.jinja' import GLOBALS %}
{% import_yaml 'telegraf/defaults.yaml' as TELEGRAFDEFAULTS %}
{% set TELEGRAFMERGED = salt['pillar.get']('telegraf', TELEGRAFDEFAULTS.telegraf, merge=True) %}
{% set TG_OUTPUT = TELEGRAFMERGED.output | upper %}
{% set TG_PG_ENTRY = salt['pillar.get']('telegraf:postgres_creds:' ~ GLOBALS.minion_id, {}) %}
{% set PG_METRICS_READY = false %}
{% if TG_OUTPUT != 'INFLUXDB' and TG_PG_ENTRY.get('user') and TG_PG_ENTRY.get('pass') %}
{% set PG_METRICS_READY = true %}
{% endif %}
{% set INFLUX_RETIRED = TG_OUTPUT == 'POSTGRES' and PG_METRICS_READY %}
{% if GLOBALS.role in ['so-eval', 'so-standalone', 'so-sensor', 'so-heavynode'] %}
{% from 'zeek/config.map.jinja' import ZEEKMERGED %}
@@ -22,3 +29,10 @@
{% do TELEGRAFMERGED.scripts[GLOBALS.role.split('-')[1]].remove('redis.sh') %}
{% endif %}
{% endif %}
{% if INFLUX_RETIRED %}
{% set role_scripts = TELEGRAFMERGED.scripts.get(GLOBALS.role.split('-')[1], []) %}
{% if 'influxdbsize.sh' in role_scripts %}
{% do role_scripts.remove('influxdbsize.sh') %}
{% endif %}
{% endif %}
+2 -2
View File
@@ -5,14 +5,14 @@ telegraf:
advanced: True
helpLink: influxdb
output:
description: Selects the backend(s) Telegraf writes metrics to. INFLUXDB keeps the current behavior; POSTGRES writes to the grid's Postgres instance; BOTH dual-writes for migration validation. When set to BOTH, the grid screen's metrics are pulled from Postgres, and the InfluxDB tool link remains visible. When set to POSTGRES, the InfluxDB tool link is removed.
description: Selects the backend(s) Telegraf writes metrics to. INFLUXDB keeps the current behavior; POSTGRES writes to the grid's Postgres instance; BOTH dual-writes for migration validation. When set to BOTH, the grid screen's metrics are pulled from Postgres, and the InfluxDB tool link remains visible. When set to POSTGRES, the InfluxDB tool link is removed. WARNING - Choosing POSTGRES removes InfluxDB from the manager and permanently deletes all of its data; this cannot be undone. Switching back to INFLUXDB or BOTH afterwards is not supported, because InfluxDB would start again with no data. BOTH keeps InfluxDB running. InfluxDB will be removed in a future release, so grids should move to POSTGRES.
options:
- INFLUXDB
- POSTGRES
- BOTH
global: True
advanced: True
helpLink: influxdb
helpLink: postgresql
config:
interval:
description: Data collection interval.