-
Notifications
You must be signed in to change notification settings - Fork 706
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix tests in sshd_lineinfile template
In some cases the testing environment had existing non compliant configurations which made some test fail when they were expected to pass. This ensures that doesn't happen Signed-off-by: Edgar Aguilar <[email protected]>
- Loading branch information
Showing
6 changed files
with
19 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,3 @@ | ||
#!/bin/bash | ||
|
||
SSHD_PARAM={{{ PARAMETER }}} | ||
SSHD_VAL={{{ VALUE }}} | ||
|
||
mkdir -p /etc/ssh/sshd_config.d | ||
touch /etc/ssh/sshd_config.d/nothing | ||
|
||
if grep -q "^\s*${SSHD_PARAM}" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/* ; then | ||
sed -i "s/^${SSHD_PARAM}.*/# ${SSHD_PARAM} ${SSHD_VAL}/g" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/* | ||
else | ||
echo "# ${SSHD_PARAM} ${SSHD_VAL}" >> /etc/ssh/sshd_config | ||
fi | ||
source common.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
SSHD_PARAM={{{ PARAMETER }}} | ||
SSHD_VAL={{{ VALUE }}} | ||
|
||
mkdir -p /etc/ssh/sshd_config.d | ||
touch /etc/ssh/sshd_config.d/nothing | ||
|
||
if grep -q "^\s*${SSHD_PARAM}" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/* ; then | ||
sed -i "s/^${SSHD_PARAM}.*/# ${SSHD_PARAM} ${SSHD_VAL}/g" /etc/ssh/sshd_config /etc/ssh/sshd_config.d/* | ||
else | ||
echo "# ${SSHD_PARAM} ${SSHD_VAL}" >> /etc/ssh/sshd_config | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/bin/bash | ||
|
||
source common.sh | ||
|
||
{{{ bash_sshd_remediation(parameter=PARAMETER, value=VALUE, config_is_distributed=sshd_distributed_config) -}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters