mirror of
https://github.com/usnistgov/macos_security.git
synced 2026-03-20 07:20:25 +00:00
updated with new sshd check and fix
This commit is contained in:
@@ -11,14 +11,30 @@ discussion: |
|
||||
|
||||
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/bin/grep -c "^KexAlgorithms diffie-hellman-group-exchange-sha256" /etc/ssh/sshd_config
|
||||
/usr/sbin/sshd -T | /usr/bin/grep -ci "^KexAlgorithms diffie-hellman-group-exchange-sha256"
|
||||
result:
|
||||
integer: 1
|
||||
fix: |
|
||||
[source,bash]
|
||||
----
|
||||
/usr/bin/grep -q '^KexAlgorithms' /etc/ssh/sshd_config && /usr/bin/sed -i.bak 's/.*KexAlgorithms.*/KexAlgorithms diffie-hellman-group-exchange-sha256/' /etc/ssh/sshd_config || /bin/echo 'KexAlgorithms diffie-hellman-group-exchange-sha256' >> /etc/ssh/sshd_config; /bin/launchctl kickstart -k system/com.openssh.sshd
|
||||
----
|
||||
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 "KexAlgorithms diffie-hellman-group-exchange-sha256" >> "${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:
|
||||
- N/A
|
||||
|
||||
Reference in New Issue
Block a user