Fix a bug for 8.2.5: when syslog-ng has installed, pass this check item.

This commit is contained in:
Samson-W 2019-05-14 17:48:49 +08:00
parent efb9efafdc
commit b762376882
1 changed files with 25 additions and 14 deletions

View File

@ -15,27 +15,38 @@ set -u # One variable unset, it's over
HARDENING_LEVEL=3 HARDENING_LEVEL=3
PATTERN='^*.*[^I][^I]*@' PATTERN='^*.*[^I][^I]*@'
PACKAGE_NG='syslog-ng'
# 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 () {
FILES="$SYSLOG_BASEDIR/rsyslog.conf $SYSLOG_BASEDIR/rsyslog.d/*.conf" is_pkg_installed $PACKAGE_NG
does_pattern_exist_in_file "$FILES" "$PATTERN" if [ $FNRET = 0 ]; then
if [ $FNRET != 0 ]; then ok "$PACKAGE_NG has installed, so pass."
crit "$PATTERN is not present in $FILES" else
else FILES="$SYSLOG_BASEDIR/rsyslog.conf $SYSLOG_BASEDIR/rsyslog.d/*.conf"
ok "$PATTERN is present in $FILES" does_pattern_exist_in_file "$FILES" "$PATTERN"
fi if [ $FNRET != 0 ]; then
crit "$PATTERN is not present in $FILES"
else
ok "$PATTERN is present in $FILES"
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 () {
FILES="$SYSLOG_BASEDIR/rsyslog.conf $SYSLOG_BASEDIR/rsyslog.d/*.conf" is_pkg_installed $PACKAGE_NG
does_pattern_exist_in_file "$FILES" "$PATTERN" if [ $FNRET = 0 ]; then
if [ $FNRET != 0 ]; then ok "$PACKAGE_NG has installed, so pass."
crit "$PATTERN is not present in $FILES, please manual operation set a remote host to send your logs" else
else FILES="$SYSLOG_BASEDIR/rsyslog.conf $SYSLOG_BASEDIR/rsyslog.d/*.conf"
ok "$PATTERN is present in $FILES" does_pattern_exist_in_file "$FILES" "$PATTERN"
fi if [ $FNRET != 0 ]; then
crit "$PATTERN is not present in $FILES, please manual operation set a remote host to send your logs"
else
ok "$PATTERN is present in $FILES"
fi
fi
} }
# This function will create the config file for this check with default values # This function will create the config file for this check with default values