lynis icon indicating copy to clipboard operation
lynis copied to clipboard

[FILE-6344] Invalid check on the kernel version

Open pyllyukko opened this issue 2 years ago • 2 comments

Describe the bug There's a bug in the check for prerequirements where the kernel version is checked:

        LINUX_KERNEL_MAJOR=$(echo $OS_KERNELVERSION | ${AWKBINARY} -F. '{print $1}')
        LINUX_KERNEL_MINOR=$(echo $OS_KERNELVERSION | ${AWKBINARY} -F. '{print $2}')
        if [ -n "${LINUX_KERNEL_MAJOR}" -a -n "${LINUX_KERNEL_MINOR}" ]; then
            if [ ${LINUX_KERNEL_MAJOR} -ge 3 -a ${LINUX_KERNEL_MINOR} -ge 3 ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi

It should check that the kernel is newer than 3.3, but the test is written as such, that all minor versions below 3 will fail this test, even though the major version would be > 3. E.g. 4.[012], 5.[012] etc.

Version

  • Lynis version 3.0.8

Expected behavior E.g. Linux kernel version 6.0.0 would fulfil the prerequirements.

Output Prerequirements are not met if kernel's minor version is below 3.

pyllyukko avatar Jan 08 '23 20:01 pyllyukko

#1388

xnoguer avatar Apr 26 '23 22:04 xnoguer

@pyllyukko Could you please try this pull request? https://github.com/CISOfy/lynis/pull/1388

xnoguer avatar Apr 26 '23 22:04 xnoguer