mirror of
https://github.com/ovh/debian-cis.git
synced 2024-12-22 14:05:23 +01:00
IMP(9.3.2): Comply with Debian9 guide: verbose ssh loglevel
This commit is contained in:
parent
7b8e359590
commit
8031c388c6
@ -19,6 +19,7 @@ DESCRIPTION="Set LogLevel to INFO for SSH."
|
||||
|
||||
PACKAGE='openssh-server'
|
||||
OPTIONS=''
|
||||
OPTIONS_TO_APPLY=''
|
||||
FILE='/etc/ssh/sshd_config'
|
||||
|
||||
# This function will be called if the script status is on enabled / audit mode
|
||||
@ -32,7 +33,7 @@ audit () {
|
||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
||||
if [ "$FNRET" = 0 ]; then
|
||||
ok "$PATTERN is present in $FILE"
|
||||
else
|
||||
@ -51,11 +52,11 @@ apply () {
|
||||
crit "$PACKAGE is absent, installing it"
|
||||
apt_install $PACKAGE
|
||||
fi
|
||||
for SSH_OPTION in $OPTIONS; do
|
||||
for SSH_OPTION in $OPTIONS_TO_APPLY; do
|
||||
SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
|
||||
SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
|
||||
PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
|
||||
does_pattern_exist_in_file $FILE "$PATTERN"
|
||||
does_pattern_exist_in_file_nocase $FILE "$PATTERN"
|
||||
if [ "$FNRET" = 0 ]; then
|
||||
ok "$PATTERN is present in $FILE"
|
||||
else
|
||||
@ -78,7 +79,8 @@ create_config() {
|
||||
# shellcheck disable=2034
|
||||
status=audit
|
||||
# Put here your loglevel for ssh
|
||||
OPTIONS='LogLevel=INFO'
|
||||
OPTIONS='LogLevel=(INFO|VERBOSE)'
|
||||
OPTIONS_TO_APPLY='LogLevel=VERBOSE'
|
||||
EOF
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ test_audit() {
|
||||
run resolved /opt/debian-cis/bin/hardening/"${script}".sh --audit-all
|
||||
|
||||
echo "OPTIONS='LogLevel=DEBUG'" >> /opt/debian-cis/etc/conf.d/"${script}".cfg
|
||||
sed -i 's/LogLevel INFO/LogLevel DEBUG/' /etc/ssh/sshd_config
|
||||
sed -i 's/LogLevel VERBOSE/LogLevel DEBUG/' /etc/ssh/sshd_config
|
||||
|
||||
describe Checking custom conf
|
||||
register_test retvalshouldbe 0
|
||||
|
Loading…
Reference in New Issue
Block a user