mirror of
https://github.com/CISOfy/lynis.git
synced 2025-07-27 15:54:09 +02:00
Minor changes and remarks regarding HostID
This commit is contained in:
parent
11368b4ca8
commit
750f55bd27
@ -888,12 +888,15 @@
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
"Linux")
|
"Linux")
|
||||||
# Define preferred interfaces
|
|
||||||
#PREFERRED_INTERFACES="eth0 eth1 eth2 enp0s25"
|
|
||||||
|
|
||||||
# Only use ifconfig if no ip binary has been found
|
# Future change
|
||||||
if [ ! "${IFCONFIGBINARY}" = "" ]; then
|
# Show brief output of ip of links that are UP. Filter out items like 'UNKNOWN' in col 2
|
||||||
# Determine if we have ETH0 at all (not all Linux distro have this, e.g. Arch)
|
# Using the {2} syntax does not work on all systems
|
||||||
|
# ip -br link show up | sort | awk '$2=="UP" && $3 ~ /^[a-f0-9][a-f0-9]:/ {print $3}'
|
||||||
|
|
||||||
|
# Use ifconfig
|
||||||
|
if [ ! -z "${IFCONFIGBINARY}" ]; then
|
||||||
|
# Determine if we have the eth0 interface (not all Linux distro have this, e.g. Arch)
|
||||||
HASETH0=$(${IFCONFIGBINARY} | grep "^eth0")
|
HASETH0=$(${IFCONFIGBINARY} | grep "^eth0")
|
||||||
# Check if we can find it with HWaddr on the line
|
# Check if we can find it with HWaddr on the line
|
||||||
FIND=$(${IFCONFIGBINARY} 2> /dev/null | grep "^eth0" | grep -v "eth0:" | grep HWaddr | awk '{ print $5 }' | tr '[:upper:]' '[:lower:]')
|
FIND=$(${IFCONFIGBINARY} 2> /dev/null | grep "^eth0" | grep -v "eth0:" | grep HWaddr | awk '{ print $5 }' | tr '[:upper:]' '[:lower:]')
|
||||||
@ -919,9 +922,8 @@
|
|||||||
LogText "GetHostID: No eth0 found (but HWaddr was found), using first network interface to determine hostid, with ifconfig"
|
LogText "GetHostID: No eth0 found (but HWaddr was found), using first network interface to determine hostid, with ifconfig"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
# See if we can use ip binary instead
|
elif [ ! -z "${IPBINARY}" ]; then
|
||||||
if [ ! "${IPBINARY}" = "" ]; then
|
|
||||||
# Determine if we have the common available eth0 interface
|
# Determine if we have the common available eth0 interface
|
||||||
FIND=$(${IPBINARY} addr show eth0 2> /dev/null | egrep "link/ether " | head -1 | awk '{ print $2 }' | tr '[:upper:]' '[:lower:]')
|
FIND=$(${IPBINARY} addr show eth0 2> /dev/null | egrep "link/ether " | head -1 | awk '{ print $2 }' | tr '[:upper:]' '[:lower:]')
|
||||||
if IsEmpty "${FIND}"; then
|
if IsEmpty "${FIND}"; then
|
||||||
@ -932,8 +934,8 @@
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
ReportException "GetHostID" "Can't create hostid, missing both ifconfig and ip binary"
|
ReportException "GetHostID" "Both ip and ifconfig tools are missing"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check if we found a HostID
|
# Check if we found a HostID
|
||||||
|
Loading…
x
Reference in New Issue
Block a user