APPL-14-000140 - The macOS system must set SSH Active Server Alive Maximum to 0.

Warning! Audit Deprecated

This audit has been deprecated and will be removed in a future update.

View Next Audit Version

Information

SSH must be configured with an Active Server Alive Maximum Count set to 0. Terminating an idle session within a short time period reduces the window of opportunity for unauthorized personnel to take control of a management session enabled on the console or console port that has been left unattended. In addition, quickly terminating an idle session or an incomplete login attempt will also free up resources committed by the managed network element.

Note: /etc/ssh/ssh_config will be automatically modified to its original state following any update or major upgrade to the operating system.

Solution

Configure the macOS system to set SSH Active Server Alive Maximum to 0 with the following command:

for u in $(/usr/bin/dscl . -list /Users UniqueID | /usr/bin/awk '$2 > 500 {print $1}'); do
config=$(/usr/bin/sudo -u $u /usr/bin/ssh -Gv . 2>&1 | /usr/bin/awk '/Reading configuration data/ {print $NF}'| /usr/bin/tr -d 'r')
configarray=( ${(f)config} )
for c in $configarray; do
/usr/bin/sudo -u $u /usr/bin/grep -q '^ServerAliveCountMax' '$c' && /usr/bin/sed -i '' 's/.*ServerAliveCountMax.*/ServerAliveCountMax 0/' '$c' || /bin/echo 'ServerAliveCountMax 0' >> '$c'
done
done

See Also

https://dl.dod.cyber.mil/wp-content/uploads/stigs/zip/U_Apple_macOS_14_V2R1_STIG.zip

Item Details

References: CAT|II, CCI|CCI-001133, Rule-ID|SV-259448r970703_rule, STIG-ID|APPL-14-000140, Vuln-ID|V-259448

Plugin: Unix

Control ID: c1d6f08d02e53d13be7fef18e821f2cfc1c6601d1ba57060c3ccb49dd420e3e0