From 349975103fae73567cec495d0c9bddcba9b2fc9d Mon Sep 17 00:00:00 2001 From: Johannes Segitz Date: Thu, 23 Feb 2023 13:17:25 +0100 Subject: [PATCH 1/2] tests_mac_frameworks: check for existance of semanage binary. It's not installed everywhere, causing this error message: /usr/share/lynis/include/tests_mac_frameworks: line 161: permissive: command not found /usr/share/lynis/include/tests_mac_frameworks: line 162: permissive: command not found --- include/tests_mac_frameworks | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/tests_mac_frameworks b/include/tests_mac_frameworks index cda343ad..ca454529 100644 --- a/include/tests_mac_frameworks +++ b/include/tests_mac_frameworks @@ -158,10 +158,14 @@ Display --indent 6 --text "- Checking current mode and config file" --result "${STATUS_WARNING}" --color RED fi Display --indent 8 --text "Current SELinux mode: ${FIND}" - PERMISSIVE=$(${SEMANAGEBINARY} permissive --list --noheading | ${TRBINARY} '\n' ' ') - NPERMISSIVE=$(${SEMANAGEBINARY} permissive --list --noheading | ${WCBINARY} -l) - Display --indent 8 --text "Found ${NPERMISSIVE} permissive SELinux object types" - LogText "Permissive SELinux object types: ${PERMISSIVE}" + if [ -x "$SEMANAGEBINARY" ]; then + PERMISSIVE=$(${SEMANAGEBINARY} permissive --list --noheading | ${TRBINARY} '\n' ' ') + NPERMISSIVE=$(${SEMANAGEBINARY} permissive --list --noheading | ${WCBINARY} -l) + Display --indent 8 --text "Found ${NPERMISSIVE} permissive SELinux object types" + LogText "Permissive SELinux object types: ${PERMISSIVE}" + else + LogText "Result: semanage binary NOT found, can't analyse permissive domains" + fi UNCONFINED=$(${PSBINARY} -eo label,pid,command | ${GREPBINARY} '[u]nconfined_t' | ${TRBINARY} '\n' ' ') INITRC=$(${PSBINARY} -eo label,pid,command | ${GREPBINARY} '[i]nitrc_t' | ${TRBINARY} '\n' ' ') NUNCONFINED=$(${PSBINARY} -eo label | ${GREPBINARY} '[u]nconfined_t' | ${WCBINARY} -l) From eeec52b1604ef850c7d8b63dab0a72bb197a3000 Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Tue, 14 May 2024 11:40:50 +0200 Subject: [PATCH 2/2] Update tests_mac_frameworks Changed check from is executable to is not empty --- include/tests_mac_frameworks | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/tests_mac_frameworks b/include/tests_mac_frameworks index ca454529..207a98f5 100644 --- a/include/tests_mac_frameworks +++ b/include/tests_mac_frameworks @@ -158,7 +158,7 @@ Display --indent 6 --text "- Checking current mode and config file" --result "${STATUS_WARNING}" --color RED fi Display --indent 8 --text "Current SELinux mode: ${FIND}" - if [ -x "$SEMANAGEBINARY" ]; then + if [ -n "${SEMANAGEBINARY}" ]; then PERMISSIVE=$(${SEMANAGEBINARY} permissive --list --noheading | ${TRBINARY} '\n' ' ') NPERMISSIVE=$(${SEMANAGEBINARY} permissive --list --noheading | ${WCBINARY} -l) Display --indent 8 --text "Found ${NPERMISSIVE} permissive SELinux object types"