Skip to content

Conversation

@vojtapolasek
Copy link
Collaborator

Description:

  • for rhel* products, ensure that Grubby is not used to update the Grub2 configuration but proper grub2-mkconfig command is used instead
  • when checking for superusers variable, check also that the variable is exported
    • add proper test scenarios

Rationale:

These fixes are based on findings in https://issues.redhat.com/browse/RHEL-58818

Review Hints:

  • build content for rhel and non-rhel product and compare changes in rule descriptions
  • run Automatus tests on grub2_(uefi_)?(admin_user|password)

@vojtapolasek vojtapolasek added this to the 0.1.77 milestone May 15, 2025
@vojtapolasek vojtapolasek added RHEL Red Hat Enterprise Linux product related. Update Rule Issues or pull requests related to Rules updates. labels May 15, 2025
@github-actions
Copy link

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_grub2_admin_username'.
--- xccdf_org.ssgproject.content_rule_grub2_admin_username
+++ xccdf_org.ssgproject.content_rule_grub2_admin_username
@@ -17,12 +17,15 @@
         
 Change the superuser to a different username (The default is 'root').
 $ sed -i 's/\(set superusers=\).*/\1"<unique user ID>"/g' /etc/grub.d/01_users
-        
+The line mentioned above must be followed by the line
+export superusers
+so that the superusers is honored.
+
         
 Once the superuser account has been added,
 update the
 grub.cfg file by running:
-grubby --update-kernel=ALL --env=/boot/grub2/grubenv
+grub-mkconfig -o /boot/grub2/grub.cfg
 
 [warning]:
 To prevent hard-coded admin usernames, automatic remediation of this control is not available. Remediation

New content has different text for rule 'xccdf_org.ssgproject.content_rule_grub2_uefi_admin_username'.
--- xccdf_org.ssgproject.content_rule_grub2_uefi_admin_username
+++ xccdf_org.ssgproject.content_rule_grub2_uefi_admin_username
@@ -17,12 +17,15 @@
         
 Change the superuser to a different username (The default is 'root').
 $ sed -i 's/\(set superusers=\).*/\1"<unique user ID>"/g' /etc/grub.d/01_users
-        
+The line mentioned above must be followed by the line
+export superusers
+so that the superusers is honored.
+
         
 Once the superuser account has been added,
 update the
 grub.cfg file by running:
-grubby --update-kernel=ALL --env=/boot/grub2/grubenv
+grub-mkconfig -o /boot/grub2/grub.cfg
 
 [warning]:
 To prevent hard-coded admin usernames, automatic remediation of this control is not available. Remediation

@qlty-cloud-legacy
Copy link

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

View more on Code Climate.

@jan-cerny jan-cerny self-assigned this May 16, 2025
Copy link
Collaborator

@jan-cerny jan-cerny left a comment

Choose a reason for hiding this comment

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

I have run test scenarios on RHEL 8 and RHEL 9 and they passed.

@jan-cerny jan-cerny merged commit fe38855 into ComplianceAsCode:master May 16, 2025
102 of 108 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RHEL Red Hat Enterprise Linux product related. Update Rule Issues or pull requests related to Rules updates.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants