diff --git a/salt/manager/tools/sbin/soup b/salt/manager/tools/sbin/soup index b155d1bec..83d6cc438 100755 --- a/salt/manager/tools/sbin/soup +++ b/salt/manager/tools/sbin/soup @@ -341,6 +341,16 @@ check_cluster_health() { check_fleet_server() { echo "Checking that Elastic Fleet Server is responding." + # Before checking fleet health, check for and fix known issue with elastic-agent container and fs.protected_symlinks + local protected_symlinks=$(sysctl -b fs.protected_symlinks) + if [[ "$protected_symlinks" == "1" ]]; then + # disable fs.protected_symlinks and restart elasticfleet + sysctl -w fs.protected_symlinks=0 + docker stop so-elastic-fleet; docker rm -f so-elastic-fleet + printf "\nUpdated sysctl fs.protected_symlinks. Restarting fleet before running health check and continuing with soup.\n" + salt-call state.apply elasticfleet queue=True + fi + # Modeled on the wait_for_so-elastic-fleet state check in elasticfleet/enabled.sls, # which waits for HTTP 200 from the Fleet Server status API. if curl -sk --fail --retry 3 --retry-delay 10 --max-time 30 "https://localhost:8220/api/status" > /dev/null 2>&1; then @@ -1008,8 +1018,20 @@ post_to_3.2.0() { } ### 3.2.0 End ### -### 3.2.0 Scripts ### +### 3.3.0 Scripts ### + + # Sets fs.protected_symlinks=0 + # + # Elastic Agent docker image chowns its directory to the running UID + # but does not chown the elastic-agent launcher symlink. + # Preventing non-root users from following that launcher symlink. +disable_sysctl_fs_protected_symlink() { + salt -C 'I@stig:enabled' state.single sysctl.present name=fs.protected_symlinks value=0 config=/etc/sysctl.conf +} + up_to_3.3.0() { + disable_sysctl_fs_protected_symlink + INSTALLEDVERSION=3.3.0 } diff --git a/salt/stig/enabled.sls b/salt/stig/enabled.sls index 91aae7069..b53256e04 100644 --- a/salt/stig/enabled.sls +++ b/salt/stig/enabled.sls @@ -65,6 +65,15 @@ run_remediate: - success_retcodes: - 2 +# Elastic Agent docker image chowns its directory to the running UID but does not +# chown the elastic-agent launcher symlink. fs.protected_symlinks=1 then prevents +# non-root users from following that launcher symlink. +{# OSCAP rule id: xccdf_org.ssgproject.content_rule_sysctl_fs_protected_symlinks #} +fs.protected_symlinks: + sysctl.present: + - value: 0 + - config: /etc/sysctl.conf + {# OSCAP rule id: xccdf_org.ssgproject.content_rule_disable_ctrlaltdel_burstaction #} disable_ctrl_alt_del_action: file.replace: diff --git a/salt/stig/files/sos-oscap.xml b/salt/stig/files/sos-oscap.xml index aa5b2ed31..9fc8dacf8 100644 --- a/salt/stig/files/sos-oscap.xml +++ b/salt/stig/files/sos-oscap.xml @@ -1601,7 +1601,7 @@ DISA STIG for Oracle Linux 9 V1R3. - + @@ -2202,7 +2202,7 @@ standard DISA STIG for Oracle Linux 9 profile. - +