mirror of
https://github.com/CISOfy/lynis.git
synced 2025-07-28 00:04:16 +02:00
Improved detection of kernel by ignoring known incorrect values
This commit is contained in:
parent
21b5493a1c
commit
ba1cff941f
@ -680,8 +680,19 @@
|
|||||||
elif [ -f "${FOUND_VMLINUZ}" ]; then
|
elif [ -f "${FOUND_VMLINUZ}" ]; then
|
||||||
VERSION_ON_DISK=$(echo ${FOUND_VMLINUZ} | ${SEDBINARY} 's#^/boot/##' | ${SEDBINARY} 's/^vmlinuz-//')
|
VERSION_ON_DISK=$(echo ${FOUND_VMLINUZ} | ${SEDBINARY} 's#^/boot/##' | ${SEDBINARY} 's/^vmlinuz-//')
|
||||||
LogText "Result: version derived from file name is '${VERSION_ON_DISK}'"
|
LogText "Result: version derived from file name is '${VERSION_ON_DISK}'"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Data check: perform reset if we found a version but looks incomplete
|
||||||
|
# Example: Arch Linux will return only 'linux' as its version after it discovered /boot/vmlinuz-linux
|
||||||
|
case ${VERSION_ON_DISK} in
|
||||||
|
"linux" | "linux-lts")
|
||||||
|
LogText "Result: reset of version (${VERSION_ON_DISK}) as it looks incomplete"
|
||||||
|
VERSION_ON_DISK=""
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# If we did not find the version yet, see if we can extract it from the magic data that 'file' returns
|
||||||
if [ -z "${VERSION_ON_DISK}" ]; then
|
if [ -z "${VERSION_ON_DISK}" ]; then
|
||||||
LogText "Test: checking kernel version on disk"
|
LogText "Test: checking kernel version on disk"
|
||||||
NEXTLINE=0
|
NEXTLINE=0
|
||||||
@ -697,6 +708,7 @@
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Last check if we finally got a version or not
|
||||||
if [ -z "${VERSION_ON_DISK}" ]; then
|
if [ -z "${VERSION_ON_DISK}" ]; then
|
||||||
LogText "Result: could not find the version on disk"
|
LogText "Result: could not find the version on disk"
|
||||||
ReportException "${TEST_NO}:4" "Could not find the kernel version"
|
ReportException "${TEST_NO}:4" "Could not find the kernel version"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user