From d26a98ca1921a99508267d333107e8121a970c99 Mon Sep 17 00:00:00 2001 From: Xavier Noguer Date: Fri, 2 Jun 2023 09:16:28 +0000 Subject: [PATCH] Checking debsums default file to make sure cron jobs are enabled --- include/tests_ports_packages | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/include/tests_ports_packages b/include/tests_ports_packages index 9ca1948d..1028d8fb 100644 --- a/include/tests_ports_packages +++ b/include/tests_ports_packages @@ -671,9 +671,20 @@ # Check in /etc/cron.hourly, daily, weekly, monthly etc COUNT=$(find /etc/cron* -name debsums | wc -l) if [ ${COUNT} -gt 0 ]; then - LogText "Result: Cron job is configured for debsums utility." - Display --indent 6 --text "- Cron job for debsums" --result "${STATUS_FOUND}" --color GREEN - AddHP 3 3 + CRON_CHECK="" + if [ -f ${ROOTDIR}etc/default/debsums ]; then + CRON_CHECK=$(${GREPBINARY} CRON_CHECK /etc/default/debsums|${AWKBINARY} -F "=" '{print $2}') + fi + if [ "${CRON_CHECK}" = "daily" ] || [ "${CRON_CHECK}" = "weekly" ] || [ "${CRON_CHECK}" = "monthly" ]; then + LogText "Result: Cron job is configured for debsums utility." + Display --indent 6 --text "- Cron job for debsums" --result "${STATUS_FOUND}" --color GREEN + AddHP 3 3 + else + LogText "Result: Cron job is not configured for debsums utility." + Display --indent 6 --text "- Cron job for debsums" --result "${STATUS_NOT_FOUND}" --color YELLOW + AddHP 1 3 + ReportSuggestion "${TEST_NO}" "Check debsums configuration and enable checking regularly via a cron job (CRON_CHECK in default file)." + fi else LogText "Result: Cron job is not configured for debsums utility." Display --indent 6 --text "- Cron job for debsums" --result "${STATUS_NOT_FOUND}" --color YELLOW