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

Align RHEL 7 CIS control file with CIS v4.0.0 - Section 5 #11456

Merged
merged 74 commits into from
Jan 24, 2024

Conversation

jan-cerny
Copy link
Collaborator

@jan-cerny jan-cerny commented Jan 18, 2024

Description:

In this PR, we change the control file, change references, add existing rules. But, we don't add new rules.

Rationale:

Align RHEL 7 CIS control file with CIS v4.0.0

Review Hints:

@jan-cerny jan-cerny added RHEL7 Red Hat Enterprise Linux 7 product related. CIS CIS Benchmark related. labels Jan 18, 2024
@jan-cerny jan-cerny added this to the 0.1.72 milestone Jan 18, 2024
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Used by openshift-ci bot. label Jan 18, 2024
Copy link

openshift-ci bot commented Jan 18, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link

github-actions bot commented Jan 18, 2024

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

@jan-cerny jan-cerny force-pushed the rhel7_cis_section_5 branch from 41098a4 to 0d22624 Compare January 19, 2024 09:28
@jan-cerny
Copy link
Collaborator Author

The CI fail on Rawhide is caused by aio-libs/multidict#926 and isn't related to the pull request.

Copy link

github-actions bot commented Jan 19, 2024

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

Click here to see the full diff
bash remediation for rule 'xccdf_org.ssgproject.content_rule_auditd_data_retention_space_left_action' differs.
--- xccdf_org.ssgproject.content_rule_auditd_data_retention_space_left_action
+++ xccdf_org.ssgproject.content_rule_auditd_data_retention_space_left_action
@@ -4,6 +4,7 @@
 var_auditd_space_left_action=''
 
 
+var_auditd_space_left_action="$(echo $var_auditd_space_left_action | cut -d \| -f 1)"
 #
 # If space_left_action present in /etc/audit/auditd.conf, change value
 # to var_auditd_space_left_action, else

ansible remediation for rule 'xccdf_org.ssgproject.content_rule_auditd_data_retention_space_left_action' differs.
--- xccdf_org.ssgproject.content_rule_auditd_data_retention_space_left_action
+++ xccdf_org.ssgproject.content_rule_auditd_data_retention_space_left_action
@@ -28,7 +28,7 @@
 - name: Configure auditd space_left Action on Low Disk Space
   lineinfile:
     dest: /etc/audit/auditd.conf
-    line: space_left_action = {{ var_auditd_space_left_action }}
+    line: space_left_action = {{ var_auditd_space_left_action.split('|')[0] }}
     regexp: ^\s*space_left_action\s*=\s*.*$
     state: present
     create: true

New content has different text for rule 'xccdf_org.ssgproject.content_rule_package_systemd-journal-remote_installed'.
--- xccdf_org.ssgproject.content_rule_package_systemd-journal-remote_installed
+++ xccdf_org.ssgproject.content_rule_package_systemd-journal-remote_installed
@@ -14,3 +14,6 @@
 Storing log data on a remote host protects log integrity from local
 attacks. If an attacker gains root access on the local system, they
 could tamper with or remove log data that is stored on the local system.
+
+[ident]:
+CCE-86467-8

ansible remediation for rule 'xccdf_org.ssgproject.content_rule_package_systemd-journal-remote_installed' differs.
--- xccdf_org.ssgproject.content_rule_package_systemd-journal-remote_installed
+++ xccdf_org.ssgproject.content_rule_package_systemd-journal-remote_installed
@@ -4,6 +4,7 @@
     state: present
   when: ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]
   tags:
+  - CCE-86467-8
   - enable_strategy
   - low_complexity
   - low_disruption

@jan-cerny jan-cerny marked this pull request as ready for review January 19, 2024 15:38
@jan-cerny jan-cerny requested a review from a team as a code owner January 19, 2024 15:38
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Used by openshift-ci bot. label Jan 19, 2024
Add support for pipe character separated values of the variables.
We started to use the pipe character separated values in
RHEL 7 CIS where we set `var_auditd_space_left_action` to
`email|exec|single|halt`. This change is similar to code that we
have in rule `auditd_data_disk_full_action`.
Add support for pipe character separated values of the variables.
We started to use the pipe character separated values in
RHEL 7 CIS where we set `var_auditd_space_left_action` to
`email|exec|single|halt`. This change is similar to code that we
have in rule `auditd_data_disk_full_action`.
@jan-cerny jan-cerny force-pushed the rhel7_cis_section_5 branch from e587adb to 24d9d20 Compare January 22, 2024 10:34
@jan-cerny
Copy link
Collaborator Author

I have rebased this PR on the top of the latest upstream master branch.

@marcusburghardt marcusburghardt self-assigned this Jan 22, 2024
Copy link
Member

@marcusburghardt marcusburghardt left a comment

Choose a reason for hiding this comment

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

Nice work. I only have some few comments to take a look.

controls/cis_rhel7.yml Outdated Show resolved Hide resolved
controls/cis_rhel7.yml Outdated Show resolved Hide resolved
controls/cis_rhel7.yml Outdated Show resolved Hide resolved
controls/cis_rhel7.yml Show resolved Hide resolved
controls/cis_rhel7.yml Outdated Show resolved Hide resolved
controls/cis_rhel7.yml Outdated Show resolved Hide resolved
@jan-cerny
Copy link
Collaborator Author

I have done changes according to @marcusburghardt's comments.

levels:
- l1_server
- l1_workstation
status: partial
Copy link
Member

@marcusburghardt marcusburghardt Jan 23, 2024

Choose a reason for hiding this comment

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

The status now can be updated to automated and the comment can be removed.

@jan-cerny
Copy link
Collaborator Author

I have updated the status and removed the comment.

Copy link
Member

@marcusburghardt marcusburghardt left a comment

Choose a reason for hiding this comment

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

Great. Thanks for the nice work @jan-cerny . I will wait the CI tests to confirm everything is good and merge it.

Copy link

codeclimate bot commented Jan 24, 2024

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

View more on Code Climate.

@marcusburghardt
Copy link
Member

I checked the failed Automatus tests and they are failing during the clean-up, after the rule tests.
There are no issues testing the rules, so the tests can be safely waived in this particular case.

We are investigating the issue with automatus task "Delete datastream artifact".

@marcusburghardt marcusburghardt merged commit 86ccadb into ComplianceAsCode:master Jan 24, 2024
37 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CIS CIS Benchmark related. RHEL7 Red Hat Enterprise Linux 7 product related.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants