BaselineWatch
Desk

os_sshd_login_grace_time_configure Set Login Grace Time to $ODV

NIST macOS Security Compliance Project Tahoe Guidance, Revision 3.0 (cf656e8)
All changes in this version
first version loaded macOS

Title

Set Login Grace Time to $ODV

Control

/usr/sbin/sshd -G | /usr/bin/awk '/logingracetime/{print $2}'

Discussion

If SSHD is enabled then it _MUST_ be configured to wait only $ODV seconds before timing out logon attempts.

NOTE: On macOS 15.2 and higher the SSH configuration can be reset to the macOS default by running /usr/libexec/reset-ssh-configuration.

Related controls

sc-10

Fix

[source,bash]
----
include_dir=$(/usr/bin/awk '/^Include/ {print $2}' /etc/ssh/sshd_config | /usr/bin/tr -d '*')

if [[ -z $include_dir ]]; then
/usr/bin/sed -i.bk "1s/.*/Include \/etc\/ssh\/sshd_config.d\/\*/" /etc/ssh/sshd_config
fi

/usr/bin/grep -qxF 'logingracetime $ODV' "${include_dir}01-mscp-sshd.conf" 2>/dev/null || echo "logingracetime $ODV" >> "${include_dir}01-mscp-sshd.conf"

for file in $(ls ${include_dir}); do
if [[ "$file" == "100-macos.conf" ]]; then
continue
fi
if [[ "$file" == "01-mscp-sshd.conf" ]]; then
break
fi
/bin/mv ${include_dir}${file} ${include_dir}20-${file}
done
----