Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BOOT-5180 - runlevel debian Jessie #61

Closed
DocEmmetBrown opened this issue Jul 29, 2015 · 5 comments
Closed

BOOT-5180 - runlevel debian Jessie #61

DocEmmetBrown opened this issue Jul 29, 2015 · 5 comments
Assignees

Comments

@DocEmmetBrown
Copy link
Contributor

Hi,

Debian Jessie's default runlevel returns N 5, so the BOOT-5180 test returns that it couldn't determine runlevel.

an ugly tweak :

diff --git a/include/tests_boot_services b/include/tests_boot_services
index 5ce609f..f0aad2c 100644
--- a/include/tests_boot_services
+++ b/include/tests_boot_services
@@ -464,7 +464,7 @@
     Register --test-no BOOT-5180 --os Linux --preqs-met ${PREQS_MET} --weight L --network NO --description "Check for Linux boot services (Debian style)"
     if [ ${SKIPTEST} -eq 0 ]; then
         # Runlevel check
-        sRUNLEVEL=`${RUNLEVELBINARY} | grep "N 2"`
+        sRUNLEVEL=`${RUNLEVELBINARY} | grep "N [2,5]"`
         if [ ! "${sRUNLEVEL}" = "" ]; then
             FIND=`find /etc/rc2.d -type l -print | cut -d '/' -f4 | sed "s/S[0-9][0-9]//g" | sort`
             if [ ! "${FIND}" = "" ]; then

May be it could be nicer to test if debian version is >= 8.0 ;)

Cheers

@mboelen mboelen self-assigned this Aug 20, 2015
@mboelen
Copy link
Member

mboelen commented Aug 20, 2015

Related patch has been applied to improve detection. Can you test? (it should skip and show no longer a related message/suggestion)

@mboelen
Copy link
Member

mboelen commented Sep 8, 2015

@DocEmmetBrown did the patch work correctly for you?

@DocEmmetBrown
Copy link
Contributor Author

Hi @mboelen , sorry I didn't have time to test the patch yet. I promise I'll do it soon and get back to you ;-)

@mboelen
Copy link
Member

mboelen commented Sep 16, 2015

Closing the issue, to keep the list clean. If it does not work, please reopen this issue.

@mboelen mboelen closed this as completed Sep 16, 2015
@arcticlinux
Copy link

I'm not sure when I started seeing this message, I'm running Lynis on Ubuntu 18.04 I run the audit system from a cronjob and then grep the lynis-report.dat for suggestion entries.

Performing test ID BOOT-5180 (Check for Linux boot services (Debian style))

suggestion[]=BOOT-5180|Determine runlevel and services at startup|-|-|

The code is different now, but the result is similar. The runlevel returns 'N 5' which results in the "Determine runlevel and services at startup" message.

--- tests_boot_services.orig	2021-04-05 13:07:46.697907005 -0600
+++ tests_boot_services	2021-04-05 13:26:55.320215347 -0600
@@ -724,7 +724,7 @@
         # Runlevel check
         sRUNLEVEL=$(${RUNLEVELBINARY} | ${GREPBINARY} "N [0-9]" | ${AWKBINARY} '{ print $2} ')
         LogText "Result: found runlevel ${sRUNLEVEL}"
-        if [ "${sRUNLEVEL}" = "2" ]; then
+        if [ "${sRUNLEVEL}" = "2" ] || [ "${sRUNLEVEL}" = "5" ]; then
             LogText "Result: performing find in /etc/rc2.d as runlevel 2 is found"
             FIND=$(${FINDBINARY} ${ROOTDIR}etc/rc2.d -type l -print | ${CUTBINARY} -d '/' -f4 | ${SEDBINARY} "s/S[0-9][0-9]//g" | sort)
             if [ -n "${FIND}" ]; then

or:

--- tests_boot_services.orig	2021-04-05 13:07:46.697907005 -0600
+++ tests_boot_services	2021-04-05 13:07:25.322033166 -0600
@@ -724,16 +724,16 @@
         # Runlevel check
         sRUNLEVEL=$(${RUNLEVELBINARY} | ${GREPBINARY} "N [0-9]" | ${AWKBINARY} '{ print $2} ')
         LogText "Result: found runlevel ${sRUNLEVEL}"
-        if [ "${sRUNLEVEL}" = "2" ]; then
-            LogText "Result: performing find in /etc/rc2.d as runlevel 2 is found"
-            FIND=$(${FINDBINARY} ${ROOTDIR}etc/rc2.d -type l -print | ${CUTBINARY} -d '/' -f4 | ${SEDBINARY} "s/S[0-9][0-9]//g" | sort)
+        if [ "${sRUNLEVEL}" = "2" ] || [ "${sRUNLEVEL}" = "5" ]; then
+            LogText "Result: performing find in /etc/rc${sRUNLEVEL}.d as runlevel ${sRUNLEVEL} is found"
+            FIND=$(${FINDBINARY} ${ROOTDIR}etc/rc${sRUNLEVEL}.d -type l -print | ${CUTBINARY} -d '/' -f4 | ${SEDBINARY} "s/S[0-9][0-9]//g" | sort)
             if [ -n "${FIND}" ]; then
                 COUNT=0
                 for SERVICE in ${FIND}; do
-                    LogText "Found service (at boot, runlevel 2): ${SERVICE}"
+                    LogText "Found service (at boot, runlevel ${sRUNLEVEL}): ${SERVICE}"
                     COUNT=$((COUNT + 1))
                 done
-                Display --indent 2 --text "- Check services at startup (rc2.d)" --result "${STATUS_DONE}" --color WHITE
+                Display --indent 2 --text "- Check services at startup (rc${sRUNLEVEL}.d)" --result "${STATUS_DONE}" --color WHITE
                 Display --indent 4 --text "Result: found ${COUNT} services"
                 LogText "Result: found ${COUNT} services"
             fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants