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-03-01 18:11:17 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2017-03-01 18:11:17 +0300
commit295fe93ca64db785c280c9a9d4479ef56d91f87f (patch)
tree6f9d4f9ae3e133e47b3f1ee56ad7f4697967272f /include/tests_filesystems
parentd080f8f6b7b6838efb979d445e5e77f770a78b8e (diff)
[FILE-6372] Properly deal with comments in /etc/fstab
Diffstat (limited to 'include/tests_filesystems')
-rw-r--r--include/tests_filesystems8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/tests_filesystems b/include/tests_filesystems
index 3b76e472..731198e7 100644
--- a/include/tests_filesystems
+++ b/include/tests_filesystems
@@ -475,20 +475,20 @@
# Notes :
Register --test-no FILE-6372 --os Linux --weight L --network NO --category security --description "Checking / mount options"
if [ ${SKIPTEST} -eq 0 ]; then
- if [ -f /etc/fstab ]; then
- FIND=$(${AWKBINARY} '{ if ($2=="/") { print $4 } }' /etc/fstab | ${GREPBINARY} -v "^#")
+ if [ -f ${ROOTDIR}etc/fstab ]; then
+ FIND=$(${GREPBINARY} -w "/" ${ROOTDIR}etc/fstab | ${GREPBINARY} -v "^#" | ${CUTBINARY} -f1 -d"#" | ${AWKBINARY} '{ if ($2=="/") { print $4 }}')
NODEV=$(echo ${FIND} | ${AWKBINARY} '{ if ($1 ~ "nodev") { print "YES" } else { print "NO" } }')
NOEXEC=$(echo ${FIND} | ${AWKBINARY} '{ if ($1 ~ "noexec") { print "YES" } else { print "NO" } }')
NOSUID=$(echo ${FIND} | ${AWKBINARY} '{ if ($1 ~ "nosuid") { print "YES" } else { print "NO" } }')
- if [ ! "${FIND}" = "" ]; then
+ if [ ! -z "${FIND}" ]; then
LogText "Result: mount system / is configured with options: ${FIND}"
if [ "${FIND}" = "defaults" ]; then
Display --indent 2 --text "- Mount options of /" --result "${STATUS_OK}" --color GREEN
else
Display --indent 2 --text "- Mount options of /" --result "NON DEFAULT" --color YELLOW
fi
- else
+ else
LogText "Result: no mount point / or expected options found"
fi
fi