mirror of https://github.com/CISOfy/lynis.git
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
|
||||
VERSION_ON_DISK=$(echo ${FOUND_VMLINUZ} | ${SEDBINARY} 's#^/boot/##' | ${SEDBINARY} 's/^vmlinuz-//')
|
||||
LogText "Result: version derived from file name is '${VERSION_ON_DISK}'"
|
||||
|
||||
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
|
||||
LogText "Test: checking kernel version on disk"
|
||||
NEXTLINE=0
|
||||
|
@ -697,6 +708,7 @@
|
|||
done
|
||||
fi
|
||||
|
||||
# Last check if we finally got a version or not
|
||||
if [ -z "${VERSION_ON_DISK}" ]; then
|
||||
LogText "Result: could not find the version on disk"
|
||||
ReportException "${TEST_NO}:4" "Could not find the kernel version"
|
||||
|
|
Loading…
Reference in New Issue