Skip to content

Support RHEL 8 cloud images in GRUB 2 rules#14535

Open
jan-cerny wants to merge 3 commits intoComplianceAsCode:masterfrom
jan-cerny:rhel8_cloud
Open

Support RHEL 8 cloud images in GRUB 2 rules#14535
jan-cerny wants to merge 3 commits intoComplianceAsCode:masterfrom
jan-cerny:rhel8_cloud

Conversation

@jan-cerny
Copy link
Collaborator

@jan-cerny jan-cerny commented Mar 6, 2026

Description:

This PR will extend checks in rules grub2_uefi_password and grub2_uefi_admin_username to support RHEL 8 cloud images.

It solves the different configuration location on the systems based on cloud images. On a normal RHEL 8, the GRUB configuration for UEFI is normally located at /boot/efi/EFI/redhat. However, in RHEL 8 cloud images (eg. AWS) the /boot/efi/EFI/redhat/ contains a stub pointing to /boot/grub2/ and the actual configuration is located at the /boot/grub2/ directory.

Example stub in /boot/efi/EFI/redhat/grub.cfg:

search --no-floppy --set prefix --file /boot/grub2/grub.cfg
set prefix=($prefix)/boot/grub2
configfile $prefix/grub.cfg

In this PR, we extend the OVAL check to account for this special configuration of the cloud images. The rules don't have remediations therefore we update only OVALs.

The PR adds some new simple test scenarios for both rules. On the other hand, it removes the test scenario invalid_username.fail.sh of rule grub2_uefi_password. This test tested configuring an invalid GRUB user name. The reason is that starting from #8438 the rule grub2_uefi_password no longer checks user names, it only checks passwords now, so an invalid user name can't make the rule fail.

Rationale:

Fixes: #13211

Review Hints:

Run automatus tests.

@jan-cerny jan-cerny added this to the 0.1.81 milestone Mar 6, 2026
@jan-cerny jan-cerny added the RHEL8 Red Hat Enterprise Linux 8 product related. label Mar 6, 2026
@jan-cerny jan-cerny requested a review from vojtapolasek as a code owner March 6, 2026 09:24
@github-actions
Copy link

github-actions bot commented Mar 6, 2026

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

Click here to see the full diff
OVAL for rule 'xccdf_org.ssgproject.content_rule_grub2_uefi_admin_username' differs.
--- oval:ssg-grub2_uefi_admin_username:def:1
+++ oval:ssg-grub2_uefi_admin_username:def:1
@@ -1,2 +1,5 @@
 criteria OR
 criterion oval:ssg-test_bootloader_uefi_superuser_differ_from_other_users:tst:1
+criteria AND
+criterion oval:ssg-test_grub2_uefi_admin_username_stub:tst:1
+criterion oval:ssg-test_bootloader_uefi_boot_superuser_differ_from_other_users:tst:1

OVAL for rule 'xccdf_org.ssgproject.content_rule_grub2_uefi_password' differs.
--- oval:ssg-grub2_uefi_password:def:1
+++ oval:ssg-grub2_uefi_password:def:1
@@ -1,2 +1,5 @@
 criteria OR
 criterion oval:ssg-test_grub2_uefi_password_usercfg:tst:1
+criteria AND
+criterion oval:ssg-test_grub2_uefi_password_stub:tst:1
+criterion oval:ssg-test_grub2_uefi_password_boot_usercfg:tst:1

On RHEL 8, the GRUB configuration for UEFI is normally located at
`/boot/efi/EFI/redhat`. However, in RHEL 8 cloud images (eg. AWS)
the `/boot/efi/EFI/redhat/` contains a stub pointing to
`/boot/grub2/` and the actual configuration is located at the
`/boot/grub2/` directory.

Example stub in `/boot/efi/EFI/redhat/grub.cfg`:
```
search --no-floppy --set prefix --file /boot/grub2/grub.cfg
set prefix=($prefix)/boot/grub2
configfile $prefix/grub.cfg
```

In this commit, we extend the check to account for this special
configuration of the cloud images.

Fixes: ComplianceAsCode#13211
Remove `invalid_username.fail.sh` that configures an invalid GRUB user
name. The reason is that starting from
ComplianceAsCode#8438 the rule
`grub2_uefi_password` no longer checks user names, it only checks
passwords now, no an invalid user name can't make the rule fail.
@jan-cerny
Copy link
Collaborator Author

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

@openshift-ci
Copy link

openshift-ci bot commented Mar 6, 2026

@jan-cerny: The following test 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-openshift-node-compliance 8a11579 link true /test e2e-aws-openshift-node-compliance

Full PR test history. Your PR dashboard.

Details

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-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RHEL8 Red Hat Enterprise Linux 8 product related.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RHEL 8 UEFI Bootloader check

1 participant