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

View File

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