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:
authorKepi <kepi@igloonet.cz>2020-07-02 19:22:03 +0300
committerKepi <kepi@igloonet.cz>2020-07-02 19:22:03 +0300
commit9d523959529363c93e183bb523e4c467eb931070 (patch)
tree883e5baea5b1bebdd728d22c9e08cdfe507a1d6c /include/tests_filesystems
parent1da058d6defcbfa4729b99526fdafcd1ae5295ce (diff)
[FILE-6430] Don't grep nonexistant modprobe.d files
We don't want to grep files in modprobe.d when dir is empty. Uses same approach as in USB-1000.
Diffstat (limited to 'include/tests_filesystems')
-rw-r--r--include/tests_filesystems15
1 files changed, 9 insertions, 6 deletions
diff --git a/include/tests_filesystems b/include/tests_filesystems
index fe4ae167..bfe451ab 100644
--- a/include/tests_filesystems
+++ b/include/tests_filesystems
@@ -830,12 +830,15 @@
AddHP 3 3
if IsDebug; then Display --indent 6 --text "- Module ${FS} not present in the kernel" --result OK --color GREEN; fi
fi
- FIND1=$(${EGREPBINARY} "blacklist ${FS}" ${ROOTDIR}etc/modprobe.d/* | ${GREPBINARY} -v "#")
- FIND2=$(${EGREPBINARY} "install ${FS} /bin/true" ${ROOTDIR}etc/modprobe.d/* | ${GREPBINARY} -v "#")
- if [ -n "${FIND1}" ] || [ -n "${FIND2}" ]; then
- Display --indent 4 --text "- Module $FS is blacklisted" --result "OK" --color GREEN
- LogText "Result: module ${FS} is blacklisted"
- fi
+ FIND=$(${LSBINARY} ${ROOTDIR}etc/modprobe.d/* 2> /dev/null)
+ if [ -n "${FIND}" ]; then
+ FIND1=$(${EGREPBINARY} "blacklist ${FS}" ${ROOTDIR}etc/modprobe.d/* | ${GREPBINARY} -v "#")
+ FIND2=$(${EGREPBINARY} "install ${FS} /bin/true" ${ROOTDIR}etc/modprobe.d/* | ${GREPBINARY} -v "#")
+ if [ -n "${FIND1}" ] || [ -n "${FIND2}" ]; then
+ Display --indent 4 --text "- Module $FS is blacklisted" --result "OK" --color GREEN
+ LogText "Result: module ${FS} is blacklisted"
+ fi
+ fi
done
if [ ${FOUND} -eq 1 ]; then
Display --indent 4 --text "- Discovered kernel modules: ${AVAILABLE_MODPROBE_FS}"