mirror of
https://github.com/hardenedlinux/harbian-audit.git
synced 2025-07-30 17:15:45 +02:00
Add check iptables persistent function for 7.7.1
This commit is contained in:
parent
4a9704551a
commit
94c467485e
@ -19,6 +19,7 @@ HARDENING_LEVEL=2
|
|||||||
# Do as you want, but this script does not handle this
|
# Do as you want, but this script does not handle this
|
||||||
|
|
||||||
PACKAGES='iptables iptables-persistent'
|
PACKAGES='iptables iptables-persistent'
|
||||||
|
SERVICENAME='netfilter-persistent'
|
||||||
|
|
||||||
# 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 () {
|
||||||
@ -34,18 +35,30 @@ audit () {
|
|||||||
FNRET=0
|
FNRET=0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
if [ $FNRET = 0 ]; then
|
||||||
|
if [ $(systemctl status ${SERVICENAME} | grep -c "Active:.active") -ne 1 ]; then
|
||||||
|
crit "${SERVICENAME} service is not actived"
|
||||||
|
FNRET=2
|
||||||
|
else
|
||||||
|
ok "${SERVICENAME} service is actived"
|
||||||
|
FNRET=0
|
||||||
|
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 () {
|
||||||
if [ $FNRET = 0 ]; then
|
if [ $FNRET = 0 ]; then
|
||||||
ok "$PACKAGES is installed"
|
ok "$PACKAGES is installed"
|
||||||
else
|
elif [ $FNRET = 1 ]; then
|
||||||
for PACKAGE in $PACKAGES
|
for PACKAGE in $PACKAGES
|
||||||
do
|
do
|
||||||
warn "$PACKAGE is absent, installing it"
|
warn "$PACKAGE is absent, installing it"
|
||||||
apt_install $PACKAGE
|
apt_install $PACKAGE
|
||||||
done
|
done
|
||||||
|
elif [ $FNRET = 2 ]; then
|
||||||
|
warn "Enable ${SERVICENAME} service to actived"
|
||||||
|
systemctl start ${SERVICENAME}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user