Skip to content

Commit

Permalink
Fix to not stomp on /etc/crypto.conf
Browse files Browse the repository at this point in the history
  • Loading branch information
robertgendler committed Sep 12, 2024
1 parent 62a5b58 commit 7284274
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rules/os/os_ssh_server_alive_count_max_configure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ fix: |
config=$(/usr/bin/sudo -u $u /usr/bin/ssh -Gv . 2>&1 | /usr/bin/awk '/Reading configuration data/ {print $NF}'| /usr/bin/tr -d '\r')
configarray=( ${(f)config} )
for c in $configarray; do
if [[ "$c" == "/etc/ssh/crypto.conf" ]]; then
continue
fi
/usr/bin/sudo -u $u /usr/bin/grep -q '^ServerAliveCountMax' "$c" && /usr/bin/sed -i '' 's/.*ServerAliveCountMax.*/ServerAliveCountMax $ODV/' "$c" || /bin/echo 'ServerAliveCountMax $ODV' >> "$c"
done
done
Expand Down
3 changes: 3 additions & 0 deletions rules/os/os_ssh_server_alive_interval_configure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ fix: |
config=$(/usr/bin/sudo -u $u /usr/bin/ssh -Gv . 2>&1 | /usr/bin/awk '/Reading configuration data/ {print $NF}'| /usr/bin/tr -d '\r')
configarray=( ${(f)config} )
for c in $configarray; do
if [[ "$c" == "/etc/ssh/crypto.conf" ]]; then
continue
fi
/usr/bin/sudo -u $u /usr/bin/grep -q '^ServerAliveInterval' "$c" && /usr/bin/sed -i '' 's/.*ServerAliveInterval.*/ServerAliveInterval $ODV/' "$c" || /bin/echo 'ServerAliveInterval $ODV' >> "$c"
done
done
Expand Down

0 comments on commit 7284274

Please sign in to comment.