From 5074c5a8bd198cc7796b8f32e83cbd68167cfedb Mon Sep 17 00:00:00 2001 From: Charles Herlin Date: Fri, 25 Oct 2019 16:03:11 +0200 Subject: [PATCH] FIX(2.2.12) handle smbd as a service --- bin/hardening/2.2.12_disable_samba.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/bin/hardening/2.2.12_disable_samba.sh b/bin/hardening/2.2.12_disable_samba.sh index 2a5dd31..ef3390a 100755 --- a/bin/hardening/2.2.12_disable_samba.sh +++ b/bin/hardening/2.2.12_disable_samba.sh @@ -15,7 +15,8 @@ HARDENING_LEVEL=3 DESCRIPTION="Ensure Samba is not enabled." HARDENING_EXCEPTION=samba -PACKAGES='samba smbd' +PACKAGES='samba' +SERVICE='smbd' # This function will be called if the script status is on enabled / audit mode audit () { @@ -27,6 +28,12 @@ audit () { ok "$PACKAGE is absent" fi done + is_service_enabled $SERVICE + if [ $FNRET = 1 ]; then + crit "Service $SERVICE is enabled!" + else + ok "Service $SERVICE is disabled" + fi } # This function will be called if the script status is on enabled mode @@ -41,6 +48,13 @@ apply () { ok "$PACKAGE is absent" fi done + is_service_enabled $SERVICE + if [ $FNRET = 1 ]; then + crit "Service $SERVICE is enabled!" + systemctl disable $SERVICE + else + ok "Service $SERVICE is disabled" + fi } # This function will check config parameters required