mirror of
https://github.com/CISOfy/lynis.git
synced 2025-07-28 16:24:13 +02:00
Use machine ID if we have no suitable other string yet
This commit is contained in:
parent
20ec79d4e2
commit
1641f4c88f
@ -1006,7 +1006,7 @@
|
|||||||
for I in ${SSH_KEY_FILES}; do
|
for I in ${SSH_KEY_FILES}; do
|
||||||
if [ ${FOUND} -eq 0 ]; then
|
if [ ${FOUND} -eq 0 ]; then
|
||||||
if [ -f /etc/ssh/${I} ]; then
|
if [ -f /etc/ssh/${I} ]; then
|
||||||
LogText "Result: found file ${I} in /etc/ssh"
|
LogText "Result: found file ${I} in /etc/ssh, using that to create host identifier"
|
||||||
DATA_SSH=$(cat /etc/ssh/${I})
|
DATA_SSH=$(cat /etc/ssh/${I})
|
||||||
FOUND=1
|
FOUND=1
|
||||||
fi
|
fi
|
||||||
@ -1016,7 +1016,18 @@
|
|||||||
LogText "Result: no /etc/ssh directory found, skipping"
|
LogText "Result: no /etc/ssh directory found, skipping"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! "${DATA_SSH}" = "" ]; then
|
STRING_TO_HASH=""
|
||||||
|
if [ ${FOUND} -eq 1 -a ! -z "${DATA_SSH}" ]; then
|
||||||
|
LogText "Using SSH public key to create the second host identifier"
|
||||||
|
STRING_TO_HASH="${DATA_SSH}"
|
||||||
|
else
|
||||||
|
if [ ! -z "${MACHINEID}" ]; then
|
||||||
|
LogText "Using the machine ID to create the second host identifier"
|
||||||
|
STRING_TO_HASH="${MACHINEID}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# Check if we have a string to turn into a host identifier
|
||||||
|
if [ ! -z "${STRING_TO_HASH}" ]; then
|
||||||
# Create hashes
|
# Create hashes
|
||||||
if [ ! "${SHA256SUMBINARY}" = "" ]; then
|
if [ ! "${SHA256SUMBINARY}" = "" ]; then
|
||||||
HASH_SSH=$(echo ${DATA_SSH} | ${SHA256SUMBINARY} | awk '{ print $1 }')
|
HASH_SSH=$(echo ${DATA_SSH} | ${SHA256SUMBINARY} | awk '{ print $1 }')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user