Skip to content

Commit

Permalink
Fix Ubuntu tests for sshd_use_approved_macs_ordered_stig
Browse files Browse the repository at this point in the history
  • Loading branch information
mpurg committed Apr 18, 2024
1 parent 953ab2b commit 3f6d10d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/bin/bash

{{% if product == "ubuntu2204" %}}
sshd_approved_macs="hmac-sha2-512,[email protected],hmac-sha2-256,[email protected]"
{{% else %}}
sshd_approved_macs="hmac-sha2-512,hmac-sha2-256"
{{% endif %}}

if grep -q "^MACs" /etc/ssh/sshd_config; then
sed -i "s/^MACs.*/# MACs hmac-sha2-512,hmac-sha2-256/" /etc/ssh/sshd_config
sed -i "s/^MACs.*/# MACs $sshd_approved_macs/" /etc/ssh/sshd_config
else
echo "# ciphers MACs hmac-sha2-512,hmac-sha2-256" >> /etc/ssh/sshd_config
echo "# ciphers MACs $sshd_approved_macs" >> /etc/ssh/sshd_config
fi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
# platform = multi_platform_ol,multi_platform_rhel,multi_platform_sle

if grep -q "^MACs" /etc/ssh/sshd_config; then
sed -i "s/^MACs.*/MACs hmac-sha2-512/" /etc/ssh/sshd_config
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/bin/bash

{{% if product == "ubuntu2204" %}}
sshd_approved_macs="hmac-sha2-512,[email protected],hmac-sha2-256,[email protected]"
{{% else %}}
sshd_approved_macs="hmac-sha2-512,hmac-sha2-256"
{{% endif %}}

if grep -q "^MACs" /etc/ssh/sshd_config; then
sed -i "s/^MACs.*/MACs hmac-sha2-512,hmac-sha2-256/" /etc/ssh/sshd_config
sed -i "s/^MACs.*/MACs $sshd_approved_macs/" /etc/ssh/sshd_config
else
echo 'MACs hmac-sha2-512,hmac-sha2-256' >> /etc/ssh/sshd_config
echo "MACs $sshd_approved_macs" >> /etc/ssh/sshd_config
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
# platforms = multi_platform_ubuntu

sshd_approved_macs="hmac-sha2-512,[email protected],hmac-sha2-256,[email protected]"

sed -i "/^MACs.*/d" /etc/ssh/sshd_config
sed -i "/^MACs.*/d" /etc/ssh/sshd_config.d/*
echo "MACs $sshd_approved_macs" >> /etc/ssh/sshd_config.d/test.conf

0 comments on commit 3f6d10d

Please sign in to comment.