From f548a0655099be3a6e2612b7fd77ddfebcb1b220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= Date: Wed, 27 Nov 2024 16:56:02 +0100 Subject: [PATCH] Update ensure_logrotate_activated for image mode This rule will be reworked to work well during a bootable container image build. First, the OVAL will use an internal check for the logrotate timer instead of extend_definition which uses OVAL systemdunitproperty test which doesn't work in that environment. Second, we will installed crontabs package to make sure that the files required by the bash remediation are present. --- .../ensure_logrotate_activated/bash/shared.sh | 1 + .../oval/shared.xml | 22 +++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/linux_os/guide/system/logging/log_rotation/ensure_logrotate_activated/bash/shared.sh b/linux_os/guide/system/logging/log_rotation/ensure_logrotate_activated/bash/shared.sh index 92010c35f95..f7b052b3e21 100644 --- a/linux_os/guide/system/logging/log_rotation/ensure_logrotate_activated/bash/shared.sh +++ b/linux_os/guide/system/logging/log_rotation/ensure_logrotate_activated/bash/shared.sh @@ -4,6 +4,7 @@ LOGROTATE_CONF_FILE="/etc/logrotate.conf" {{% if 'sle' in product %}} SYSTEMCTL_EXEC='/usr/bin/systemctl' {{% else %}} +{{{ bash_package_install("crontabs") }}} CRON_DAILY_LOGROTATE_FILE="/etc/cron.daily/logrotate" {{% endif %}} diff --git a/linux_os/guide/system/logging/log_rotation/ensure_logrotate_activated/oval/shared.xml b/linux_os/guide/system/logging/log_rotation/ensure_logrotate_activated/oval/shared.xml index 19a4028a0ae..a13b81a329c 100644 --- a/linux_os/guide/system/logging/log_rotation/ensure_logrotate_activated/oval/shared.xml +++ b/linux_os/guide/system/logging/log_rotation/ensure_logrotate_activated/oval/shared.xml @@ -11,8 +11,8 @@ test_ref="test_logrotate_conf_no_other_keyword" /> -{{% if product in ["rhcos4", "rhel9", "sle12", "sle15","ol9"] %}} - +{{% if product in ["rhcos4", "rhel9", "rhel10", "sle12", "sle15", "ol9"] %}} + {{% endif %}} @@ -54,4 +54,22 @@ 1 +{{% if product in ["rhcos4", "rhel9", "rhel10", "sle12", "sle15", "ol9"] %}} + + + + + + /etc/systemd/system/multi-user.target.wants/logrotate.timer + unit_logrotate_state_symlink + + + + symbolic link + +{{% endif %}} +