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

Update grub2_mitigation_argument #11271

Merged
merged 2 commits into from
Nov 30, 2023

Conversation

Xeicker
Copy link
Contributor

@Xeicker Xeicker commented Nov 13, 2023

Description:

  • Update grub2_mitigation_argument to use grub2_bootloader_argument_absent template instead of grub2_bootloader_argument. As STIG actually required 'not be off'

Rationale:

  • There was a typo on DISA STIG requirement instead of mitigation the option shoud be mitigations
  • STIG actually required mitigations to not be set to off, didn't ask for any specific value

There was a typo on mitigations argument, the 's' was missing in STIG
standard, so the error was reflected here. Fixing that.

Also update to better match requirement in the sense that mitigations
is enforced to not be off, instead of enforcing a particular value

Signed-off-by: Edgar Aguilar <edgar.aguilar@oracle.com>
@openshift-ci openshift-ci bot added the needs-ok-to-test Used by openshift-ci bot. label Nov 13, 2023
Copy link

openshift-ci bot commented Nov 13, 2023

Hi @Xeicker. Thanks for your PR.

I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

Copy link

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

ol8 (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

github-actions bot commented Nov 13, 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_grub2_mitigation_argument'.
--- xccdf_org.ssgproject.content_rule_grub2_mitigation_argument
+++ xccdf_org.ssgproject.content_rule_grub2_mitigation_argument
@@ -3,15 +3,10 @@
 System Must Avoid Meltdown and Spectre Exploit Vulnerabilities in Modern Processors
 
 [description]:
-Determine the default kernel:
-$ sudo grubby --default-kernel
+Verify that Meltdown mitigations are not disabled:
+$ sudo grubby --info=ALL | grep mitigations
 
-/boot/vmlinuz-5.4.17-2011.1.2.el8uek.x86_64
-
-Using the default kernel, verify that Meltdown mitigations are not disabled:
-$ sudo grubby --info=path-to-default-kernel | grep mitigation
-
-The mitigation must be set to "on".
+The mitigations must not be set to "off".
 
 [reference]:
 CCI-000366

OVAL for rule 'xccdf_org.ssgproject.content_rule_grub2_mitigation_argument' differs.
--- oval:ssg-grub2_mitigation_argument:def:1
+++ oval:ssg-grub2_mitigation_argument:def:1
@@ -1,10 +1,6 @@
 criteria AND
 criteria OR
-criterion oval:ssg-test_grub2_mitigation_argument_grub_env:tst:1
-criterion oval:ssg-test_grub2_mitigation_argument_grub_env_uefi:tst:1
-extend_definition oval:ssg-grub2_entries_reference_kernelopts:def:1
-criteria OR
-criterion oval:ssg-test_grub2_mitigation_argument:tst:1
+criterion oval:ssg-test_grub2_mitigations_off_argument_absent:tst:1
 criteria AND
-criterion oval:ssg-test_grub2_mitigation_argument_default:tst:1
+criterion oval:ssg-test_grub2_mitigations_off_argument_absent_default:tst:1
 extend_definition oval:ssg-bootloader_disable_recovery_set_to_true:def:1

OCIL for rule 'xccdf_org.ssgproject.content_rule_grub2_mitigation_argument' differs.
--- ocil:ssg-grub2_mitigation_argument_ocil:questionnaire:1
+++ ocil:ssg-grub2_mitigation_argument_ocil:questionnaire:1
@@ -1,14 +1,5 @@
-Inspect the form of default GRUB 2 command line for the Linux operating system
-in /etc/default/grub. If it includes mitigation=on,
-then the parameter will be configured for newly installed kernels.
-First check if the GRUB recovery is enabled:
-$ sudo grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub
-If this option is set to true, then check that a line is output by the following command:
-$ sudo grep 'GRUB_CMDLINE_LINUX_DEFAULT.*mitigation=on.*' /etc/default/grub
-If the recovery is disabled, check the line with
-$ sudo grep 'GRUB_CMDLINE_LINUX.*mitigation=on.*' /etc/default/grub.Moreover, command line parameters for currently installed kernels should be checked as well.
-Run the following command:
-$ sudo grubby --info=ALL | grep args | grep -v 'mitigation=on'
-The command should not return any output.
-      Is it the case that mitigation is not set to on?
+Verify that Meltdown mitigations are not disabled in any kernel:
+
+$ sudo grubby --info=ALL | grep mitigations
+      Is it the case that mitigations is set to off?
       
bash remediation for rule 'xccdf_org.ssgproject.content_rule_grub2_mitigation_argument' differs.
--- xccdf_org.ssgproject.content_rule_grub2_mitigation_argument
+++ xccdf_org.ssgproject.content_rule_grub2_mitigation_argument
@@ -1,7 +1,7 @@
 # Remediation is applicable only in certain platforms
 if rpm --quiet -q grub2-common; then
 
-grubby --update-kernel=ALL --args=mitigation=on --env=/boot/grub2/grubenv
+grubby --update-kernel=ALL --remove-args=mitigations=off --env=/boot/grub2/grubenv
 
 else
     >&2 echo 'Remediation is not applicable, nothing was done'

ansible remediation for rule 'xccdf_org.ssgproject.content_rule_grub2_mitigation_argument' differs.
--- xccdf_org.ssgproject.content_rule_grub2_mitigation_argument
+++ xccdf_org.ssgproject.content_rule_grub2_mitigation_argument
@@ -13,7 +13,7 @@
   - restrict_strategy
 
 - name: Update grub defaults and the bootloader menu
-  command: /sbin/grubby --update-kernel=ALL --args="mitigation=on"
+  command: /sbin/grubby --update-kernel=ALL --remove-args="mitigations=off"
   when: '"grub2-common" in ansible_facts.packages'
   tags:
   - DISA-STIG-OL08-00-010424

New data stream is missing blueprint remediation for rule 'xccdf_org.ssgproject.content_rule_grub2_mitigation_argument'.

@Mab879 Mab879 added this to the 0.1.71 milestone Nov 17, 2023
@Mab879 Mab879 added the Update Rule Issues or pull requests related to Rules updates. label Nov 17, 2023
@Mab879 Mab879 self-assigned this Nov 17, 2023
Copy link
Member

@Mab879 Mab879 left a comment

Choose a reason for hiding this comment

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

Thanks for the updates.

I want hear your thoughts on moving to using the ALL target in gubby instead of using the default kernel.

This is to reflect actual behavior, and align with other similar rules
in this project

Signed-off-by: Edgar Aguilar <edgar.aguilar@oracle.com>
@Xeicker
Copy link
Contributor Author

Xeicker commented Nov 23, 2023

I want hear your thoughts on moving to using the ALL target in gubby instead of using the default kernel.

I think you are completely right. Updated it

Copy link

codeclimate bot commented Nov 23, 2023

Code Climate has analyzed commit f903954 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%.

View more on Code Climate.

@vojtapolasek vojtapolasek modified the milestones: 0.1.71, 0.1.72 Nov 28, 2023
Copy link
Member

@Mab879 Mab879 left a comment

Choose a reason for hiding this comment

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

LGTM.

Waving the automatus tests as there are no tests.

@Mab879 Mab879 merged commit 66986a8 into ComplianceAsCode:master Nov 30, 2023
33 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ok-to-test Used by openshift-ci bot. Update Rule Issues or pull requests related to Rules updates.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants