-
Notifications
You must be signed in to change notification settings - Fork 765
Changes in SLE 12/15 profiles to support logrotate service #10796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes in SLE 12/15 profiles to support logrotate service #10796
Conversation
|
Hi @rumch-se. Thanks for your PR. I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
@rumch-se , please take a look in the CI tests. A lot is failing. It might be related to the Another point, I would suggest to not create the dependency relationship in this way. You could define a package platform in the |
|
This datastream diff is auto generated by the check Click here to see the full diffNew content has different text for rule 'xccdf_org.ssgproject.content_rule_package_logrotate_installed'.
--- xccdf_org.ssgproject.content_rule_package_logrotate_installed
+++ xccdf_org.ssgproject.content_rule_package_logrotate_installed
@@ -6,7 +6,7 @@
logrotate is installed by default. The logrotate package can be installed with the following command: $ sudo yum install logrotate
[reference]:
-BP28(R43)
+BP28(R71)
[reference]:
NT12(R18)
New content has different text for rule 'xccdf_org.ssgproject.content_rule_ensure_logrotate_activated'.
--- xccdf_org.ssgproject.content_rule_ensure_logrotate_activated
+++ xccdf_org.ssgproject.content_rule_ensure_logrotate_activated
@@ -11,7 +11,7 @@
daily
[reference]:
-BP28(R43)
+BP28(R71)
[reference]:
NT12(R18)
OVAL for rule 'xccdf_org.ssgproject.content_rule_ensure_logrotate_activated' differs.
--- oval:ssg-ensure_logrotate_activated:def:1
+++ oval:ssg-ensure_logrotate_activated:def:1
@@ -1,6 +1,6 @@
criteria AND
+extend_definition oval:ssg-package_logrotate_installed:def:1
criterion oval:ssg-test_logrotate_conf_daily_setting:tst:1
criterion oval:ssg-test_logrotate_conf_no_other_keyword:tst:1
criteria OR
criterion oval:ssg-test_cron_daily_logrotate_existence:tst:1
-extend_definition oval:ssg-timer_logrotate_enabled:def:1
bash remediation for rule 'xccdf_org.ssgproject.content_rule_ensure_logrotate_activated' differs.
--- xccdf_org.ssgproject.content_rule_ensure_logrotate_activated
+++ xccdf_org.ssgproject.content_rule_ensure_logrotate_activated
@@ -1,5 +1,5 @@
# Remediation is applicable only in certain platforms
-if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ]; then
+if [ ! -f /.dockerenv ] && [ ! -f /run/.containerenv ] && { rpm --quiet -q logrotate; }; then
LOGROTATE_CONF_FILE="/etc/logrotate.conf"
ansible remediation for rule 'xccdf_org.ssgproject.content_rule_ensure_logrotate_activated' differs.
--- xccdf_org.ssgproject.content_rule_ensure_logrotate_activated
+++ xccdf_org.ssgproject.content_rule_ensure_logrotate_activated
@@ -1,10 +1,27 @@
+- name: Gather the package facts
+ package_facts:
+ manager: auto
+ tags:
+ - CCE-80794-1
+ - NIST-800-53-CM-6(a)
+ - PCI-DSS-Req-10.7
+ - PCI-DSSv4-10.5.1
+ - configure_strategy
+ - ensure_logrotate_activated
+ - low_complexity
+ - low_disruption
+ - medium_severity
+ - no_reboot_needed
+
- name: Configure daily log rotation in /etc/logrotate.conf
lineinfile:
create: true
dest: /etc/logrotate.conf
regexp: ^daily$
line: daily
- when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
+ when:
+ - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
+ - '"logrotate" in ansible_facts.packages'
tags:
- CCE-80794-1
- NIST-800-53-CM-6(a)
@@ -23,7 +40,9 @@
dest: /etc/logrotate.conf
regexp: ^[\s]*(weekly|monthly|yearly)$
state: absent
- when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
+ when:
+ - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
+ - '"logrotate" in ansible_facts.packages'
tags:
- CCE-80794-1
- NIST-800-53-CM-6(a)
@@ -51,7 +70,9 @@
path: /etc/cron.daily/logrotate
line: /usr/sbin/logrotate /etc/logrotate.conf
regexp: ^[\s]*/usr/sbin/logrotate[\s\S]*/etc/logrotate.conf$
- when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
+ when:
+ - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
+ - '"logrotate" in ansible_facts.packages'
tags:
- CCE-80794-1
- NIST-800-53-CM-6(a)
Platform has been changed for rule 'xccdf_org.ssgproject.content_rule_ensure_logrotate_activated'
--- xccdf_org.ssgproject.content_rule_ensure_logrotate_activated
+++ xccdf_org.ssgproject.content_rule_ensure_logrotate_activated
@@ -1 +1 @@
-
+oval:ssg-package_logrotate:def:1
xccdf_org.ssgproject.content_rule_timer_logrotate_enabled is missing in new datastream. |
|
Hello @marcusburghardt I will provide some additional details about this rule. 1.There is a dependency between the rule ensure_logrotate_activated and the rules package_logrotate_installed and timer_logrotate_enabled. I did a new commit in which I removed prodtype: sle12,sle15 from the rules package_logrotate_installed and timer_logrotate_enabled, but you can see from it, that we have: The following tests FAILED: In this case we have something like a "egg and chicken paradox" - when we have prodtypes sle12,15 - we have errors, but when we don't have them we again have errors, because RedHat had not added CCE codes to 2 rules. I think that some changes should be done on the RedHat site - this issue to be resolved, but I am not in the position to make these changes. Have a nice day |
@marcusburghardt @rumch-se check if this 086935e workaround for failing CCE tests is reasonable from your point of view |
@teacup-on-rockingchair would work, but I just reviewed those rules and the CIS benchmarks for RHEL and we can make it simpler. The relevant requirement is |
|
PR is sent: #10904 As soon as it is merged, you can rebase this PR and we should no longer have issues with CCEs. |
0d6c6db to
eb7cc3a
Compare
…d timer_logrotate_enabled
eb7cc3a to
5df17b4
Compare
teacup-on-rockingchair
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With common of effort @rumch-se and @marcusburghardt we managed to pushed this one 🎆
|
There is one required test failing and the error seems legit: I will run some local tests to get more details. |
That is strange why it attempts to run that task at the first place on centos. Maybe the problem is with my condition being |
I can't see any jinja2 condition in this PR. The issue is caused when trying to remediate the |
linux_os/guide/system/logging/log_rotation/timer_logrotate_enabled/rule.yml
Show resolved
Hide resolved
I thought that the error is in ./linux_os/guide/system/logging/log_rotation/ensure_logrotate_activated/ansible/shared.yml, where there is a a check if product is
For sure in SLE12-SP5 - we have the package version 3.11.0, and the timer defined, so putting a version 3.14 will make the rule there inapplicable, while it can be used. |
Ok. In this case the suggested update to the platform is not good. |
…efined Make sure ensure_logrotate_activated oval check does not fail when there is no logrotate time
07482fc to
684827f
Compare
Added |
linux_os/guide/system/logging/log_rotation/timer_logrotate_enabled/rule.yml
Outdated
Show resolved
Hide resolved
linux_os/guide/system/logging/log_rotation/ensure_logrotate_activated/oval/shared.xml
Outdated
Show resolved
Hide resolved
…tivated/oval/shared.xml Co-authored-by: Marcus Burghardt <2074099+marcusburghardt@users.noreply.github.com>
…bled/rule.yml Co-authored-by: Marcus Burghardt <2074099+marcusburghardt@users.noreply.github.com>
marcusburghardt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
|
Code Climate has analyzed commit be538b9 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 53.2% (0.0% change). View more on Code Climate. |
| The frequency of automatic log files rotation performed by the logrotate utility should be configured to run daily | ||
| ") }}} | ||
| <criteria comment="/etc/logrotate.conf contains daily setting and /etc/cron.daily/logrotate file exists" operator="AND"> | ||
| <extend_definition comment="package logrotate installed" definition_ref="package_logrotate_installed" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this extended_definition is necessary when the rule has platform: package[logrotate]
Description:
Rationale: