mirror of https://github.com/CISOfy/lynis.git
Improve logging for non-privileged users
This commit is contained in:
parent
99de3bb0b6
commit
27054e2f2e
|
@ -1085,7 +1085,7 @@
|
||||||
|
|
||||||
IsContainer() {
|
IsContainer() {
|
||||||
FOUND=0
|
FOUND=0
|
||||||
if [ /proc/1/cgroups ]; then
|
if [ -e /proc/1/cgroups ]; then
|
||||||
FIND=$(cat /proc/1/cgroups | grep -i docker)
|
FIND=$(cat /proc/1/cgroups | grep -i docker)
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
LogText "Result: found Docker in cgroups, so we are running in Docker container"
|
LogText "Result: found Docker in cgroups, so we are running in Docker container"
|
||||||
|
@ -1368,18 +1368,22 @@
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# lshw
|
# lshw
|
||||||
if [ "${SHORT}" = "" -a ${PRIVILEGED} -eq 1 ]; then
|
if [ "${SHORT}" = "" ]; then
|
||||||
if [ -x /usr/bin/lshw ]; then
|
if [ ${PRIVILEGED} -eq 1 ]; then
|
||||||
LogText "Test: trying to guess virtualization with lshw"
|
if [ -x /usr/bin/lshw ]; then
|
||||||
FIND=`lshw -quiet -class system 2> /dev/null | awk '{ if ($1=="product:") { print $2 }}'`
|
LogText "Test: trying to guess virtualization with lshw"
|
||||||
if [ ! "${FIND}" = "" ]; then
|
FIND=`lshw -quiet -class system 2> /dev/null | awk '{ if ($1=="product:") { print $2 }}'`
|
||||||
LogText "Result: found ${FIND}"
|
if [ ! "${FIND}" = "" ]; then
|
||||||
SHORT="${FIND}"
|
LogText "Result: found ${FIND}"
|
||||||
|
SHORT="${FIND}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
LogText "Result: lshw not found"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
LogText "Result: lshw not found"
|
LogText "Result: skipped lshw test, as we are non-privileged and need more permissions to run lshw"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
LogText "Result: skipped lshw test, as we already found machine type"
|
LogText "Result: skipped lshw test, as we already found machine type"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue