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>2016-10-16 16:29:50 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2016-10-16 16:29:50 +0300
commit27054e2f2e69b1dd5a042702f856ae92654220ae (patch)
tree4d9449400b2e61f080feb9f5e9f3475db89d8217
parent99de3bb0b641b756eb5fa1542457ac2b78006500 (diff)
Improve logging for non-privileged users
-rw-r--r--include/functions26
1 files changed, 15 insertions, 11 deletions
diff --git a/include/functions b/include/functions
index e5cbe30c..922bf8a5 100644
--- a/include/functions
+++ b/include/functions
@@ -1085,7 +1085,7 @@
IsContainer() {
FOUND=0
- if [ /proc/1/cgroups ]; then
+ if [ -e /proc/1/cgroups ]; then
FIND=$(cat /proc/1/cgroups | grep -i docker)
if [ $? -eq 0 ]; then
LogText "Result: found Docker in cgroups, so we are running in Docker container"
@@ -1368,18 +1368,22 @@
fi
# lshw
- if [ "${SHORT}" = "" -a ${PRIVILEGED} -eq 1 ]; then
- if [ -x /usr/bin/lshw ]; then
- LogText "Test: trying to guess virtualization with lshw"
- FIND=`lshw -quiet -class system 2> /dev/null | awk '{ if ($1=="product:") { print $2 }}'`
- if [ ! "${FIND}" = "" ]; then
- LogText "Result: found ${FIND}"
- SHORT="${FIND}"
+ if [ "${SHORT}" = "" ]; then
+ if [ ${PRIVILEGED} -eq 1 ]; then
+ if [ -x /usr/bin/lshw ]; then
+ LogText "Test: trying to guess virtualization with lshw"
+ FIND=`lshw -quiet -class system 2> /dev/null | awk '{ if ($1=="product:") { print $2 }}'`
+ if [ ! "${FIND}" = "" ]; then
+ LogText "Result: found ${FIND}"
+ SHORT="${FIND}"
+ fi
+ else
+ LogText "Result: lshw not found"
fi
- else
- LogText "Result: lshw not found"
+ else
+ LogText "Result: skipped lshw test, as we are non-privileged and need more permissions to run lshw"
fi
- else
+ else
LogText "Result: skipped lshw test, as we already found machine type"
fi