Skip to content

Commit

Permalink
Merge pull request #13624 from Security-Onion-Solutions/esver
Browse files Browse the repository at this point in the history
fix es agent update for soup
  • Loading branch information
m0duspwnens authored Sep 6, 2024
2 parents b9d9311 + 2e379dd commit ba0779e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion salt/common/tools/sbin/so-common
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,8 @@ has_uppercase() {
}

update_elastic_agent() {
get_elastic_agent_vars
local path="${1:-/opt/so/saltstack/default}"
get_elastic_agent_vars "$path"
echo "Checking if Elastic Agent update is necessary..."
download_and_verify "$ELASTIC_AGENT_URL" "$ELASTIC_AGENT_MD5_URL" "$ELASTIC_AGENT_FILE" "$ELASTIC_AGENT_MD5" "$ELASTIC_AGENT_EXPANSION_DIR"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# this file except in compliance with the Elastic License 2.0.

. /usr/sbin/so-common
{%- import_yaml 'elasticsearch/defaults.yaml' as ELASTICSEARCHDEFAULTS -%}
{%- import_yaml 'elasticsearch/defaults.yaml' as ELASTICSEARCHDEFAULTS %}

# Only run on Managers
if ! is_manager_node; then
Expand Down
5 changes: 3 additions & 2 deletions salt/manager/tools/sbin/soup
Original file line number Diff line number Diff line change
Expand Up @@ -837,12 +837,13 @@ determine_elastic_agent_upgrade() {
if [[ $is_airgap -eq 0 ]]; then
update_elastic_agent_airgap
else
update_elastic_agent
# the new elasticsearch defaults.yaml file is not yet placed in /opt/so/saltstack/default/salt/elasticsearch yet
update_elastic_agent "$UPDATE_DIR"
fi
}

update_elastic_agent_airgap() {
get_elastic_agent_vars
get_elastic_agent_vars "/tmp/soagupdate/SecurityOnion"
rsync -av /tmp/soagupdate/fleet/* /nsm/elastic-fleet/artifacts/
tar -xf "$ELASTIC_AGENT_FILE" -C "$ELASTIC_AGENT_EXPANSION_DIR"
}
Expand Down
4 changes: 2 additions & 2 deletions salt/suricata/tools/sbin/so-suricata-reload-rules
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@

. /usr/sbin/so-common

retry 40 3 'docker exec -it so-suricata /opt/suricata/bin/suricatasc -c reload-rules /var/run/suricata/suricata-command.socket' '{"message": "done", "return": "OK"}'
retry 40 3 'docker exec -it so-suricata /opt/suricata/bin/suricatasc -c ruleset-reload-nonblocking /var/run/suricata/suricata-command.socket' '{"message": "done", "return": "OK"}'
retry 60 3 'docker exec -it so-suricata /opt/suricata/bin/suricatasc -c reload-rules /var/run/suricata/suricata-command.socket' '{"message": "done", "return": "OK"}' || fail "The Suricata container was not ready in time."
retry 60 3 'docker exec -it so-suricata /opt/suricata/bin/suricatasc -c ruleset-reload-nonblocking /var/run/suricata/suricata-command.socket' '{"message": "done", "return": "OK"}' || fail "The Suricata container was not ready in time."
4 changes: 2 additions & 2 deletions setup/so-setup
Original file line number Diff line number Diff line change
Expand Up @@ -759,8 +759,8 @@ if ! [[ -f $install_opt_file ]]; then
title "Downloading IDS Rules"
logCmd "so-rule-update"
if [[ $monints || $is_import ]]; then
title "Restarting Suricata to pick up the new rules"
logCmd "so-suricata-restart"
title "Applying the Suricata state to load the new rules"
logCmd "salt-call state.apply suricata -l info"
fi
fi
title "Setting up Kibana Default Space"
Expand Down

0 comments on commit ba0779e

Please sign in to comment.