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

[stabilization] Fix zipl_bootmap_is_up_to_date #11986

Conversation

jan-cerny
Copy link
Collaborator

This is a back port of PR #11980 to the stabilization-v0.1.73 branch.

First, we prioritize order of all zIPL rules that are changing the bootloader arguments in order to put them before
zipl_bootmap_is_up_to_date. This should ensure that the fixed rule zipl_bootmap_is_up_to_date isn't broken by remediations executed later.

Second, we align the Ansible remediation in zipl_bootmap_is_up_to_date to consider modification time of /boot/loader/entries/.

Fixes #11944

First, we prioritize order of all zIPL rules that are changing the
bootloader arguments in order to put them before
zipl_bootmap_is_up_to_date. This should ensure that the fixed rule
zipl_bootmap_is_up_to_date isn't broken by remediations executed later.

Second, we align the Ansible remediation in zipl_bootmap_is_up_to_date
to consider modification time of /boot/loader/entries/.

Fixes ComplianceAsCode#11944
@jan-cerny jan-cerny added the backported-into-stabilization PRs which were cherry-picked during stabilization process. label May 10, 2024
@jan-cerny jan-cerny added this to the 0.1.73 milestone May 10, 2024
Copy link

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

Copy link

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

Click here to see the full diff
ansible remediation for rule 'xccdf_org.ssgproject.content_rule_zipl_bootmap_is_up_to_date' differs.
--- xccdf_org.ssgproject.content_rule_zipl_bootmap_is_up_to_date
+++ xccdf_org.ssgproject.content_rule_zipl_bootmap_is_up_to_date
@@ -11,11 +11,20 @@
       path: /etc/zipl.conf
     register: zipl_conf
 
+  - name: Obtain stats of /boot/loader/entries
+    stat:
+      path: /boot/loader/entries
+    register: boot_loader_entries
+
   - name: Update zIPL bootmap
     command: /usr/sbin/zipl
     changed_when: true
-    when: boot_bootmap.stat.mtime is defined and zipl_conf.stat.mtime is defined and  boot_bootmap.stat.mtime
-      < zipl_conf.stat.mtime
+    when:
+    - boot_bootmap.stat.mtime is defined
+    - zipl_conf.stat.mtime is defined
+    - boot_loader_entries.stat.mtime is defined
+    - boot_bootmap.stat.mtime < zipl_conf.stat.mtime or boot_bootmap.stat.mtime <
+      boot_loader_entries.stat.mtime
   when:
   - ansible_architecture == "s390x"
   - ansible_virtualization_type not in ["docker", "lxc", "openvz", "podman", "container"]

Copy link

🤖 A k8s content image for this PR is available at:
ghcr.io/complianceascode/k8scontent:11986
This image was built from commit: 47b6fbf

Click here to see how to deploy it

If you alread have Compliance Operator deployed:
utils/build_ds_container.py -i ghcr.io/complianceascode/k8scontent:11986

Otherwise deploy the content and operator together by checking out ComplianceAsCode/compliance-operator and:
CONTENT_IMAGE=ghcr.io/complianceascode/k8scontent:11986 make deploy-local

@vojtapolasek vojtapolasek self-assigned this May 10, 2024
Copy link
Collaborator

@vojtapolasek vojtapolasek left a comment

Choose a reason for hiding this comment

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

Looks good. Automatus tests fail because they are not running on s390x platform.
I tested in on a s390x machine by remediating the cui playbook and then performing oscap scan. The rule zipl_bootmap_is_up_to_date passes.

@vojtapolasek vojtapolasek merged commit e11688f into ComplianceAsCode:stabilization-v0.1.73 May 10, 2024
100 of 103 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backported-into-stabilization PRs which were cherry-picked during stabilization process.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants