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-05-03 14:15:46 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2016-05-03 14:15:46 +0300
commitbbdfce2b05774a76a309b19199521770a5f9cfdf (patch)
treeff011513a8ffad4f24ab5f7608bd1b50143901e4
parentdab69d2860eafd326924b2c0259c2698cffa78ff (diff)
Performance: only use lshw at end, and when having root privileges
-rw-r--r--include/functions33
1 files changed, 16 insertions, 17 deletions
diff --git a/include/functions b/include/functions
index 8800cd3f..e5ea5247 100644
--- a/include/functions
+++ b/include/functions
@@ -1034,23 +1034,6 @@
else
LogText "Result: skipped dmidecode test, as we already found machine type"
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
# SaltStack: salt-call grains.get virtual
# < needs snippet >
@@ -1101,6 +1084,22 @@
LogText "Result: skipped sysctl test, as we already found platform"
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
if [ ! "${SHORT}" = "" ]; then
# Lowercase and see if we found a match