Skip to content
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

RHCOS4: Updated rule for rhel9 based RHCOS #10343

Merged
merged 3 commits into from
Mar 24, 2023

Conversation

Vincent056
Copy link
Contributor

@Vincent056 Vincent056 commented Mar 21, 2023

Description:

Added a new CPE for RHEL9 RHCOS, disabled iptables rule for rhel9-rhcos4, and added a new rule to detect if iptables-nft is being installed.

Fix rule ensure_logrotate_activated.

Rationale:

iptables is being replaced by iptables-nft in RHEL9 based RHCOS.

The newer logrotate use systemd timer instead of cron.

@Vincent056 Vincent056 force-pushed the rhcos4-rhel9 branch 2 times, most recently from f5d6aea to 3ee1cfc Compare March 21, 2023 03:59
@github-actions
Copy link

github-actions bot commented Mar 21, 2023

Start a new ephemeral environment with changes proposed in this pull request:

rhel8 (from CTF) Environment (using Fedora as testing environment)
Open in Gitpod

Fedora Testing Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

@github-actions
Copy link

github-actions bot commented Mar 21, 2023

This datastream diff is auto generated by the check Compare DS/Generate Diff

Click here to see the full diff
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
@@ -5,7 +5,7 @@
 [description]:
 The logrotate utility allows for the automatic rotation of
 log files. The frequency of rotation is specified in /etc/logrotate.conf,
-which triggers a cron task. To configure logrotate to run daily, add or correct
+which triggers a cron task or a timer. To configure logrotate to run daily, add or correct
 the following line in /etc/logrotate.conf:
 # rotate log files frequency
 daily

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,4 +1,6 @@
 criteria AND
 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

@Vincent056 Vincent056 force-pushed the rhcos4-rhel9 branch 3 times, most recently from 57880b9 to 8ca6e26 Compare March 21, 2023 04:57
test_ref="test_cron_daily_logrotate_existence" />
<criteria comment="Check if either logrotate timer or cron job is eneabled" operator="OR">
<criterion comment="Check if /etc/cron.daily/logrotate file exists (and calls logrotate)" test_ref="test_cron_daily_logrotate_existence" />
<extend_definition comment="check kubeletconfig master" definition_ref="timer_logrotate_enabled" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy-paste?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol, yes

@@ -8,8 +8,10 @@
test_ref="test_logrotate_conf_daily_setting" />
<criterion comment="check that there is no weekly/monthly/yearly keyword in logrotate.conf"
test_ref="test_logrotate_conf_no_other_keyword" />
<criterion comment="Check if /etc/cron.daily/logrotate file exists (and calls logrotate)"
test_ref="test_cron_daily_logrotate_existence" />
<criteria comment="Check if either logrotate timer or cron job is eneabled" operator="OR">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: eneabled

@@ -0,0 +1,38 @@
documentation_complete: true

title: 'Ensure logrotate is Installed'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this rule used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's needed by timer enabled template

@jhrozek
Copy link
Collaborator

jhrozek commented Mar 21, 2023

/retest

1 similar comment
@jhrozek
Copy link
Collaborator

jhrozek commented Mar 21, 2023

/retest

We recently have Compliance Operator to build latest image using master branch, this PR change the CatalogSource image reference to that image.
@Vincent056
Copy link
Contributor Author

/retest

@Vincent056
Copy link
Contributor Author

/test e2e-aws-rhcos4-high

@Vincent056
Copy link
Contributor Author

/test e2e-aws-ocp4-high-node

@Vincent056
Copy link
Contributor Author

/test e2e-aws-ocp4-high

@jhrozek
Copy link
Collaborator

jhrozek commented Mar 23, 2023

/test e2e-aws-rhcos4-high
/test e2e-aws-rhcos4-e8
/test e2e-aws-rhcos4-moderate

@Vincent056
Copy link
Contributor Author

/test e2e-aws-rhcos4-high /test e2e-aws-rhcos4-e8 /test e2e-aws-rhcos4-moderate

I think I need to fix the CPE, probably have some issues with the regex matching, the other fix has worked.

@Vincent056
Copy link
Contributor Author

/test e2e-aws-rhcos4-high
/test e2e-aws-rhcos4-e8
/test e2e-aws-rhcos4-moderate

1 similar comment
@Vincent056
Copy link
Contributor Author

/test e2e-aws-rhcos4-high
/test e2e-aws-rhcos4-e8
/test e2e-aws-rhcos4-moderate

@Vincent056
Copy link
Contributor Author

/test e2e-aws-rhcos4-high

@Vincent056
Copy link
Contributor Author

/test e2e-aws-rhcos4-high
/test e2e-aws-rhcos4-e8
/test e2e-aws-rhcos4-moderate

@openshift-ci
Copy link

openshift-ci bot commented Mar 24, 2023

@Vincent056: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-aws-ocp4-pci-dss 8ca6e26 link true /test e2e-aws-ocp4-pci-dss
ci/prow/e2e-aws-ocp4-pci-dss-node 8ca6e26 link true /test e2e-aws-ocp4-pci-dss-node
ci/prow/e2e-aws-ocp4-moderate 8ca6e26 link true /test e2e-aws-ocp4-moderate
ci/prow/e2e-aws-ocp4-cis-node 8ca6e26 link true /test e2e-aws-ocp4-cis-node
ci/prow/e2e-aws-ocp4-stig-node 8ca6e26 link true /test e2e-aws-ocp4-stig-node
ci/prow/e2e-aws-ocp4-e8 8ca6e26 link true /test e2e-aws-ocp4-e8
ci/prow/e2e-aws-ocp4-stig 8ca6e26 link true /test e2e-aws-ocp4-stig
ci/prow/e2e-aws-ocp4-cis 8ca6e26 link true /test e2e-aws-ocp4-cis
ci/prow/e2e-aws-ocp4-moderate-node 8ca6e26 link true /test e2e-aws-ocp4-moderate-node
ci/prow/e2e-aws-ocp4-high 3d869aa link true /test e2e-aws-ocp4-high

Full PR test history. Your PR dashboard.

Instructions 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. I understand the commands that are listed here.

@Vincent056
Copy link
Contributor Author

/test e2e-aws-rhcos4-high

@Vincent056 Vincent056 force-pushed the rhcos4-rhel9 branch 3 times, most recently from aa07865 to 2bd6cfb Compare March 24, 2023 04:32
@Vincent056
Copy link
Contributor Author

/test e2e-aws-rhcos4-high
/test e2e-aws-rhcos4-e8
/test e2e-aws-rhcos4-moderate

Added a new CPE for rhel9 rhcos, disabled iptables rule for rhel9-rhcos4, iptables is being replaced by iptables-nft. Added a new rule to detect if iptables-nft is being installed.
@Vincent056
Copy link
Contributor Author

/test e2e-aws-rhcos4-high
/test e2e-aws-rhcos4-e8
/test e2e-aws-rhcos4-moderate

@Vincent056
Copy link
Contributor Author

Changed expected e2e test result.

@codeclimate
Copy link

codeclimate bot commented Mar 24, 2023

Code Climate has analyzed commit f723e01 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 51.8% (0.0% change).

View more on Code Climate.

Copy link
Collaborator

@jhrozek jhrozek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jhrozek
Copy link
Collaborator

jhrozek commented Mar 24, 2023

Actually, let's hold the merge, the automatus failures look related...

@jhrozek
Copy link
Collaborator

jhrozek commented Mar 24, 2023

@Vincent056 it looks like we can ignore this error:

ERROR - Rule 'xccdf_org.ssgproject.content_rule_package_iptables-nft_installed' isn't present in benchmark 'xccdf_org.ssgproject.content_benchmark_RHEL-8' in '/tmp/ssgts-ds-ztez_y1t'

but what about this one?

 ERROR - Script logrotate_no_cron_daily.fail.sh using profile (all) found issue:
ERROR - Rule evaluation resulted in error, instead of expected fail during initial stage 
ERROR - The initial scan failed for rule 'xccdf_org.ssgproject.content_rule_ensure_logrotate_activated'.

@Vincent056
Copy link
Contributor Author

@Vincent056 it looks like we can ignore this error:

ERROR - Rule 'xccdf_org.ssgproject.content_rule_package_iptables-nft_installed' isn't present in benchmark 'xccdf_org.ssgproject.content_benchmark_RHEL-8' in '/tmp/ssgts-ds-ztez_y1t'

but what about this one?

 ERROR - Script logrotate_no_cron_daily.fail.sh using profile (all) found issue:
ERROR - Rule evaluation resulted in error, instead of expected fail during initial stage 
ERROR - The initial scan failed for rule 'xccdf_org.ssgproject.content_rule_ensure_logrotate_activated'.

systemd is not working in the fedora container, should we just remove this test? The e2e has passed, so the timer detection is working as expected.

@Vincent056
Copy link
Contributor Author

@Vincent056 it looks like we can ignore this error:

ERROR - Rule 'xccdf_org.ssgproject.content_rule_package_iptables-nft_installed' isn't present in benchmark 'xccdf_org.ssgproject.content_benchmark_RHEL-8' in '/tmp/ssgts-ds-ztez_y1t'

but what about this one?

 ERROR - Script logrotate_no_cron_daily.fail.sh using profile (all) found issue:
ERROR - Rule evaluation resulted in error, instead of expected fail during initial stage 
ERROR - The initial scan failed for rule 'xccdf_org.ssgproject.content_rule_ensure_logrotate_activated'.

systemd is not working in the fedora container, should we just ignore this issue, or remove this test? The e2e has passed, so the timer detection is working as expected.

System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

@jhrozek
Copy link
Collaborator

jhrozek commented Mar 24, 2023

systemd is not working in the fedora container, should we just remove this test? The e2e has passed, so the timer detection is working as expected.

I do not know why I missed this. Thank you.

@jhrozek jhrozek merged commit 2c18502 into ComplianceAsCode:master Mar 24, 2023
Mab879 added a commit to Mab879/content that referenced this pull request Mar 27, 2023
This is needed since ComplianceAsCode#10343 added test for the logrotate timer
Mab879 added a commit to Mab879/content that referenced this pull request Mar 27, 2023
This is needed since ComplianceAsCode#10343 added test for the logrotate timer
@marcusburghardt marcusburghardt added the OpenShift OpenShift product related. label Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OpenShift OpenShift product related.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants