Skip to content

Commit

Permalink
updated ssh and sshd fix
Browse files Browse the repository at this point in the history
  • Loading branch information
robertgendler committed Sep 12, 2024
1 parent 03ea283 commit 7ae4f25
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
9 changes: 8 additions & 1 deletion rules/os/os_ssh_fips_compliant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ result:
fix: |
[source,bash]
----
/bin/ln -fs /etc/ssh/crypto/fips.conf /etc/ssh/crypto.conf
fips_ssh_config="Ciphers aes128-gcm@openssh.com
HostbasedAcceptedAlgorithms ecdsa-sha2-nistp256,ecdsa-sha2-nistp256-cert-v01@openssh.com
HostKeyAlgorithms ecdsa-sha2-nistp256-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp256,sk-ecdsa-sha2-nistp256@openssh.com
KexAlgorithms ecdh-sha2-nistp256
MACs hmac-sha2-256-etm@openssh.com,hmac-sha2-256
PubkeyAcceptedAlgorithms ecdsa-sha2-nistp256,ecdsa-sha2-nistp256-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com
CASignatureAlgorithms ecdsa-sha2-nistp256,sk-ecdsa-sha2-nistp256@openssh.com"
/bin/echo "${fips_ssh_config}" > /etc/ssh/ssh_config.d/fips_ssh_config
----
references:
cce:
Expand Down
22 changes: 21 additions & 1 deletion rules/os/os_sshd_fips_compliant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,27 @@ result:
fix: |
[source,bash]
----
/bin/ln -fs /etc/ssh/crypto/fips.conf /etc/ssh/crypto.conf
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
fips_sshd_config=("Ciphers aes128-gcm@openssh.com" "HostbasedAcceptedAlgorithms ecdsa-sha2-nistp256,ecdsa-sha2-nistp256-cert-v01@openssh.com" "HostKeyAlgorithms ecdsa-sha2-nistp256-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp256,sk-ecdsa-sha2-nistp256@openssh.com" "KexAlgorithms ecdh-sha2-nistp256" "MACs hmac-sha2-256-etm@openssh.com,hmac-sha2-256" "PubkeyAcceptedAlgorithms ecdsa-sha2-nistp256,ecdsa-sha2-nistp256-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com" "CASignatureAlgorithms ecdsa-sha2-nistp256,sk-ecdsa-sha2-nistp256@openssh.com")
for config in $fips_sshd_config; do
/usr/bin/grep -qxF "$config" "${include_dir}01-mscp-sshd.conf" 2>/dev/null || echo "$config" >> "${include_dir}01-mscp-sshd.conf"
done
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:
Expand Down

0 comments on commit 7ae4f25

Please sign in to comment.