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.boelen@cisofy.com>2017-04-23 21:06:54 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2017-04-23 21:06:54 +0300
commit70ea29483a5fcb82ddc89d656227194560b502f2 (patch)
treed90db794f0ae7419b81e2b466ec017565ca176eb /include/tests_storage
parent9e9b95e1daf9d64d7753d37b48e88697b297fa36 (diff)
Code enhancements
Diffstat (limited to 'include/tests_storage')
-rw-r--r--include/tests_storage46
1 files changed, 23 insertions, 23 deletions
diff --git a/include/tests_storage b/include/tests_storage
index 8f9c91cd..ca5346c6 100644
--- a/include/tests_storage
+++ b/include/tests_storage
@@ -35,21 +35,21 @@
FOUND=0
LogText "Test: Checking USB storage driver in directory /etc/modprobe.d and configuration file /etc/modprobe.conf"
if [ -d /etc/modprobe.d ]; then
- FIND=$(ls /etc/modprobe.d/* 2> /dev/null)
- if [ ! "${FIND}" = "" ]; then
- FIND=$(${EGREPBINARY} -r "install usb[-_]storage /bin/(false|true)" /etc/modprobe.d/* | ${GREPBINARY} -v "#")
- FIND2=$(${EGREPBINARY} -r "^blacklist usb[-_]storage" /etc/modprobe.d/*)
- if [ ! "${FIND}" = "" -o ! "${FIND2}" = "" ]; then
+ FIND=$(${LSBINARY} ${ROOTDIR}etc/modprobe.d/* 2> /dev/null)
+ if [ ! -z "${FIND}" ]; then
+ FIND=$(${EGREPBINARY} -r "install usb[-_]storage /bin/(false|true)" ${ROOTDIR}etc/modprobe.d/* | ${GREPBINARY} -v "#")
+ FIND2=$(${EGREPBINARY} -r "^blacklist usb[-_]storage" ${ROOTDIR}etc/modprobe.d/*)
+ if [ ! -z "${FIND}" -o ! -z "${FIND2}" ]; then
FOUND=1
LogText "Result: found usb-storage driver in disabled state (blacklisted)"
fi
- else
+ else
LogText "Result: uncommon situation. Found /etc/modprobe.d directory, but no files in it."
fi
fi
- if [ -f /etc/modprobe.conf ]; then
- FIND=$(${EGREPBINARY} "install usb[-_]storage /bin/(false|true)" /etc/modprobe.conf | ${GREPBINARY} "usb-storage" | ${GREPBINARY} -v "#")
- if [ ! "${FIND}" = "" ]; then
+ if [ -f ${ROOTDIR}etc/modprobe.conf ]; then
+ FIND=$(${EGREPBINARY} "install usb[-_]storage /bin/(false|true)" ${ROOTDIR}etc/modprobe.conf | ${GREPBINARY} "usb-storage" | ${GREPBINARY} -v "#")
+ if [ ! -z "${FIND}" ]; then
FOUND=1
LogText "Result: found usb-storage driver in disabled state"
fi
@@ -59,7 +59,7 @@
Display --indent 2 --text "- Checking usb-storage driver (modprobe config)" --result "NOT DISABLED" --color WHITE
ReportSuggestion ${TEST_NO} "Disable drivers like USB storage when not used, to prevent unauthorized storage or data theft"
AddHP 2 3
- else
+ else
LogText "Result: usb-storage driver is disabled"
Display --indent 2 --text "- Checking usb-storage driver (modprobe config)" --result "${STATUS_DISABLED}" --color GREEN
AddHP 3 3
@@ -111,23 +111,23 @@
if [ ${SKIPTEST} -eq 0 ]; then
FOUND=0
LogText "Test: Checking firewire storage driver in directory /etc/modprobe.d and configuration file /etc/modprobe.conf"
- if [ -d /etc/modprobe.d ]; then
- FIND=$(ls /etc/modprobe.d/* 2> /dev/null)
- if [ ! "${FIND}" = "" ]; then
- FIND1=$(${EGREPBINARY} "blacklist (ohci1394|firewire[-_]ohci|firewire-core)" /etc/modprobe.d/* | ${GREPBINARY} -v "#")
- FIND2=$(${EGREPBINARY} "install (ohci1394|firewire[-_]ohci|firewire-core) /bin/(false|true)" /etc/modprobe.d/* | ${GREPBINARY} -v "#")
- if [ ! "${FIND1}" = "" -o ! "${FIND2}" = "" ]; then
+ if [ -d ${ROOTDIR}etc/modprobe.d ]; then
+ FIND=$(${LSBINARY} ${ROOTDIR}etc/modprobe.d/* 2> /dev/null)
+ if [ ! -z "${FIND}" ]; then
+ FIND1=$(${EGREPBINARY} "blacklist (ohci1394|firewire[-_]ohci|firewire-core)" ${ROOTDIR}etc/modprobe.d/* | ${GREPBINARY} -v "#")
+ FIND2=$(${EGREPBINARY} "install (ohci1394|firewire[-_]ohci|firewire-core) /bin/(false|true)" ${ROOTDIR}etc/modprobe.d/* | ${GREPBINARY} -v "#")
+ if [ ! -z "${FIND1}" -o ! -z "${FIND2}" ]; then
FOUND=1
LogText "Result: found firewire ohci driver in disabled state"
fi
- else
- LogText "Result: skipping /etc/modprobe.d, directory found but no files in it"
+ else
+ LogText "Result: skipping ${ROOTDIR}etc/modprobe.d, directory found but no files in it"
fi
fi
- if [ -f /etc/modprobe.conf ]; then
- FIND1=$(${EGREPBINARY} -r "blacklist (ohci1394|firewire[-_]ohci|firewire-core)" /etc/modprobe.conf | ${GREPBINARY} -v "#")
- FIND2=$(${EGREPBINARY} -r "install (ohci1394|firewire[-_]ohci|firewire-core) /bin/(false|true)" /etc/modprobe.conf | ${GREPBINARY} -v "#")
- if [ ! "${FIND1}" = "" -o ! "${FIND2}" = "" ]; then
+ if [ -f ${ROOTDIR}etc/modprobe.conf ]; then
+ FIND1=$(${EGREPBINARY} -r "blacklist (ohci1394|firewire[-_]ohci|firewire-core)" ${ROOTDIR}etc/modprobe.conf | ${GREPBINARY} -v "#")
+ FIND2=$(${EGREPBINARY} -r "install (ohci1394|firewire[-_]ohci|firewire-core) /bin/(false|true)" ${ROOTDIR}etc/modprobe.conf | ${GREPBINARY} -v "#")
+ if [ ! -z "${FIND1}" -o ! -z "${FIND2}" ]; then
FOUND=1
LogText "Result: found firewire ohci driver in disabled state"
fi
@@ -139,7 +139,7 @@
ReportSuggestion ${TEST_NO} "Disable drivers like firewire storage when not used, to prevent unauthorized storage or data theft"
# after blacklisting modules, make sure to remove them from the initram filesystem: update-initramfs -u
AddHP 2 3
- else
+ else
LogText "Result: firewire ohci driver is disabled"
Display --indent 2 --text "- Checking firewire ohci driver (modprobe config)" --result "${STATUS_DISABLED}" --color GREEN
AddHP 3 3