"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "include/tests_kernel" between
lynis-3.0.5.tar.gz and lynis-3.0.6.tar.gz

About: Lynis is a security and system auditing tool.

tests_kernel  (lynis-3.0.5):tests_kernel  (lynis-3.0.6)
skipping to change at line 676 skipping to change at line 676
if [ -f ${ROOTDIR}boot/vmlinuz-linux ]; then if [ -f ${ROOTDIR}boot/vmlinuz-linux ]; then
LogText "Result: found ${ROOTDIR}boot/vmlinuz-linux" LogText "Result: found ${ROOTDIR}boot/vmlinuz-linux"
FOUND_VMLINUZ=${ROOTDIR}boot/vmlinuz-linux FOUND_VMLINUZ=${ROOTDIR}boot/vmlinuz-linux
elif [ -f ${ROOTDIR}boot/vmlinuz-linux-lts ]; then elif [ -f ${ROOTDIR}boot/vmlinuz-linux-lts ]; then
LogText "Result: found ${ROOTDIR}boot/vmlinuz-linux-lts" LogText "Result: found ${ROOTDIR}boot/vmlinuz-linux-lts"
FOUND_VMLINUZ=${ROOTDIR}boot/vmlinuz-linux-lts FOUND_VMLINUZ=${ROOTDIR}boot/vmlinuz-linux-lts
elif [ -f ${ROOTDIR}boot/vmlinuz-lts ]; then elif [ -f ${ROOTDIR}boot/vmlinuz-lts ]; then
LogText "Result: found ${ROOTDIR}boot/vmlinuz-lts" LogText "Result: found ${ROOTDIR}boot/vmlinuz-lts"
FOUND_VMLINUZ=${ROOTDIR}boot/vmlinuz-lts FOUND_VMLINUZ=${ROOTDIR}boot/vmlinuz-lts
else else
# Match on items like /boot/vm5.3.7 or /boot/vmlinuz-5.3 .7-1-default. Get newest file (ls -t and pipe into head) # Match on items like /boot/vm5.3.7 or /boot/vmlinuz-5.3 .7-1-default. Sort based on versions (-v) and then find the last item
# Note: ignore a rescue kernel (e.g. CentOS) # Note: ignore a rescue kernel (e.g. CentOS)
FOUND_VMLINUZ=$(${LSBINARY} -t ${ROOTDIR}boot/vm[l0-9]* 2> /dev/null | ${GREPBINARY} -v '\-rescue\-' | ${HEADBINARY} -1) FOUND_VMLINUZ=$(${LSBINARY} -v ${ROOTDIR}boot/vm[l0-9]* 2> /dev/null | ${GREPBINARY} -v '\-rescue\-' | ${TAILBINARY} -1)
LogText "Result: found ${FOUND_VMLINUZ}" LogText "Result: found ${FOUND_VMLINUZ}"
fi fi
VERSION_ON_DISK="" VERSION_ON_DISK=""
if [ -L "${FOUND_VMLINUZ}" ]; then if [ -L "${FOUND_VMLINUZ}" ]; then
LogText "Result: found a symlink, retrieving destination " LogText "Result: found a symlink, retrieving destination "
FOUND_VMLINUZ=$(readlink "${FOUND_VMLINUZ}") FOUND_VMLINUZ=$(readlink "${FOUND_VMLINUZ}")
LogText "Result: destination file is ${FOUND_VMLINUZ}" LogText "Result: destination file is ${FOUND_VMLINUZ}"
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 '${VE RSION_ON_DISK}'" LogText "Result: version derived from file name is '${VE RSION_ON_DISK}'"
skipping to change at line 752 skipping to change at line 752
# Extra current kernel version and replace dashes to allow n umeric ${SORTBINARY} later on # Extra current kernel version and replace dashes to allow n umeric ${SORTBINARY} later on
MYKERNEL=$(${UNAMEBINARY} -r | ${SEDBINARY} 's/\.[a-z].*.//g ' | ${SEDBINARY} 's/-[a-z].*.//g' | ${SEDBINARY} 's/-/./g') MYKERNEL=$(${UNAMEBINARY} -r | ${SEDBINARY} 's/\.[a-z].*.//g ' | ${SEDBINARY} 's/-[a-z].*.//g' | ${SEDBINARY} 's/-/./g')
LogText "Result: using ${MYKERNEL} as my kernel version (str ipped)" LogText "Result: using ${MYKERNEL} as my kernel version (str ipped)"
FIND=$(ls ${ROOTDIR}boot/vmlinuz* 2> /dev/null) FIND=$(ls ${ROOTDIR}boot/vmlinuz* 2> /dev/null)
if [ -n "${FIND}" ]; then if [ -n "${FIND}" ]; then
for ITEM in ${FIND}; do for ITEM in ${FIND}; do
LogText "Result: found ${ITEM}" LogText "Result: found ${ITEM}"
done done
# Display kernels, extract version numbers and ${SORTBIN ARY} them numeric per column (up to 6 numbers) # Display kernels, extract version numbers and ${SORTBIN ARY} them numeric per column (up to 6 numbers)
# Ignore rescue images. Remove generic. and huge. for Sl ackware machines # Ignore rescue images. Remove generic. and huge. for Sl ackware machines
# TODO: see if this can be simplified using ls -v sortin g
LogText "Action: checking relevant kernels" LogText "Action: checking relevant kernels"
KERNELS=$(${LSBINARY} /boot/vmlinuz* | ${GREPBINARY} -v rescue | ${SEDBINARY} 's/vmlinuz-//' | ${SEDBINARY} 's/generic.//' | ${SEDBINARY } 's/huge.//' | ${SEDBINARY} 's/\.[a-z].*.//g' | ${SEDBINARY} 's/-[a-z].*.//g' | ${SEDBINARY} 's./boot/..' | ${SEDBINARY} 's/-/./g' | ${SORTBINARY} -n -k1,1 -k2 ,2 -k3,3 -k4,4 -k5,5 -k6,6 -t \.) KERNELS=$(${LSBINARY} /boot/vmlinuz* | ${GREPBINARY} -v rescue | ${SEDBINARY} 's/vmlinuz-//' | ${SEDBINARY} 's/generic.//' | ${SEDBINARY } 's/huge.//' | ${SEDBINARY} 's/\.[a-z].*.//g' | ${SEDBINARY} 's/-[a-z].*.//g' | ${SEDBINARY} 's./boot/..' | ${SEDBINARY} 's/-/./g' | ${SORTBINARY} -n -k1,1 -k2 ,2 -k3,3 -k4,4 -k5,5 -k6,6 -t \.)
KERNELS_ONE_LINE=$(${ECHOCMD} ${KERNELS} | ${TRBINARY} ' \n' ' ') KERNELS_ONE_LINE=$(${ECHOCMD} ${KERNELS} | ${TRBINARY} ' \n' ' ')
LogText "Output: ${KERNELS_ONE_LINE}" LogText "Output: ${KERNELS_ONE_LINE}"
elif [ ! "$(ls ${ROOTDIR}boot/kernel* 2> /dev/null)" = "" ]; then elif [ ! "$(ls ${ROOTDIR}boot/kernel* 2> /dev/null)" = "" ]; then
LogText "Output: Found a kernel file in ${ROOTDIR}boot" LogText "Output: Found a kernel file in ${ROOTDIR}boot"
# Display kernels, extract version numbers and ${SORTBIN ARY} them numeric per column (up to 6 numbers) # Display kernels, extract version numbers and ${SORTBIN ARY} them numeric per column (up to 6 numbers)
# Examples: # Examples:
# /boot/kernel-genkernel-x86_64-3.14.14-gentoo # /boot/kernel-genkernel-x86_64-3.14.14-gentoo
KERNELS=$(${LSBINARY} ${ROOTDIR}boot/kernel* | ${AWKBINA RY} -F- '{ if ($2=="genkernel") { print $4 }}' | ${GREPBINARY} "^[0-9]" | ${SORT BINARY} -n -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 -k6,6 -t \.) KERNELS=$(${LSBINARY} ${ROOTDIR}boot/kernel* | ${AWKBINA RY} -F- '{ if ($2=="genkernel") { print $4 }}' | ${GREPBINARY} "^[0-9]" | ${SORT BINARY} -n -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 -k6,6 -t \.)
 End of changes. 3 change blocks. 
2 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)