Fix some bugs for CentOS.
This commit is contained in:
parent
ed894c0b43
commit
6a4de4e4d5
|
@ -17,31 +17,53 @@ 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 [ $(dpkg -l | grep -c $VIRULSERVER) -ge 1 ]; then
|
if [ $OS_RELEASE -eq 1 ]; then
|
||||||
if [ $(systemctl | grep $VIRULSERVER | grep -c "active running") -ne 1 ]; then
|
if [ $(dpkg -l | grep -c $VIRULSERVER) -ge 1 ]; then
|
||||||
crit "$VIRULSERVER is not runing"
|
if [ $(systemctl | grep $VIRULSERVER | grep -c "active running") -ne 1 ]; then
|
||||||
FNRET=2
|
crit "$VIRULSERVER is not runing"
|
||||||
else
|
FNRET=2
|
||||||
ok "$VIRULSERVER is enable"
|
else
|
||||||
FNRET=0
|
ok "$VIRULSERVER is enable"
|
||||||
fi
|
FNRET=0
|
||||||
else
|
fi
|
||||||
crit "$VIRULSERVER is not installed"
|
else
|
||||||
FNRET=1
|
crit "$VIRULSERVER is not installed"
|
||||||
fi
|
FNRET=1
|
||||||
|
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 [ $FNRET = 0 ]; then
|
if [ $OS_RELEASE -eq 1 ]; then
|
||||||
ok "$VIRULSERVER is enable"
|
if [ $FNRET = 0 ]; then
|
||||||
elif [ $FNRET = 1 ]; then
|
ok "$VIRULSERVER is enable"
|
||||||
warn "Install $VIRULSERVER"
|
elif [ $FNRET = 1 ]; then
|
||||||
apt-get install -y $VIRULSERVER
|
warn "Install $VIRULSERVER"
|
||||||
else
|
apt-get install -y $VIRULSERVER
|
||||||
warn "Start server $VIRULSERVER"
|
else
|
||||||
systemctl start $VIRULSERVER
|
warn "Start server $VIRULSERVER"
|
||||||
fi
|
systemctl start $VIRULSERVER
|
||||||
|
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