mirror of https://github.com/CISOfy/lynis.git
kernel-test: determine reboot requirement for more distros. Plus a few fixes
This commit is contained in:
parent
b38031803d
commit
364b770c64
|
@ -1048,7 +1048,7 @@
|
|||
if [ -n "${FIND}" ]; then
|
||||
LogText "Result: found /etc/profile.d, with one or more files in it"
|
||||
for FILE in ${FIND}; do
|
||||
HAS_MASK=$(${GREPBINARY} umask ${FILE} | ${SEDBINARY} 's/^[ \t]*//' | ${GREPBINARY} -v "^#" | ${AWKBINARY} '{ print $2 }')
|
||||
HAS_MASK=$(${GREPBINARY} umask ${FILE} 2> /dev/null | ${SEDBINARY} 's/^[ \t]*//' | ${GREPBINARY} -v "^#" | ${AWKBINARY} '{ print $2 }')
|
||||
for MASK in ${HAS_MASK}; do
|
||||
if [ "${MASK}" = "077" -o "${MASK}" = "027" -o "${MASK}" = "0077" -o "${MASK}" = "0027" ]; then
|
||||
LogText "Result: found a strong umask '${MASK}' set in ${FILE}"
|
||||
|
|
|
@ -527,6 +527,7 @@
|
|||
for I in $(file ${ROOTDIR}boot/vmlinuz-linux); do
|
||||
if [ ${NEXTLINE} -eq 1 ]; then
|
||||
FINDVERSION="${I}"
|
||||
break
|
||||
else
|
||||
# Searching for the Linux kernel after the keyword 'version'
|
||||
if [ "${I}" = "version" ]; then NEXTLINE=1; fi
|
||||
|
@ -541,16 +542,28 @@
|
|||
else
|
||||
ReportException "${TEST_NO}:1" "Can't determine kernel version on disk, need debug data"
|
||||
fi
|
||||
elif [ -f ${ROOTDIR}boot/vmlinuz-linux -o -f ${ROOTDIR}boot/vmlinuz-linux-lts ]; then
|
||||
elif [ -f ${ROOTDIR}boot/vmlinuz-linux -o -f ${ROOTDIR}boot/vmlinuz-linux-lts -o -f $(ls -t ${ROOTDIR}boot/vmlinuz-* | head -1) ]; then
|
||||
if [ -f ${ROOTDIR}boot/vmlinuz-linux ]; then
|
||||
LogText "Result: /found /boot/vmlinuz-linux (usually Arch Linux or similar)"
|
||||
LogText "Test: checking kernel version on disk"
|
||||
VERSION_ON_DISK=$(${FILEBINARY} -b ${ROOTDIR}boot/vmlinuz-linux | ${AWKBINARY} '{ if ($1=="Linux" && $7=="version") { print $8 }}')
|
||||
FOUND_VMLINUZ=${ROOTDIR}boot/vmlinuz-linux
|
||||
elif [ -f ${ROOTDIR}boot/vmlinuz-linux-lts ]; then
|
||||
FOUND_VMLINUZ=${ROOTDIR}boot/vmlinuz-linux-lts
|
||||
else
|
||||
LogText "Result: /found /boot/vmlinuz-linux-lts (usually Arch Linux or similar)"
|
||||
LogText "Test: checking kernel version on disk"
|
||||
VERSION_ON_DISK=$(${FILEBINARY} -b ${ROOTDIR}boot/vmlinuz-linux-lts | ${AWKBINARY} '{ if ($1=="Linux" && $7=="version") { print $8 }}')
|
||||
FOUND_VMLINUZ=$(ls -t ${ROOTDIR}boot/vmlinuz-* | head -1)
|
||||
fi
|
||||
LogText "Result: /found /boot/vmlinuz-linux-lts (usually Arch Linux or similar)"
|
||||
LogText "Test: checking kernel version on disk"
|
||||
#VERSION_ON_DISK=$(${FILEBINARY} -b ${FOUND_VMLINUZ} | ${AWKBINARY} '{ if ($1=="Linux" && $7=="version") { print $8 }}')
|
||||
NEXTLINE=0
|
||||
VERSION_ON_DISK=""
|
||||
for I in $(file ${FOUND_VMLINUZ}); do
|
||||
if [ ${NEXTLINE} -eq 1 ]; then
|
||||
VERSION_ON_DISK="${I}"
|
||||
break
|
||||
else
|
||||
# Searching for the Linux kernel after the keyword 'version'
|
||||
if [ "${I}" = "version" ]; then NEXTLINE=1; fi
|
||||
fi
|
||||
done
|
||||
if [ -n "${VERSION_ON_DISK}" ]; then
|
||||
LogText "Result: found version ${VERSION_ON_DISK}"
|
||||
ACTIVE_KERNEL=$(uname -r)
|
||||
|
|
Loading…
Reference in New Issue