mirror of
https://github.com/hardenedlinux/harbian-audit.git
synced 2025-07-31 01:24:58 +02:00
Modify is_service_enabled method for debian 9, and apply to 2.25.
This commit is contained in:
parent
c6a43f52c0
commit
5caa36d5af
@ -31,8 +31,16 @@ apply () {
|
|||||||
info "Checking if $SERVICE_NAME is enabled"
|
info "Checking if $SERVICE_NAME is enabled"
|
||||||
is_service_enabled $SERVICE_NAME
|
is_service_enabled $SERVICE_NAME
|
||||||
if [ $FNRET = 0 ]; then
|
if [ $FNRET = 0 ]; then
|
||||||
info "Disabling $SERVICE_NAME"
|
is_debian_9
|
||||||
update-rc.d $SERVICE_NAME remove > /dev/null 2>&1
|
if [ $FNRET = 0 ]; then
|
||||||
|
info "Disabling $SERVICE_NAME"
|
||||||
|
systemctl stop $SERVICE_NAME
|
||||||
|
systemctl disable $SERVICE_NAME
|
||||||
|
apt-get -y purge --autoremove $SERVICE_NAME
|
||||||
|
else
|
||||||
|
info "Disabling $SERVICE_NAME"
|
||||||
|
update-rc.d $SERVICE_NAME remove > /dev/null 2>&1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
ok "$SERVICE_NAME is disabled"
|
ok "$SERVICE_NAME is disabled"
|
||||||
fi
|
fi
|
||||||
|
48
lib/utils.sh
48
lib/utils.sh
@ -1,5 +1,21 @@
|
|||||||
# CIS Debian 7 Hardening Utility functions
|
# CIS Debian 7 Hardening Utility functions
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# debian version check
|
||||||
|
#
|
||||||
|
|
||||||
|
is_debian_9()
|
||||||
|
{
|
||||||
|
if $(cat /etc/debian_version | grep -q "^9.[0-9]"); then
|
||||||
|
debug "Debian version is 9.*."
|
||||||
|
FNRET=0
|
||||||
|
else
|
||||||
|
debug "Debian version is not 9.*."
|
||||||
|
FNRET=1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Sysctl
|
# Sysctl
|
||||||
#
|
#
|
||||||
@ -203,16 +219,26 @@ does_group_exist() {
|
|||||||
|
|
||||||
is_service_enabled() {
|
is_service_enabled() {
|
||||||
local SERVICE=$1
|
local SERVICE=$1
|
||||||
if [ $($SUDO_CMD find /etc/rc?.d/ -name "S*$SERVICE" -print | wc -l) -gt 0 ]; then
|
is_debian_9
|
||||||
debug "Service $SERVICE is enabled"
|
if [ $FNRET = 0 ]; then
|
||||||
FNRET=0
|
if [ $(systemctl is-enabled $SERVICE | grep -wc "^enabled") -eq 1 ]; then
|
||||||
|
debug "Service $SERVICE is enabled"
|
||||||
|
FNRET=0
|
||||||
|
else
|
||||||
|
debug "Service $SERVICE is disabled"
|
||||||
|
FNRET=1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
debug "Service $SERVICE is disabled"
|
if [ $($SUDO_CMD find /etc/rc?.d/ -name "S*$SERVICE" -print | wc -l) -gt 0 ]; then
|
||||||
FNRET=1
|
debug "Service $SERVICE is enabled"
|
||||||
|
FNRET=0
|
||||||
|
else
|
||||||
|
debug "Service $SERVICE is disabled"
|
||||||
|
FNRET=1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Kernel Options checks
|
# Kernel Options checks
|
||||||
#
|
#
|
||||||
@ -454,16 +480,6 @@ is_pkg_installed()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
is_debian_9()
|
|
||||||
{
|
|
||||||
if $(cat /etc/debian_version | grep -q "^9.[0-9]"); then
|
|
||||||
debug "Debian version is 9.*."
|
|
||||||
FNRET=0
|
|
||||||
else
|
|
||||||
debug "Debian version is not 9.*."
|
|
||||||
FNRET=1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
verify_integrity_all_packages()
|
verify_integrity_all_packages()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user