Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Boelen <michael.boelen@cisofy.com>2021-01-07 13:30:51 +0300
committerGitHub <noreply@github.com>2021-01-07 13:30:51 +0300
commitc38c89ae4e5128fb3347835ca311ea3b1a255a75 (patch)
tree0ae1ccf336ba8e416b91a2a55a132d6c38cca42e /include/tests_ports_packages
parent0abf01b3583e595bca5370f8feb53da4ca8b467e (diff)
parent4a03c613438d25944680ed22f67276dff755ff3c (diff)
Merge pull request #1004 from Varbin/1003-os-detection
Test for LINUX_VERSION before setting it again
Diffstat (limited to 'include/tests_ports_packages')
-rw-r--r--include/tests_ports_packages86
1 files changed, 51 insertions, 35 deletions
diff --git a/include/tests_ports_packages b/include/tests_ports_packages
index 2e827813..0a4b77bc 100644
--- a/include/tests_ports_packages
+++ b/include/tests_ports_packages
@@ -600,8 +600,8 @@
#
# Test : PKGS-7366
# Description : Checking if debsecan is installed and enabled on Debian systems
- if [ -n "${DEBSECANBINARY}" -a "${OS}" = "Linux" -a "${LINUX_VERSION}" = "Debian" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
- Register --test-no "PKGS-7366" --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Checking for debsecan utility"
+ if [ -n "${DEBSECANBINARY}" ] && ( [ "${LINUX_VERSION}" = "Debian" ] || [ "${LINUX_VERSION_LIKE}" = "Debian" ] ); then PREQS_MET="YES"; else PREQS_MET="NO"; fi
+ Register --test-no "PKGS-7366" --preqs-met ${PREQS_MET} --os Linux --weight L --network NO --category security --description "Checking for debsecan utility"
if [ ${SKIPTEST} -eq 0 ]; then
if [ -n "${DEBSECANBINARY}" ]; then
LogText "Result: debsecan utility is installed"
@@ -986,7 +986,9 @@
PREQS_MET="NO"
if [ -f ${ROOTDIR}etc/apt/sources.list -a -d ${ROOTDIR}etc/apt/sources.list.d ]; then
case "${LINUX_VERSION}" in
- "Debian" | "Linux Mint" | "Ubuntu")
+ "Debian" | "Linux Mint" | "Ubuntu" | "Pop!_OS")
+ # Todo: PureOS (not rolling) has security repositories
+ # Todo: Debian sid does not have a security repository.
PREQS_MET="YES"
;;
*)
@@ -1042,7 +1044,13 @@
#
# Test : PKGS-7390
# Description : Check Ubuntu database consistency
- if [ "${LINUX_VERSION}" = "Ubuntu" -a -x ${ROOTDIR}usr/bin/apt-get ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
+ if ([ "${LINUX_VERSION}" = "Debian" ] || [ "${LINUX_VERSION}" = "Ubuntu" ] ||
+ [ "${LINUX_VERSION_LIKE}" = "Debian" ] || [ "${LINUX_VERSION_LIKE}" = "Ubuntu" ]) && [ -x "${ROOTDIR}usr/bin/apt-get" ]; then
+ PREQS_MET="YES"
+ else
+ PREQS_MET="NO"
+ fi
+
Register --test-no PKGS-7390 --os Linux --preqs-met ${PREQS_MET} --root-only YES --weight L --network NO --category security --description "Check Ubuntu database consistency"
if [ ${SKIPTEST} -eq 0 ]; then
LogText "Test: Package database consistency by running apt-get check"
@@ -1191,7 +1199,13 @@
#
# Test : PKGS-7394
# Description : Check Ubuntu upgradeable packages
- if [ "${LINUX_VERSION}" = "Ubuntu" ]; then PREQS_MET="YES"; else PREQS_MET="NO"; fi
+ if ([ "${LINUX_VERSION}" = "Debian" ] || [ "${LINUX_VERSION}" = "Ubuntu" ] ||
+ [ "${LINUX_VERSION_LIKE}" = "Debian" ] || [ "${LINUX_VERSION_LIKE}" = "Ubuntu" ]) && [ -x "${ROOTDIR}usr/bin/apt-get" ]; then
+ PREQS_MET="YES"
+ else
+ PREQS_MET="NO"
+ fi
+
Register --test-no PKGS-7394 --os Linux --preqs-met ${PREQS_MET} --weight L --network YES --category security --description "Check for Ubuntu updates"
if [ ${SKIPTEST} -eq 0 ]; then
LogText "Test: checking ${ROOTDIR}usr/bin/apt-show-versions"
@@ -1329,37 +1343,39 @@
case "${OS}" in
"Linux")
- case "${LINUX_VERSION}" in
- "CentOS" | "Debian" | "Fedora" | "RHEL" | "Ubuntu")
-
+ for DIST in CentOS Debian Fedora RHEL Ubuntu; do
+ if [ "${LINUX_VERSION}" = "${DIST}" ] || [ "${LINUX_VERSION_LIKE}" = "${DIST}" ]; then
UNATTENDED_UPGRADES_OPTION_AVAILABLE=1
- # Test available tools for Linux
- if [ -f "${ROOTDIR}bin/auter" ]; then
- UNATTENDED_UPGRADES_TOOL="auter"
- UNATTENDED_UPGRADES_TOOLKIT=1
- LogText "Result: found ${UNATTENDED_UPGRADES_TOOL}"
- Report "unattended_upgrade_tool[]=${UNATTENDED_UPGRADES_TOOL}"
- fi
- if [ -f "${ROOTDIR}sbin/yum-cron" ]; then
- UNATTENDED_UPGRADES_TOOL="yum-cron"
- UNATTENDED_UPGRADES_TOOLKIT=1
- LogText "Result: found ${UNATTENDED_UPGRADES_TOOL}"
- Report "unattended_upgrade_tool[]=${UNATTENDED_UPGRADES_TOOL}"
- fi
- if [ -f "${ROOTDIR}usr/bin/dnf-automatic" ]; then
- UNATTENDED_UPGRADES_TOOL="dnf-automatic"
- UNATTENDED_UPGRADES_TOOLKIT=1
- LogText "Result: found ${UNATTENDED_UPGRADES_TOOL}"
- Report "unattended_upgrade_tool[]=${UNATTENDED_UPGRADES_TOOL}"
- fi
- if [ -f "${ROOTDIR}usr/bin/unattended-upgrade" ]; then
- UNATTENDED_UPGRADES_TOOL="unattended-upgrade"
- UNATTENDED_UPGRADES_TOOLKIT=1
- LogText "Result: found ${UNATTENDED_UPGRADES_TOOL}"
- Report "unattended_upgrade_tool[]=${UNATTENDED_UPGRADES_TOOL}"
- fi
- ;;
- esac
+ fi
+ done
+
+ if [ $UNATTENDED_UPGRADES_OPTION_AVAILABLE -eq 1 ]; then
+ # Test available tools for Linux
+ if [ -f "${ROOTDIR}bin/auter" ]; then
+ UNATTENDED_UPGRADES_TOOL="auter"
+ UNATTENDED_UPGRADES_TOOLKIT=1
+ LogText "Result: found ${UNATTENDED_UPGRADES_TOOL}"
+ Report "unattended_upgrade_tool[]=${UNATTENDED_UPGRADES_TOOL}"
+ fi
+ if [ -f "${ROOTDIR}sbin/yum-cron" ]; then
+ UNATTENDED_UPGRADES_TOOL="yum-cron"
+ UNATTENDED_UPGRADES_TOOLKIT=1
+ LogText "Result: found ${UNATTENDED_UPGRADES_TOOL}"
+ Report "unattended_upgrade_tool[]=${UNATTENDED_UPGRADES_TOOL}"
+ fi
+ if [ -f "${ROOTDIR}usr/bin/dnf-automatic" ]; then
+ UNATTENDED_UPGRADES_TOOL="dnf-automatic"
+ UNATTENDED_UPGRADES_TOOLKIT=1
+ LogText "Result: found ${UNATTENDED_UPGRADES_TOOL}"
+ Report "unattended_upgrade_tool[]=${UNATTENDED_UPGRADES_TOOL}"
+ fi
+ if [ -f "${ROOTDIR}usr/bin/unattended-upgrade" ]; then
+ UNATTENDED_UPGRADES_TOOL="unattended-upgrade"
+ UNATTENDED_UPGRADES_TOOLKIT=1
+ LogText "Result: found ${UNATTENDED_UPGRADES_TOOL}"
+ Report "unattended_upgrade_tool[]=${UNATTENDED_UPGRADES_TOOL}"
+ fi
+ fi
;;
esac