mirror of
https://github.com/usnistgov/macos_security.git
synced 2026-03-20 07:20:25 +00:00
auth_ssh_password_authentication_disable check and fix updated. ChallengeResponseAuthentication was replaced with KbdInteractiveAuthentication. Updated fix to write to sshd_config.d/01-mscp-sshd.sshd_config Updated check to read from sshd -T Issue #223
87 lines
2.0 KiB
YAML
87 lines
2.0 KiB
YAML
id: auth_ssh_password_authentication_disable
|
|
title: "Disable Password Authentication for SSH"
|
|
discussion: |
|
|
If remote login through SSH is enabled, password based authentication _MUST_ be disabled for user login.
|
|
|
|
All users _MUST_ go through multifactor authentication to prevent unauthenticated access and potential compromise to the system.
|
|
|
|
NOTE: /etc/ssh/sshd_config will be automatically modified to its original state following any update or major upgrade to the operating system.
|
|
check: |
|
|
/usr/sbin/sshd -T | /usr/bin/grep -Ec '^(passwordauthentication\s+no|kbdinteractiveauthentication\s+no)'
|
|
result:
|
|
integer: 2
|
|
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
|
|
echo "passwordauthentication no" >> "${include_dir}01-mscp-sshd.conf"
|
|
echo "kbdinteractiveauthentication no" >> "${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
|
|
----
|
|
references:
|
|
cce:
|
|
- CCE-91740-1
|
|
cci:
|
|
- N/A
|
|
800-53r5:
|
|
- IA-2(1)
|
|
- IA-2(2)
|
|
- IA-2(6)
|
|
- IA-2
|
|
- IA-5(2)
|
|
- MA-4
|
|
- IA-2(8)
|
|
800-53r4:
|
|
- IA-2
|
|
- IA-2(1)
|
|
- IA-2(2)
|
|
- IA-2(3)
|
|
- IA-2(4)
|
|
- IA-2(6)
|
|
- IA-2(11)
|
|
- IA-5(2)
|
|
- IA-5(11)
|
|
- MA-4
|
|
srg:
|
|
- N/A
|
|
disa_stig:
|
|
- N/A
|
|
800-171r2:
|
|
- 3.5.1
|
|
- 3.5.2
|
|
- 3.5.3
|
|
- 3.7.5
|
|
cis:
|
|
benchmark:
|
|
- N/A
|
|
controls v8:
|
|
- 6.3
|
|
- 6.4
|
|
- 6.5
|
|
macOS:
|
|
- "13.0"
|
|
tags:
|
|
- 800-53r5_low
|
|
- 800-53r5_moderate
|
|
- 800-53r5_high
|
|
- 800-53r4_low
|
|
- 800-53r4_moderate
|
|
- 800-53r4_high
|
|
- 800-171
|
|
- cnssi-1253
|
|
- cisv8
|
|
mobileconfig: false
|
|
mobileconfig_info:
|