APPL-14-000110 - The macOS system must configure SSH ServerAliveInterval option set to 900.

Information

SSH must be configured with an Active Server Alive Maximum Count set to 900.

Setting the Active Server Alive Maximum Count to 900 will log users out after a 900-second interval of inactivity.

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 the SSH ServerAliveInterval option set to 900 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 '^ServerAliveInterval' '$c' && /usr/bin/sed -i '' 's/.*ServerAliveInterval.*/ServerAliveInterval 900/' '$c' || /bin/echo 'ServerAliveInterval 900' >> '$c'
done
done

See Also

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

Item Details

Category: SYSTEM AND COMMUNICATIONS PROTECTION

References: 800-53|SC-10, CAT|II, CCI|CCI-001133, Rule-ID|SV-259445r970703_rule, STIG-ID|APPL-14-000110, Vuln-ID|V-259445

Plugin: Unix

Control ID: 5fdacdace99babe624ab69c9b84ff3b8759cc47a6f5a7248de442162cdee253a