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>2019-03-30 15:31:03 +0300
committerMichael Boelen <michael.boelen@cisofy.com>2019-03-30 15:31:03 +0300
commit3660043308d5ad56c0e767f64deea41107ca5330 (patch)
treeb1babb78a5af2f8b9a97fa66339bab823d7af7de /include/tests_ports_packages
parentabaed3e6c1fabb172d187c943cf75634719e69ac (diff)
[PKGS-7420] limit test to specific OS, add dnf-automatic support, extend logging
Diffstat (limited to 'include/tests_ports_packages')
-rw-r--r--include/tests_ports_packages76
1 files changed, 49 insertions, 27 deletions
diff --git a/include/tests_ports_packages b/include/tests_ports_packages
index 05f150a6..9798a9b7 100644
--- a/include/tests_ports_packages
+++ b/include/tests_ports_packages
@@ -1284,35 +1284,57 @@
if [ ${SKIPTEST} -eq 0 ]; then
UNATTENDED_UPGRADES_TOOLKIT=0
UNATTENDED_UPGRADES_TOOL=""
- if [ -f "${ROOTDIR}bin/auter" ]; then
- UNATTENDED_UPGRADES_TOOL="auter"
- UNATTENDED_UPGRADES_TOOLKIT=1
- LogText "Result: found ${UNATTENDED_UPGRADES_TOOL}"
- Report "unattended_upgrade_tool[]=auter"
- 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[]=yum-cron"
- 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-upgrade"
- fi
- if [ ${UNATTENDED_UPGRADES_TOOLKIT} -eq 1 ]; then
- AddHP 5 5
- Display --indent 2 --text "- Toolkit for automatic upgrades (${UNATTENDED_UPGRADES_TOOL})" --result "${STATUS_FOUND}" --color GREEN
- else
- # TODO - Add logic to only display this when it is applicable as not all operating systems might support such tooling
- AddHP 1 5
- Display --indent 2 --text "- Toolkit for automatic upgrades" --result "${STATUS_NOTFOUND}" --color YELLOW
- LogText "Result: no toolkit for automatic updates discovered"
- # TODO - add suggestion
+ UNATTENDED_UPGRADES_OPTION_AVAILABLE=0
+
+ case "${OS}" in
+ "Linux")
+ case "${LINUX_VERSION}" in
+ "CentOS" | "Debian" | "Fedora" | "RHEL" | "Ubuntu")
+
+ 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
+ ;;
+ esac
+
+ if [ ${UNATTENDED_UPGRADES_OPTION_AVAILABLE} -eq 1 ]; then
+ if [ ${UNATTENDED_UPGRADES_TOOLKIT} -eq 1 ]; then
+ AddHP 5 5
+ Display --indent 2 --text "- Toolkit for automatic upgrades (${UNATTENDED_UPGRADES_TOOL})" --result "${STATUS_FOUND}" --color GREEN
+ else
+ AddHP 1 5
+ Display --indent 2 --text "- Toolkit for automatic upgrades" --result "${STATUS_NOTFOUND}" --color YELLOW
+ LogText "Result: no toolkit for automatic updates discovered"
+ ReportSuggestion "${TEST_NO}" "Consider using a tool to automatically apply upgrades"
+ fi
fi
+ Report "unattended_upgrade_option_avaiable=${UNATTENDED_UPGRADES_OPTION_AVAILABLE}"
fi
#
#################################################################################