Modify aide audit methods for debian 9

This commit is contained in:
Samson-W 2018-11-20 03:02:44 -05:00
parent 2b50f8ddf8
commit 35b75f0779
2 changed files with 17 additions and 20 deletions

View File

@ -29,15 +29,15 @@ audit () {
# 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
apply () { apply () {
is_pkg_installed $PACKAGE is_pkg_installed $PACKAGE
if [ $FNRET = 0 ]; then if [ $FNRET = 0 ]; then
ok "$PACKAGE is installed" ok "$PACKAGE is installed"
else else
crit "$PACKAGE is absent, installing it" crit "$PACKAGE is absent, installing it"
apt_install $PACKAGE apt_install $PACKAGE
aideinit aideinit
info "${PACKAGE} is now installed but not fully functionnal, please see readme to go further" info "${PACKAGE} is now installed but not fully functionnal, please see readme to go further"
fi fi
} }
# This function will check config parameters required # This function will check config parameters required

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# #
# harbian audit 9 Hardening # harbian audit 9 Hardening
# #
# #
@ -15,28 +15,25 @@ set -u # One variable unset, it's over
HARDENING_LEVEL=4 HARDENING_LEVEL=4
FILES='/etc/crontab /etc/cron.d/*' FILES='/etc/cron.daily/aide'
PATTERN='/usr/bin/aide.wrapper --check'
# This function will be called if the script status is on enabled / audit mode # This function will be called if the script status is on enabled / audit mode
audit () { audit () {
does_pattern_exist_in_file "$FILES" "$PATTERN" if [ -x ${FILES} ]; then
if [ $FNRET != 0 ]; then ok "$FILES is exist."
crit "$PATTERN is not present in $FILES" FNRET=0
FNRET=1
else else
ok "$PATTERN is present in $FILES" crit "$FILES is not exist."
FNRET=0 FNRET=1
fi fi
} }
# 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
apply () { apply () {
if [ $FNRET != 0 ]; then if [ $FNRET != 0 ]; then
warn "$PATTERN is not present in $FILES, setting aide cron" warn "$FILES is not exist, so need to manual check"
echo "0 10 * * * ${PATTERN} > /dev/null 2>&1 " > /etc/cron.d/CIS_8.3.2_aide
else else
ok "$PATTERN is present in $FILES" ok "$FILES is exist "
fi fi
} }