IMP(4.5): rename to 1.6.1.2 improve test

This commit is contained in:
Thibault Ayanides 2020-11-06 11:09:22 +01:00
parent b5865947ba
commit ce1e87b1a3
3 changed files with 32 additions and 12 deletions

View File

@ -24,7 +24,12 @@ audit () {
else else
ok "$PACKAGE is installed" ok "$PACKAGE is installed"
fi fi
: RESULT=$($SUDO_CMD grep "^\s*linux" /boot/grub/grub.cfg)
for line in $RESULT; do
if [[ ! $line =~ "apparmor=1" ]] || [[ ! $line =~ "security=apparmor" ]]; then
crit "$line is not configured"
fi
done
} }
# This function will be called if the script status is on enabled mode # This function will be called if the script status is on enabled mode
@ -35,7 +40,18 @@ apply () {
else else
ok "$PACKAGE is installed" ok "$PACKAGE is installed"
fi fi
: ERROR=0
RESULT=$($SUDO_CMD grep "^\s*linux" /boot/grub/grub.cfg)
for line in $RESULT; do
if [[ ! $line =~ "apparmor=1" ]] || [[ ! $line =~ "security=apparmor" ]]; then
crit "$line is not configured"
ERROR=1
fi
done
if [ $ERROR = 1 ]; then
$SUDO_CMD sed -i "s/GRUB_CMDLINE_LINUX=\"/GRUB_CMDLINE_LINUX=\"apparmor=1 security=apparmor\/"
fi
$SUDO_CMD update-grub
} }
# This function will check config parameters required # This function will check config parameters required

View File

@ -0,0 +1,14 @@
# run-shellcheck
test_audit() {
if [ -f "/.dockerenv" ]; then
skip "SKIPPED on docker"
else
describe Running on blank host
register_test retvalshouldbe 0
dismiss_count_for_test
# shellcheck disable=2154
run blank /opt/debian-cis/bin/hardening/"${script}".sh --audit-all
# TODO fill comprehensive tests
fi
}

View File

@ -1,10 +0,0 @@
# run-shellcheck
test_audit() {
describe Running on blank host
register_test retvalshouldbe 0
dismiss_count_for_test
# shellcheck disable=2154
run blank /opt/debian-cis/bin/hardening/"${script}".sh --audit-all
# TODO fill comprehensive tests
}