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:
Diffstat (limited to 'include/tests_boot_services')
-rw-r--r--include/tests_boot_services76
1 files changed, 71 insertions, 5 deletions
diff --git a/include/tests_boot_services b/include/tests_boot_services
index 8ad83d7c..01310f7b 100644
--- a/include/tests_boot_services
+++ b/include/tests_boot_services
@@ -22,7 +22,7 @@
#
#################################################################################
#
- InsertSection "Boot and services"
+ InsertSection "${SECTION_BOOT_AND_SERVICES}"
#
#################################################################################
#
@@ -139,6 +139,13 @@
SERVICE_MANAGER="launchd"
fi
;;
+ "Solaris")
+ if [ -n "${ROOTDIR}usr/bin/svcs" ]; then
+ SERVICE_MANAGER="SMF (svcs)"
+ elif [ -d "${ROOTDIR}etc/init.d" ]; then
+ SERVICE_MANAGER="SysV Init"
+ fi
+ ;;
*)
LogText "Result: unknown service manager"
;;
@@ -332,8 +339,12 @@
if [ ${SKIPTEST} -eq 0 ]; then
FOUND=0
- CONF_FILES=$(${FINDBINARY} /etc/grub.d -type f -name "[0-9][0-9]*" -print0 | ${TRBINARY} '\0' ' ' | ${TRBINARY} -d '[:cntrl:]')
- CONF_FILES="${GRUBCONFFILE} ${ROOTDIR}boot/grub/custom.cfg ${CONF_FILES}"
+ if [ -d "${ROOTDIR}etc/grub.d" ]; then
+ CONF_FILES=$(${FINDBINARY} "${ROOTDIR}etc/grub.d" -type f -name "[0-9][0-9]*" -print0 | ${TRBINARY} '\0' ' ' | ${TRBINARY} -d '[:cntrl:]')
+ CONF_FILES="${GRUBCONFFILE} ${ROOTDIR}boot/grub/custom.cfg ${CONF_FILES}"
+ else
+ CONF_FILES="${GRUBCONFFILE} ${ROOTDIR}boot/grub/custom.cfg"
+ fi
for FILE in ${CONF_FILES}; do
if [ -f "${FILE}" ]; then
@@ -583,6 +594,55 @@
#
#################################################################################
#
+ # Test : BOOT-5170
+ # Description : Check for Solaris boot daemons
+ Register --test-no BOOT-5170 --os Solaris --weight L --network NO --category security --description "Check for Solaris boot daemons"
+ if [ ${SKIPTEST} -eq 0 ]; then
+ if [ -n "${SVCSBINARY}" ]; then
+ LogText "Result: Using svcs binary to check for daemons"
+ LogText "SysV style services may be incorrectly counted as running."
+
+ Report "running_service_tool=svcs"
+
+ # For the documentation of the states (field $1) see
+ # "Managing System Services in Oracle Solaris 11.4" pp. 24, available
+ # at https://docs.oracle.com/cd/E37838_01/pdf/E60998.pdf
+
+ FIND=$("${SVCSBINARY}" -Ha | ${AWKBINARY} '{ if ($1 == "online" || $1 == "legacy_run") print $3 }')
+ COUNT=0
+ for ITEM in ${FIND}; do
+ LogText "Found running daemon: ${ITEM}"
+ Report "running_service[]=${ITEM}"
+ COUNT=$((COUNT + 1 ))
+ done
+ Display --indent 2 --text "- Check running daemons (svcs)" --result "${STATUS_DONE}" --color GREEN
+ Display --indent 8 --text "Result: found ${COUNT} running daemons"
+ LogText "Result: Found ${COUNT} running daemons"
+
+ LogText "Searching for enabled daemons (svcs)"
+ Report "boot_service_tool=svcs"
+
+ FIND=$("${SVCSBINARY}" -Ha | ${AWKBINARY} '{ if ($1 != "disabled" && $1 != "uninitialized") print $3 }')
+ COUNT=0
+ for ITEM in ${FIND}; do
+ LogText "Found enabled daemon at boot: ${ITEM}"
+ Report "boot_service[]=${ITEM}"
+ COUNT=$((COUNT + 1 ))
+ done
+ LogText "Note: Run svcs -a see all services"
+ Display --indent 2 --text "- Check enabled daemons at boot (svcs)" --result "${STATUS_DONE}" --color GREEN
+ Display --indent 8 --text "Result: found ${COUNT} enabled daemons at boot"
+ LogText "Result: Found ${COUNT} enabled daemons at boot"
+ fi
+ fi
+#
+#################################################################################
+#
+ # Test : BOOT-5171
+ # Description : Check for services with errors on solaris
+#
+#################################################################################
+#
# Test : BOOT-5177
# Description : Check for Linux boot services (systemd and chkconfig)
# Notes : We skip using chkconfig if systemd is being used.
@@ -652,7 +712,13 @@
# Test : BOOT-5180
# Description : Check for Linux boot services (Debian style)
# Notes : Debian 8+ shows runlevel 5
- if [ "${LINUX_VERSION}" = "Debian" -o "${LINUX_VERSION}" = "Ubuntu" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
+ if [ "${LINUX_VERSION}" = "Debian" ] || [ "${LINUX_VERSION}" = "Ubuntu" ] ||
+ [ "${LINUX_VERSION_LIKE}" = "Debian" ] || [ "${LINUX_VERSION_LIKE}" = "Ubuntu" ]; then
+ PREQS_MET="YES"
+ else
+ PREQS_MET="NO"
+ fi
+
Register --test-no BOOT-5180 --os Linux --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check for Linux boot services (Debian style)"
if [ ${SKIPTEST} -eq 0 ]; then
# Runlevel check
@@ -682,7 +748,7 @@
#
# Test : BOOT-5184
# Description : Check world writable startup scripts
- Register --test-no BOOT-5184 --os Linux --weight L --network NO --category security --description "Check permissions for boot files/scripts"
+ Register --test-no BOOT-5184 --os "Linux Solaris" --weight L --network NO --category security --description "Check permissions for boot files/scripts"
if [ ${SKIPTEST} -eq 0 ]; then
FOUND=0
CHECKDIRS="${ROOTDIR}etc/init.d ${ROOTDIR}etc/rc.d ${ROOTDIR}etc/rcS.d"