Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Boelen <michael@cisofy.com>2015-09-17 00:35:54 +0300
committerMichael Boelen <michael@cisofy.com>2015-09-17 00:35:54 +0300
commit14a79d8a63940a2e4683d7ac9354313201db68c5 (patch)
tree0f5de11352f0c5d641018252e7ba52959f59b07f
parent32226d145fd561f8aadb218956bda99cc120fbad (diff)
parentf11783dbdf4460317e8df7f975a15d5e9cd73bd2 (diff)
Merge pull request #78 from rsmith-nl/freebsd-services
Improvements for FreeBSD services
-rw-r--r--include/binaries1
-rw-r--r--include/tests_boot_services18
2 files changed, 13 insertions, 6 deletions
diff --git a/include/binaries b/include/binaries
index a27912e1..a6af374b 100644
--- a/include/binaries
+++ b/include/binaries
@@ -162,6 +162,7 @@
salt-master) SALTMASTERFOUND=1; SALTMASTERBINARY="${BINARY}"; logtext " Found known binary: salt-master (SaltStack master) - ${BINARY}" ;;
salt-minion) SALTMINIONFOUND=1; SALTMINIONBINARY="${BINARY}"; logtext " Found known binary: salt-minion (SaltStack client) - ${BINARY}" ;;
samhain) SAMHAINFOUND=1; SAMHAINBINARY="${BINARY}"; logtext " Found known binary: samhain (integrity tool) - ${BINARY}" ;;
+ service) SERVICEFOUND=1; SERVICEBINARY="${BINARY}"; logtext " Found known binary: service (system services) - ${BINARY}" ;;
sestatus) SESTATUSFOUND=1; SESTATUSBINARY="${BINARY}"; logtext " Found known binary: sestatus (SELinux client) - ${BINARY}" ;;
slocate) LOCATEFOUND=1; LOCATEBINARY="${BINARY}"; logtext " Found known binary: slocate (file database) - ${BINARY}" ;;
smbd) SMBDFOUND=1; SMBDBINARY="${BINARY}"; if [ "${OS}" = "MacOS" ]; then SMBDVERSION="unknown"; else SMBDVERSION=`${BINARY} -V | grep "^Version" | awk '{ print $2 }'`; fi; logtext "Found ${BINARY} (version ${SMBDVERSION})" ;;
diff --git a/include/tests_boot_services b/include/tests_boot_services
index 40f97dce..fcc0d712 100644
--- a/include/tests_boot_services
+++ b/include/tests_boot_services
@@ -101,7 +101,7 @@
if [ -f /usr/bin/init-openrc ]; then SERVICE_MANAGER="openrc"; fi
fi
;;
- "DragonFly"|"NetBSD")
+ "DragonFly"|"NetBSD"|"FreeBSD")
if [ -x /sbin/init -a -d /etc/rc.d -a -f /etc/rc ]; then
SERVICE_MANAGER="bsdrc"
fi
@@ -446,16 +446,22 @@
# Description : Check for FreeBSD boot services
Register --test-no BOOT-5165 --os FreeBSD --weight L --network NO --description "Check for FreeBSD boot services"
if [ ${SKIPTEST} -eq 0 ]; then
- # FreeBSD (Read /etc/rc.conf file for enabled services)
- logtext "Searching for services at startup (rc.conf)"
- FIND=`egrep -v -i '^#|none' /etc/rc.conf | egrep -i '_enable.*(yes|on|1)' | sort | awk -F= '{ print $1 }' | sed 's/_enable//'`
+ if [ ! "${SERVICEBINARY}" = "" ]; then
+ # FreeBSD (Ask services(8) for enabled services)
+ logtext "Searching for services at startup (service)"
+ FIND=`${SERVICEBINARY} -e | sed 's|^.*\/||' | sort`
+ else
+ # FreeBSD (Read /etc/rc.conf file for enabled services)
+ logtext "Searching for services at startup (rc.conf)"
+ FIND=`egrep -v -i '^#|none' /etc/rc.conf | egrep -i '_enable.*(yes|on|1)' | sort | awk -F= '{ print $1 }' | sed 's/_enable//'`
+ fi
N=0
for I in ${FIND}; do
- logtext "Found service (rc.conf): ${I}"
+ logtext "Found service (service/rc.conf): ${I}"
report "boottask[]=${I}"
N=`expr ${N} + 1`
done
- Display --indent 2 --text "- Checking services at startup (rc.conf)" --result "DONE" --color GREEN
+ Display --indent 2 --text "- Checking services at startup (service/rc.conf)" --result "DONE" --color GREEN
Display --indent 6 --text "Result: found $N services/options set"
logtext "Found $N services/options to run at startup"
fi