mirror of
https://github.com/CISOfy/lynis.git
synced 2025-07-23 13:54:35 +02:00
Performance: only use lshw at end, and when having root privileges
This commit is contained in:
parent
dab69d2860
commit
bbdfce2b05
@ -1034,23 +1034,6 @@
|
|||||||
else
|
else
|
||||||
LogText "Result: skipped dmidecode test, as we already found machine type"
|
LogText "Result: skipped dmidecode test, as we already found machine type"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# lshw
|
|
||||||
if [ "${SHORT}" = "" ]; 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: skipped lshw test, as we already found machine type"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Other options
|
# Other options
|
||||||
# SaltStack: salt-call grains.get virtual
|
# SaltStack: salt-call grains.get virtual
|
||||||
# < needs snippet >
|
# < needs snippet >
|
||||||
@ -1101,6 +1084,22 @@
|
|||||||
LogText "Result: skipped sysctl test, as we already found platform"
|
LogText "Result: skipped sysctl test, as we already found platform"
|
||||||
fi
|
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}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
LogText "Result: lshw not found"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
LogText "Result: skipped lshw test, as we already found machine type"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if we catched some string along all tests
|
# Check if we catched some string along all tests
|
||||||
if [ ! "${SHORT}" = "" ]; then
|
if [ ! "${SHORT}" = "" ]; then
|
||||||
# Lowercase and see if we found a match
|
# Lowercase and see if we found a match
|
||||||
|
Loading…
x
Reference in New Issue
Block a user