Fix some bugs.

This commit is contained in:
Samson-W 2019-05-21 11:43:16 +08:00
parent 7305b2c770
commit cfd14ce818
7 changed files with 101 additions and 76 deletions

View File

@ -40,7 +40,7 @@ audit () {
if [ $FNRET = 0 ]; then
ok "$OPTIONNAME set condition is $CONDT_VAL"
else
crit "$OPTIONNAME set condition is not $CONDT_VAL"
crit "$OPTIONNAME set condition is not equal or greater than $CONDT_VAL"
fi
else
crit "$PATTERN is not present in $FILE"

View File

@ -15,7 +15,7 @@ set -u # One variable unset, it's over
HARDENING_LEVEL=1
FILE='/etc/group-'
PERMISSIONS='644'
PERMISSIONS='600'
USER='root'
GROUP='root'

View File

@ -15,7 +15,7 @@ set -u # One variable unset, it's over
HARDENING_LEVEL=1
FILE='/etc/gshadow-'
PERMISSIONS='640'
PERMISSIONS='600'
USER='root'
GROUP='shadow'

View File

@ -15,7 +15,7 @@ set -u # One variable unset, it's over
HARDENING_LEVEL=1
FILE='/etc/passwd-'
PERMISSIONS='644'
PERMISSIONS='600'
USER='root'
GROUP='root'

View File

@ -15,7 +15,7 @@ set -u # One variable unset, it's over
HARDENING_LEVEL=1
FILE='/etc/shadow-'
PERMISSIONS='640'
PERMISSIONS='600'
USER='root'
GROUP='shadow'

View File

@ -16,9 +16,15 @@ HARDENING_LEVEL=3
PERMISSIONS='640'
USER='root'
GROUP='adm'
SERVICE_NAME_R="rsyslog"
# This function will be called if the script status is on enabled / audit mode
audit () {
is_pkg_installed $SERVICE_NAME_R
if [ $FNRET = 0 ]; then
ok "$SERVICE_NAME_R has installed, so pass."
FNRET=0
else
does_file_exist "$SYSLOG_BASEDIR/syslog-ng.conf"
if [ $FNRET != 0 ]; then
warn "$SYSLOG_BASEDIR/syslog-ng.conf is not exist! "
@ -45,10 +51,16 @@ audit () {
fi
done
fi
fi
}
# This function will be called if the script status is on enabled mode
apply () {
is_pkg_installed $SERVICE_NAME_R
if [ $FNRET = 0 ]; then
ok "$SERVICE_NAME_R has installed, so pass."
FNRET=0
else
does_file_exist "$SYSLOG_BASEDIR/syslog-ng.conf"
if [ $FNRET != 0 ]; then
warn "$SYSLOG_BASEDIR/syslog-ng.conf is not exist! "
@ -76,6 +88,7 @@ apply () {
fi
done
fi
fi
}
# This function will create the config file for this check with default values

View File

@ -5,18 +5,23 @@
#
#
# 8.3.5 Configure rsyslog to Send Logs to a Remote Log Host (Not Scored)
# 8.3.5 Configure syslog-ng to Send Logs to a Remote Log Host (Not Scored)
#
set -e # One error, it's over
set -u # One variable unset, it's over
HARDENING_LEVEL=3
SERVICE_NAME_R="rsyslog"
PATTERN='^destination.*(tcp|udp)[[:space:]]*\([[:space:]]*\".*\"[[:space:]]*\)'
# This function will be called if the script status is on enabled / audit mode
audit () {
is_pkg_installed $SERVICE_NAME_R
if [ $FNRET = 0 ]; then
ok "$SERVICE_NAME_R has installed, so pass."
FNRET=0
else
if [ -d "$SYSLOG_BASEDIR" ]; then
FILES="$SYSLOG_BASEDIR/syslog-ng.conf $SYSLOG_BASEDIR/conf.d/*"
does_pattern_exist_in_file "$FILES" "$PATTERN"
@ -29,10 +34,16 @@ audit () {
warn "$SYSLOG_BASEDIR is not exist!"
FNRET=1
fi
fi
}
# This function will be called if the script status is on enabled mode
apply () {
is_pkg_installed $SERVICE_NAME_R
if [ $FNRET = 0 ]; then
ok "$SERVICE_NAME_R has installed, so pass."
FNRET=0
else
if [ $FNRET = 1 ]; then
warn "$SYSLOG_BASEDIR is not exist!"
else
@ -44,6 +55,7 @@ apply () {
ok "$PATTERN is present in $FILES"
fi
fi
fi
}
# This function will create the config file for this check with default values