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
ok "$PACKAGE is installed"
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
@ -35,7 +40,18 @@ apply () {
else
ok "$PACKAGE is installed"
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