Fix some bugs for CentOS.
This commit is contained in:
parent
ed894c0b43
commit
6a4de4e4d5
|
@ -17,6 +17,7 @@ VIRULSERVER='clamav-daemon'
|
||||||
|
|
||||||
# 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 () {
|
||||||
|
if [ $OS_RELEASE -eq 1 ]; then
|
||||||
if [ $(dpkg -l | grep -c $VIRULSERVER) -ge 1 ]; then
|
if [ $(dpkg -l | grep -c $VIRULSERVER) -ge 1 ]; then
|
||||||
if [ $(systemctl | grep $VIRULSERVER | grep -c "active running") -ne 1 ]; then
|
if [ $(systemctl | grep $VIRULSERVER | grep -c "active running") -ne 1 ]; then
|
||||||
crit "$VIRULSERVER is not runing"
|
crit "$VIRULSERVER is not runing"
|
||||||
|
@ -29,10 +30,20 @@ audit () {
|
||||||
crit "$VIRULSERVER is not installed"
|
crit "$VIRULSERVER is not installed"
|
||||||
FNRET=1
|
FNRET=1
|
||||||
fi
|
fi
|
||||||
|
elif [ $OS_RELEASE -eq 2 ]; then
|
||||||
|
if [ $(rpm -qa | grep -c clamd) -ge 1 ]; then
|
||||||
|
ok "Clamav is installed"
|
||||||
|
else
|
||||||
|
crit "Clamav is not install"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
crit "Current OS is not support!"
|
||||||
|
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 [ $OS_RELEASE -eq 1 ]; then
|
||||||
if [ $FNRET = 0 ]; then
|
if [ $FNRET = 0 ]; then
|
||||||
ok "$VIRULSERVER is enable"
|
ok "$VIRULSERVER is enable"
|
||||||
elif [ $FNRET = 1 ]; then
|
elif [ $FNRET = 1 ]; then
|
||||||
|
@ -42,6 +53,17 @@ apply () {
|
||||||
warn "Start server $VIRULSERVER"
|
warn "Start server $VIRULSERVER"
|
||||||
systemctl start $VIRULSERVER
|
systemctl start $VIRULSERVER
|
||||||
fi
|
fi
|
||||||
|
elif [ $OS_RELEASE -eq 2 ]; then
|
||||||
|
if [ $FNRET = 0 ]; then
|
||||||
|
ok "$VIRULSERVER is enable"
|
||||||
|
elif [ $FNRET = 1 ]; then
|
||||||
|
warn "Install $VIRULSERVER"
|
||||||
|
yum install -y $VIRULSERVER
|
||||||
|
else
|
||||||
|
warn "Start server $VIRULSERVER"
|
||||||
|
systemctl start $VIRULSERVER
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function will check config parameters required
|
# This function will check config parameters required
|
||||||
|
|
|
@ -16,8 +16,7 @@ HARDENING_LEVEL=4
|
||||||
CLAMAVCONF_DIR='/etc/clamav/clamd.conf'
|
CLAMAVCONF_DIR='/etc/clamav/clamd.conf'
|
||||||
UPDATE_SERVER='clamav-freshclam'
|
UPDATE_SERVER='clamav-freshclam'
|
||||||
|
|
||||||
# This function will be called if the script status is on enabled / audit mode
|
audit_debian () {
|
||||||
audit () {
|
|
||||||
UPDATE_DIR=$(grep -i databasedirectory "$CLAMAVCONF_DIR" | awk '{print $2}')
|
UPDATE_DIR=$(grep -i databasedirectory "$CLAMAVCONF_DIR" | awk '{print $2}')
|
||||||
if [ -d $UPDATE_DIR -a -e $CLAMAVCONF_DIR ]; then
|
if [ -d $UPDATE_DIR -a -e $CLAMAVCONF_DIR ]; then
|
||||||
NOWTIME=$(date +"%s")
|
NOWTIME=$(date +"%s")
|
||||||
|
@ -37,8 +36,23 @@ audit () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# This function will be called if the script status is on enabled mode
|
# todo
|
||||||
apply () {
|
audit_redhat () {
|
||||||
|
:
|
||||||
|
}
|
||||||
|
|
||||||
|
# This function will be called if the script status is on enabled / audit mode
|
||||||
|
audit () {
|
||||||
|
if [ $OS_RELEASE -eq 1 ]; then
|
||||||
|
audit_debian
|
||||||
|
elif [ $OS_RELEASE -eq 1 ]; then
|
||||||
|
audit_redhat
|
||||||
|
else
|
||||||
|
crit "Current OS is not support!"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
apply_debian () {
|
||||||
if [ $FNRET = 0 ]; then
|
if [ $FNRET = 0 ]; then
|
||||||
ok "Clamav database file has a date less than seven days from the current date"
|
ok "Clamav database file has a date less than seven days from the current date"
|
||||||
elif [ $FNRET = 2 ]; then
|
elif [ $FNRET = 2 ]; then
|
||||||
|
@ -50,6 +64,22 @@ apply () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# todo
|
||||||
|
apply_redhat () {
|
||||||
|
:
|
||||||
|
}
|
||||||
|
|
||||||
|
# This function will be called if the script status is on enabled mode
|
||||||
|
apply () {
|
||||||
|
if [ $OS_RELEASE -eq 1 ]; then
|
||||||
|
apply_debian
|
||||||
|
elif [ $OS_RELEASE -eq 1 ]; then
|
||||||
|
apply_redhat
|
||||||
|
else
|
||||||
|
crit "Current OS is not support!"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# This function will check config parameters required
|
# This function will check config parameters required
|
||||||
check_config() {
|
check_config() {
|
||||||
:
|
:
|
||||||
|
|
|
@ -160,6 +160,7 @@ has_file_correct_permissions() {
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
FNRET=1
|
FNRET=1
|
||||||
|
info "$FILE is not exist!"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue