Add method of analogons pakeage check for 6.5: Configure Network Time Protocol.

This commit is contained in:
samson 2019-04-02 03:29:00 +08:00
parent 2ac2c2538b
commit e17aab2467

View File

@ -6,6 +6,7 @@
#
# 6.5 Configure Network Time Protocol (NTP) (Scored)
# Modify Author : Samson wen, Samson <sccxboy@gmail.com>
#
set -e # One error, it's over
@ -14,6 +15,7 @@ set -u # One variable unset, it's over
HARDENING_LEVEL=3
HARDENING_EXCEPTION=ntp
ANALOGONS_PKG='chrony'
PACKAGE='ntp'
NTP_CONF_DEFAULT_PATTERN='^restrict -4 default (kod nomodify notrap nopeer noquery|ignore)'
NTP_CONF_FILE='/etc/ntp.conf'
@ -22,6 +24,10 @@ NTP_INIT_FILE='/etc/init.d/ntp'
# This function will be called if the script status is on enabled / audit mode
audit () {
is_pkg_installed $ANALOGONS_PKG
if [ $FNRET = 0 ]; then
ok "Analogons pagkage is installed."
else
is_pkg_installed $PACKAGE
if [ $FNRET != 0 ]; then
crit "$PACKAGE is not installed!"
@ -40,10 +46,15 @@ audit () {
ok "$NTP_INIT_PATTERN found in $NTP_INIT_FILE"
fi
fi
fi
}
# This function will be called if the script status is on enabled mode
apply () {
is_pkg_installed $ANALOGONS_PKG
if [ $FNRET = 0 ]; then
ok "Analogons pagkage is installed."
else
is_pkg_installed $PACKAGE
if [ $FNRET = 0 ]; then
ok "$PACKAGE is installed"
@ -68,6 +79,7 @@ apply () {
else
ok "$NTP_INIT_PATTERN found in $NTP_INIT_FILE"
fi
fi
}
# This function will check config parameters required