Blame SOURCES/scap-security-guide-0.1.61-grub2_rule_desc_update-PR_8184.patch

12e95e
From 51a826878ade2ebb564405991937ba0e2b2b7717 Mon Sep 17 00:00:00 2001
12e95e
From: Vojtech Polasek <vpolasek@redhat.com>
12e95e
Date: Wed, 2 Feb 2022 14:25:30 +0100
12e95e
Subject: [PATCH 1/8] create two macros
12e95e
12e95e
one provides description for grub2_argument templated rules
12e95e
the second provides ocil for those cases
12e95e
---
12e95e
 shared/macros.jinja | 56 +++++++++++++++++++++++++++++++++++++++++++++
12e95e
 1 file changed, 56 insertions(+)
12e95e
12e95e
diff --git a/shared/macros.jinja b/shared/macros.jinja
12e95e
index 00358e2f67c..3d41c998b0c 100644
12e95e
--- a/shared/macros.jinja
12e95e
+++ b/shared/macros.jinja
12e95e
@@ -1620,3 +1620,59 @@ The audit daemon must be restarted for the changes to take effect.
12e95e
 - no_ovirt
12e95e
 {{%- endif %}}
12e95e
 {{% endmacro %}}
12e95e
+
12e95e
+{{#
12e95e
+    Describe how to configure Grub2 to add an argument to the default kernel command line.
12e95e
+    The parameter should be in form `parameter=value`.
12e95e
+#}}
12e95e
+{{%- macro describe_grub2_argument(arg_name_value) -%}}
12e95e
+{{%- if product in ["rhel7", "ol7", "rhel9"] or 'ubuntu' in product -%}}
12e95e
+To ensure that <tt>{{{ arg_name_value }}}</tt> is added as a kernel command line
12e95e
+argument to newly installed kernels, ad <tt>{{{ arg_name_value }}}</tt> to the
12e95e
+default Grub2 command line for Linux operating systems.  Modify the line within
12e95e
+<tt>/etc/default/grub</tt> as shown below:
12e95e
+
GRUB_CMDLINE_LINUX="... {{{ arg_name_value }}} ..."
12e95e
+Run the following command to update command line for already installed kernels:
12e95e
+{{%- if 'ubuntu' in product -%}}
12e95e
+
# update-grub
12e95e
+{{%- else -%}}
12e95e
+
# grubby --update-kernel=ALL --args="{{{ arg_name_value }}}"
12e95e
+{{%- endif -%}}
12e95e
+{{%- else -%}}
12e95e
+Configure the default Grub2 kernel command line to contain {{{ arg_name_value }}} as follows:
12e95e
+
# grub2-editenv - set "$(grub2-editenv - list | grep kernelopts) {{{ arg_name_value }}}"
12e95e
+{{%- endif -%}}
12e95e
+{{%- endmacro -%}}
12e95e
+
12e95e
+{{#
12e95e
+    Provide OCIL for checking if an argument for kernel command line is configured with Grub2.
12e95e
+    The parameter should have form `parameter=value`.
12e95e
+#}}
12e95e
+{{%- macro ocil_grub2_argument(arg_name_value) -%}}
12e95e
+{{%- if product in ["rhel7", "ol7", "rhel9"] or 'ubuntu' in product -%}}
12e95e
+Inspect the form of default GRUB 2 command line for the Linux operating system
12e95e
+in <tt>/etc/default/grub</tt>. If it includes <tt>{{{ arg_name_value }}}</tt>,
12e95e
+then auditinng will be enabled for newly installed kernels.
12e95e
+First check if the GRUB recovery is enabled:
12e95e
+
$ grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub
12e95e
+If this option is set to true, then check that a line is output by the following command:
12e95e
+
$ grep 'GRUB_CMDLINE_LINUX_DEFAULT.*{{{ arg_name_value }}}.*' /etc/default/grub
12e95e
+If the recovery is disabled, check the line with
12e95e
+
$ grep 'GRUB_CMDLINE_LINUX.*{{{ arg_name_value }}}.*' /etc/default/grub
.
12e95e
+{{%- if 'ubuntu' in product -%}}
12e95e
+Moreover, current Grub2 config file in <tt>/etc/grub2/grub.cfg</tt> must be checked.
12e95e
+
# grep vmlinuz {{{ grub2_boot_path }}}/grub.cfg | grep -v '{{{ arg_name_value }}}'
12e95e
+This command should not return any output.
12e95e
+{{%- else -%}}
12e95e
+Moreover, command line parameters for currently installed kernels should be checked as well.
12e95e
+Run the following command:
12e95e
+
# grubby --info=ALL | grep args | grep -v '{{{ arg_name_value }}}'
12e95e
+The command should not return any output.
12e95e
+{{%- endif -%}}
12e95e
+{{%- else -%}}
12e95e
+Inspect the form of default GRUB 2 command line for the Linux operating system
12e95e
+in <tt>{{{ grub2_boot_path }}}/grubenv</tt>. If they include <tt>{{{ arg_name_value }}}</tt>, then auditing
12e95e
+is enabled at boot time.
12e95e
+
# grep 'kernelopts.*{{{ arg_name_value }}}.*' {{{ grub2_boot_path }}}/grubenv
12e95e
+{{%- endif -%}}
12e95e
+{{%- endmacro -%}}
12e95e
12e95e
From c8cb579db19bd55eebcb0bdc4b1432368a5c1b77 Mon Sep 17 00:00:00 2001
12e95e
From: Vojtech Polasek <vpolasek@redhat.com>
12e95e
Date: Wed, 2 Feb 2022 14:26:26 +0100
12e95e
Subject: [PATCH 2/8] use new macros in grub2_audit_argument
12e95e
12e95e
---
12e95e
 .../auditing/grub2_audit_argument/rule.yml    | 45 ++-----------------
12e95e
 1 file changed, 3 insertions(+), 42 deletions(-)
12e95e
12e95e
diff --git a/linux_os/guide/system/auditing/grub2_audit_argument/rule.yml b/linux_os/guide/system/auditing/grub2_audit_argument/rule.yml
12e95e
index 96dbe67699e..aff0521ee73 100644
12e95e
--- a/linux_os/guide/system/auditing/grub2_audit_argument/rule.yml
12e95e
+++ b/linux_os/guide/system/auditing/grub2_audit_argument/rule.yml
12e95e
@@ -7,15 +7,8 @@ title: 'Enable Auditing for Processes Which Start Prior to the Audit Daemon'
12e95e
 description: |-
12e95e
     To ensure all processes can be audited, even those which start
12e95e
     prior to the audit daemon, add the argument <tt>audit=1</tt> to the default
12e95e
-    GRUB 2 command line for the Linux operating system in
12e95e
-{{% if product in ["rhel7", "ol7"] %}}
12e95e
-    <tt>/etc/default/grub</tt>, so that the line looks similar to
12e95e
-    
GRUB_CMDLINE_LINUX="... audit=1 ..."
12e95e
-    In case the <tt>GRUB_DISABLE_RECOVERY</tt> is set to true, then the parameter should be added to the <tt>GRUB_CMDLINE_LINUX_DEFAULT</tt> instead.
12e95e
-{{% else %}}
12e95e
-    <tt>{{{ grub2_boot_path }}}/grubenv</tt>, in the manner below:
12e95e
-    
# grub2-editenv - set "$(grub2-editenv - list | grep kernelopts) audit=1"
12e95e
-{{% endif %}}
12e95e
+    GRUB 2 command line for the Linux operating system.
12e95e
+    {{{ describe_grub2_argument("audit=1") | indent(4) }}}
12e95e
 
12e95e
 rationale: |-
12e95e
     Each process on the system carries an "auditable" flag which indicates whether
12e95e
@@ -59,39 +52,7 @@ references:
12e95e
 ocil_clause: 'auditing is not enabled at boot time'
12e95e
 
12e95e
 ocil: |-
12e95e
-{{% if product in ["rhel7", "ol7", "sle12","sle15"] %}}
12e95e
-    Inspect the form of default GRUB 2 command line for the Linux operating system
12e95e
-    in <tt>/etc/default/grub</tt>. If it includes <tt>audit=1</tt>, then auditing
12e95e
-    is enabled at boot time.
12e95e
-    First check if the GRUB recovery is enabled:
12e95e
-    
$ grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub
12e95e
-    If this option is set to true, then check that a line is output by the following command:
12e95e
-    
$ grep 'GRUB_CMDLINE_LINUX_DEFAULT.*audit=1.*' /etc/default/grub
12e95e
-    If the recovery is disabled, check the line with
12e95e
-    
$ grep 'GRUB_CMDLINE_LINUX.*audit=1.*' /etc/default/grub
.
12e95e
-    Moreover, current Grub2 config file in <tt>/etc/grub2/grub.cfg</tt> must be checked.
12e95e
-    
# grep vmlinuz {{{ grub2_boot_path }}}/grub.cfg | grep -v 'audit=1'
12e95e
-    This command should not return any output. If it does, update the configuration with
12e95e
-    
# grub2-mkconfig -o {{{ grub2_boot_path }}}/grub.cfg
12e95e
-    

12e95e
-    Alternatively, to ensure <tt>audit=1</tt> is configured on all installed kernels, the
12e95e
-    following command may be used:
12e95e
-    
12e95e
-    
$ sudo /sbin/grubby --update-kernel=ALL --args="audit=1"
12e95e
-    
12e95e
-{{% else %}}
12e95e
-    Inspect the form of default GRUB 2 command line for the Linux operating system
12e95e
-    in <tt>{{{ grub2_boot_path }}}/grubenv</tt>. If they include <tt>audit=1</tt>, then auditing
12e95e
-    is enabled at boot time.
12e95e
-    
# grep 'kernelopts.*audit=1.*' {{{ grub2_boot_path }}}/grubenv
12e95e
-    

12e95e
-    To ensure <tt>audit=1</tt> is configured on all installed kernels, the
12e95e
-    following command may be used:
12e95e
-    
12e95e
-    
# grub2-editenv - set "$(grub2-editenv - list | grep kernelopts) audit=1"
12e95e
-    
12e95e
-{{% endif %}}
12e95e
-
12e95e
+    {{{ ocil_grub2_argument("audit=1") | indent(4) }}}
12e95e
 
12e95e
 warnings:
12e95e
     - management: |-
12e95e
12e95e
From 3ff2c245408d3fe892222eee8171e2f84868f705 Mon Sep 17 00:00:00 2001
12e95e
From: Vojtech Polasek <vpolasek@redhat.com>
12e95e
Date: Thu, 3 Feb 2022 14:25:34 +0100
12e95e
Subject: [PATCH 3/8] fix omission  in ocil jinja macro
12e95e
12e95e
---
12e95e
 shared/macros.jinja | 6 +++---
12e95e
 1 file changed, 3 insertions(+), 3 deletions(-)
12e95e
12e95e
diff --git a/shared/macros.jinja b/shared/macros.jinja
12e95e
index 3d41c998b0c..16a0404b668 100644
12e95e
--- a/shared/macros.jinja
12e95e
+++ b/shared/macros.jinja
12e95e
@@ -1652,7 +1652,7 @@ Configure the default Grub2 kernel command line to contain {{{ arg_name_value }}
12e95e
 {{%- if product in ["rhel7", "ol7", "rhel9"] or 'ubuntu' in product -%}}
12e95e
 Inspect the form of default GRUB 2 command line for the Linux operating system
12e95e
 in <tt>/etc/default/grub</tt>. If it includes <tt>{{{ arg_name_value }}}</tt>,
12e95e
-then auditinng will be enabled for newly installed kernels.
12e95e
+then the parameter will be configured for newly installed kernels.
12e95e
 First check if the GRUB recovery is enabled:
12e95e
 
$ grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub
12e95e
 If this option is set to true, then check that a line is output by the following command:
12e95e
@@ -1671,8 +1671,8 @@ The command should not return any output.
12e95e
 {{%- endif -%}}
12e95e
 {{%- else -%}}
12e95e
 Inspect the form of default GRUB 2 command line for the Linux operating system
12e95e
-in <tt>{{{ grub2_boot_path }}}/grubenv</tt>. If they include <tt>{{{ arg_name_value }}}</tt>, then auditing
12e95e
-is enabled at boot time.
12e95e
+in <tt>{{{ grub2_boot_path }}}/grubenv</tt>. If they include <tt>{{{ arg_name_value }}}</tt>, then the parameter
12e95e
+is configured at boot time.
12e95e
 
# grep 'kernelopts.*{{{ arg_name_value }}}.*' {{{ grub2_boot_path }}}/grubenv
12e95e
 {{%- endif -%}}
12e95e
 {{%- endmacro -%}}
12e95e
12e95e
From 976da69681d03d9b9380fc57216c30c7b4891f50 Mon Sep 17 00:00:00 2001
12e95e
From: Vojtech Polasek <vpolasek@redhat.com>
12e95e
Date: Thu, 3 Feb 2022 14:26:33 +0100
12e95e
Subject: [PATCH 4/8] use new jinja macros in all grub2 related rules
12e95e
12e95e
---
12e95e
 .../rule.yml                                  | 15 ++-----
12e95e
 .../grub2_enable_iommu_force/rule.yml         |  9 +++-
12e95e
 .../grub2_init_on_alloc_argument/rule.yml     | 18 ++------
12e95e
 .../grub2_kernel_trust_cpu_rng/rule.yml       | 11 ++---
12e95e
 .../grub2_pti_argument/rule.yml               | 15 ++-----
12e95e
 .../grub2_vsyscall_argument/rule.yml          | 15 ++-----
12e95e
 .../grub2_ipv6_disable_argument/rule.yml      | 45 ++-----------------
12e95e
 .../grub2_page_poison_argument/rule.yml       | 15 ++-----
12e95e
 .../grub2_slub_debug_argument/rule.yml        | 15 ++-----
12e95e
 9 files changed, 33 insertions(+), 125 deletions(-)
12e95e
12e95e
diff --git a/linux_os/guide/system/auditing/grub2_audit_backlog_limit_argument/rule.yml b/linux_os/guide/system/auditing/grub2_audit_backlog_limit_argument/rule.yml
12e95e
index f94ddab2fe1..868d525014f 100644
12e95e
--- a/linux_os/guide/system/auditing/grub2_audit_backlog_limit_argument/rule.yml
12e95e
+++ b/linux_os/guide/system/auditing/grub2_audit_backlog_limit_argument/rule.yml
12e95e
@@ -7,9 +7,8 @@ title: 'Extend Audit Backlog Limit for the Audit Daemon'
12e95e
 description: |-
12e95e
     To improve the kernel capacity to queue all log events, even those which occurred
12e95e
     prior to the audit daemon, add the argument <tt>audit_backlog_limit=8192</tt> to the default
12e95e
-    GRUB 2 command line for the Linux operating system in
12e95e
-    <tt>/etc/default/grub</tt>, in the manner below:
12e95e
-    
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=VolGroup/LogVol06 rd.lvm.lv=VolGroup/lv_swap rhgb quiet rd.shell=0 audit=1 audit_backlog_limit=8192"
12e95e
+    GRUB 2 command line for the Linux operating system.
12e95e
+    {{{ describe_grub2_argument("audit_backlog_limit=8192") | indent(4) }}}
12e95e
 
12e95e
 rationale: |-
12e95e
     audit_backlog_limit sets the queue length for audit events awaiting transfer
12e95e
@@ -40,15 +39,7 @@ references:
12e95e
 ocil_clause: 'audit backlog limit is not configured'
12e95e
 
12e95e
 ocil: |-
12e95e
-    Inspect the form of default GRUB 2 command line for the Linux operating system
12e95e
-    in <tt>/etc/default/grub</tt>. If they include <tt>audit=1</tt>, then auditing
12e95e
-    is enabled at boot time.
12e95e
-    

12e95e
-    To ensure <tt>audit_backlog_limit=8192</tt> is configured on all installed kernels, the
12e95e
-    following command may be used:
12e95e
-    
12e95e
-    
$ sudo /sbin/grubby --update-kernel=ALL --args="audit_backlog_limit=8192"
12e95e
-    
12e95e
+    {{{ ocil_grub2_argument("audit_backlog_limit=8192") | indent(4) }}}
12e95e
 
12e95e
 warnings:
12e95e
     - management: |-
12e95e
diff --git a/linux_os/guide/system/bootloader-grub2/grub2_enable_iommu_force/rule.yml b/linux_os/guide/system/bootloader-grub2/grub2_enable_iommu_force/rule.yml
12e95e
index 0a0d76aeb23..1ff5a4d5f26 100644
12e95e
--- a/linux_os/guide/system/bootloader-grub2/grub2_enable_iommu_force/rule.yml
12e95e
+++ b/linux_os/guide/system/bootloader-grub2/grub2_enable_iommu_force/rule.yml
12e95e
@@ -5,9 +5,10 @@ title: 'IOMMU configuration directive'
12e95e
 description: |-
12e95e
     On x86 architecture supporting VT-d, the IOMMU manages the access control policy between the hardware devices and some
12e95e
         of the system critical units such as the memory.
12e95e
+    {{{ describe_grub2_argument("iommu=force") | indent(4) }}}
12e95e
 
12e95e
 rationale: |-
12e95e
-    On x86 architectures, activating the I/OMMU prevents the system from arbritrary accesses potentially made by
12e95e
+    On x86 architectures, activating the I/OMMU prevents the system from arbitrary accesses potentially made by
12e95e
         hardware devices.
12e95e
 
12e95e
 severity: unknown
12e95e
@@ -22,6 +23,12 @@ references:
12e95e
 
12e95e
 platform: machine
12e95e
 
12e95e
+ocil_clause: 'I/OMMU is not activated'
12e95e
+
12e95e
+ocil: |-
12e95e
+    {{{ ocil_grub2_argument("iommu=force") | indent(4) }}}
12e95e
+
12e95e
+
12e95e
 warnings:
12e95e
   - functionality:
12e95e
       Depending on the hardware, devices and operating system used, enabling IOMMU can cause hardware instabilities.
12e95e
diff --git a/linux_os/guide/system/bootloader-grub2/grub2_init_on_alloc_argument/rule.yml b/linux_os/guide/system/bootloader-grub2/grub2_init_on_alloc_argument/rule.yml
12e95e
index a9253c74cc6..3bb645dadb7 100644
12e95e
--- a/linux_os/guide/system/bootloader-grub2/grub2_init_on_alloc_argument/rule.yml
12e95e
+++ b/linux_os/guide/system/bootloader-grub2/grub2_init_on_alloc_argument/rule.yml
12e95e
@@ -6,12 +6,8 @@ title: 'Configure kernel to zero out memory before allocation'
12e95e
 
12e95e
 description: |-
12e95e
     To configure the kernel to zero out memory before allocating it, add the
12e95e
-    <tt>init_on_alloc=1</tt> argument to the default GRUB 2 command line for
12e95e
-    the Linux operating system in <tt>/etc/default/grub</tt>, in the manner
12e95e
-    below:
12e95e
-    
GRUB_CMDLINE_LINUX="crashkernel=auto quiet rd.shell=0 audit=1 audit_backlog_limit=8192 init_on_alloc=1"
12e95e
-    Update the boot parameter for existing kernels by running the following command:
12e95e
-    
# grubby --update-kernel=ALL --args="init_on_alloc=1"
12e95e
+    <tt>init_on_alloc=1</tt> argument to the default GRUB 2 command line.
12e95e
+    {{{ describe_grub2_argument("init_on_alloc=1") | indent(4) }}}
12e95e
 
12e95e
 rationale: |-
12e95e
     When the kernel configuration option <tt>init_on_alloc</tt> is enabled,
12e95e
@@ -27,15 +23,7 @@ identifiers:
12e95e
 ocil_clause: 'the kernel is not configured to zero out memory before allocation'
12e95e
 
12e95e
 ocil: |-
12e95e
-    Make sure that the kernel is configured to zero out memory before
12e95e
-    allocation. Ensure that the parameter is configured in
12e95e
-    <tt>/etc/default/grub</tt>:
12e95e
-    
grep GRUB_CMDLINE_LINUX /etc/default/grub
12e95e
-    The output should contain <tt>init_on_alloc=1</tt>.
12e95e
-    Run the following command to display command line parameters of all
12e95e
-    installed kernels:
12e95e
-    
# grubby --info=ALL | grep args
12e95e
-    Ensure that each line contains the <tt>init_on_alloc=1</tt> parameter.
12e95e
+    {{{ ocil_grub2_argument("init_on_alloc=1") | indent(4) }}}
12e95e
 
12e95e
 platform: machine
12e95e
 
12e95e
diff --git a/linux_os/guide/system/bootloader-grub2/grub2_kernel_trust_cpu_rng/rule.yml b/linux_os/guide/system/bootloader-grub2/grub2_kernel_trust_cpu_rng/rule.yml
12e95e
index 308ae9cb735..d6bfc02f345 100644
12e95e
--- a/linux_os/guide/system/bootloader-grub2/grub2_kernel_trust_cpu_rng/rule.yml
12e95e
+++ b/linux_os/guide/system/bootloader-grub2/grub2_kernel_trust_cpu_rng/rule.yml
12e95e
@@ -11,8 +11,8 @@ description: |-
12e95e
     <tt>Y</tt>, make sure that it is not overridden with the boot parameter.
12e95e
     There must not exist the boot parameter <tt>random.trust_cpu=off</tt>. If
12e95e
     the option is not compiled in, make sure that <tt>random.trust_cpu=on</tt>
12e95e
-    is configured as a boot parameter by running the following command:
12e95e
-    
sudo grub2-editenv - set "$(grub2-editenv - list | grep kernelopts) random.trust_cpu=on"
12e95e
+    is configured as a boot parameter.
12e95e
+    {{{ describe_grub2_argument("random.trust_cpu=on") | indent(4) }}}
12e95e
 
12e95e
 rationale: |-
12e95e
     The Linux kernel offers an option which signifies if the kernel should trust
12e95e
@@ -44,11 +44,8 @@ ocil: |-
12e95e
     option is not overridden through a boot parameter:
12e95e
     
sudo grep 'kernelopts.*random\.trust_cpu=off.*' {{{ grub2_boot_path }}}/grubenv
12e95e
     The command should not return any output. If the option is not compiled into
12e95e
-    the kernel, check that the option is configured through boot parameter with
12e95e
-    the following command:
12e95e
-    
sudo grep 'kernelopts.*random\.trust_cpu=on.*' {{{ grub2_boot_path }}}/grubenv
12e95e
-    If the command does not return any output, then the boot parameter is
12e95e
-    missing.
12e95e
+    the kernel, check that the option is configured through boot parameter.
12e95e
+    {{{ ocil_grub2_argument("random.trust_cpu=on") | indent(4) }}}
12e95e
 
12e95e
 platform: machine
12e95e
 
12e95e
diff --git a/linux_os/guide/system/bootloader-grub2/grub2_pti_argument/rule.yml b/linux_os/guide/system/bootloader-grub2/grub2_pti_argument/rule.yml
12e95e
index f4f3fa39510..51b0a284746 100644
12e95e
--- a/linux_os/guide/system/bootloader-grub2/grub2_pti_argument/rule.yml
12e95e
+++ b/linux_os/guide/system/bootloader-grub2/grub2_pti_argument/rule.yml
12e95e
@@ -7,9 +7,8 @@ title: 'Enable Kernel Page-Table Isolation (KPTI)'
12e95e
 description: |-
12e95e
     To enable Kernel page-table isolation,
12e95e
     add the argument <tt>pti=on</tt> to the default
12e95e
-    GRUB 2 command line for the Linux operating system in
12e95e
-    <tt>/etc/default/grub</tt>, in the manner below:
12e95e
-    
GRUB_CMDLINE_LINUX="pti=on"
12e95e
+    GRUB 2 command line for the Linux operating system.
12e95e
+    {{{ describe_grub2_argument("pti=on") | indent(4) }}}
12e95e
 
12e95e
 rationale: |-
12e95e
     Kernel page-table isolation is a kernel feature that mitigates
12e95e
@@ -33,15 +32,7 @@ references:
12e95e
 ocil_clause: 'Kernel page-table isolation is not enabled'
12e95e
 
12e95e
 ocil: |-
12e95e
-    Inspect the form of default GRUB 2 command line for the Linux operating system
12e95e
-    in <tt>/etc/default/grub</tt>. If they include <tt>pti=on</tt>,
12e95e
-    then Kernel page-table isolation is enabled at boot time.
12e95e
-    

12e95e
-    To ensure <tt>pti=on</tt> is configured on all installed kernels, the
12e95e
-    following command may be used:
12e95e
-    
12e95e
-    
$ sudo /sbin/grubby --update-kernel=ALL --args="pti=on
12e95e
-    
12e95e
+    {{{ ocil_grub2_argument("pti=on") | indent(4) }}}
12e95e
 
12e95e
 warnings:
12e95e
     - management: |-
12e95e
diff --git a/linux_os/guide/system/bootloader-grub2/grub2_vsyscall_argument/rule.yml b/linux_os/guide/system/bootloader-grub2/grub2_vsyscall_argument/rule.yml
12e95e
index 9f38a1c13b9..1b88d13bd3c 100644
12e95e
--- a/linux_os/guide/system/bootloader-grub2/grub2_vsyscall_argument/rule.yml
12e95e
+++ b/linux_os/guide/system/bootloader-grub2/grub2_vsyscall_argument/rule.yml
12e95e
@@ -7,9 +7,8 @@ title: 'Disable vsyscalls'
12e95e
 description: |-
12e95e
     To disable use of virtual syscalls,
12e95e
     add the argument <tt>vsyscall=none</tt> to the default
12e95e
-    GRUB 2 command line for the Linux operating system in
12e95e
-    <tt>/etc/default/grub</tt>, in the manner below:
12e95e
-    
GRUB_CMDLINE_LINUX="vsyscall=none"
12e95e
+    GRUB 2 command line for the Linux operating system.
12e95e
+    {{{ describe_grub2_argument("vsyscall=none") | indent(4) }}}
12e95e
 
12e95e
 rationale: |-
12e95e
     Virtual Syscalls provide an opportunity of attack for a user who has control
12e95e
@@ -33,15 +32,7 @@ references:
12e95e
 ocil_clause: 'vsyscalls are enabled'
12e95e
 
12e95e
 ocil: |-
12e95e
-    Inspect the form of default GRUB 2 command line for the Linux operating system
12e95e
-    in <tt>/etc/default/grub</tt>. If they include <tt>vsyscall=none</tt>,
12e95e
-    then virtyal syscalls are not enabled at boot time.
12e95e
-    

12e95e
-    To ensure <tt>vsyscall=none</tt> is configured on all installed kernels, the
12e95e
-    following command may be used:
12e95e
-    
12e95e
-    
$ sudo /sbin/grubby --update-kernel=ALL --args="vsyscall=none
12e95e
-    
12e95e
+    {{{ ocil_grub2_argument("vsyscall=none") | indent(4) }}}
12e95e
 
12e95e
 warnings:
12e95e
     - management: |-
12e95e
diff --git a/linux_os/guide/system/network/network-ipv6/disabling_ipv6/grub2_ipv6_disable_argument/rule.yml b/linux_os/guide/system/network/network-ipv6/disabling_ipv6/grub2_ipv6_disable_argument/rule.yml
12e95e
index b8ff66c7d6e..c0fda343a1a 100644
12e95e
--- a/linux_os/guide/system/network/network-ipv6/disabling_ipv6/grub2_ipv6_disable_argument/rule.yml
12e95e
+++ b/linux_os/guide/system/network/network-ipv6/disabling_ipv6/grub2_ipv6_disable_argument/rule.yml
12e95e
@@ -7,20 +7,8 @@ title: 'Ensure IPv6 is disabled through kernel boot parameter'
12e95e
 description: |-
12e95e
     To disable IPv6 protocol support in the Linux kernel,
12e95e
     add the argument <tt>ipv6.disable=1</tt> to the default
12e95e
-    GRUB2 command line for the Linux operating system in
12e95e
-{{% if product in ["rhel7", "ol7"] %}}
12e95e
-    <tt>/etc/default/grub</tt>, so that the line looks similar to
12e95e
-    
GRUB_CMDLINE_LINUX="... ipv6.disable=1 ..."
12e95e
-    In case the <tt>GRUB_DISABLE_RECOVERY</tt> is set to true, then the parameter should be added to the <tt>GRUB_CMDLINE_LINUX_DEFAULT</tt> instead.
12e95e
-    Run one of following command to ensure that the configuration is applied when booting currently installed kernels:
12e95e
-    
sudo grub2-mkconfig -o {{{ grub2_boot_path }}}/grub.cfg
12e95e
-    or
12e95e
-    
sudo /sbin/grubby --update-kernel=ALL --args="ipv6.disable=1"
12e95e
-{{% else %}}
12e95e
-    <tt>{{{ grub2_boot_path }}}/grubenv</tt>, in the manner below:
12e95e
-    
sudo  grub2-editenv - set "$(grub2-editenv - list | grep kernelopts) ipv6.disable=1"
12e95e
-{{% endif %}}
12e95e
-
12e95e
+    GRUB2 command line for the Linux operating system.
12e95e
+    {{{ describe_grub2_argument("ipv6.disable=1") | indent(4) }}}
12e95e
 
12e95e
 rationale: |-
12e95e
     Any unnecessary network stacks, including IPv6, should be disabled to reduce
12e95e
@@ -40,34 +28,7 @@ references:
12e95e
 ocil_clause: 'IPv6 is not disabled'
12e95e
 
12e95e
 ocil: |-
12e95e
-    {{% if product in ["rhel7", "ol7"] %}}
12e95e
-    Inspect the form of default GRUB2 command line for the Linux operating system
12e95e
-    in <tt>/etc/default/grub</tt>. Check if it includes <tt>ipv6.disable=1</tt>.
12e95e
-    First check if the GRUB recovery is enabled:
12e95e
-    
grep 'GRUB_DISABLE_RECOVERY' /etc/default/grub
12e95e
-    If this option is set to true, then check that the following line is output by the following command:
12e95e
-    
grep 'GRUB_CMDLINE_LINUX_DEFAULT.*ipv6.disable=1.*' /etc/default/grub
12e95e
-    If the recovery is disabled, check the line with
12e95e
-    
grep 'GRUB_CMDLINE_LINUX.*ipv6.disable=1.*' /etc/default/grub
.
12e95e
-    Moreover, current GRUB2 config file in <tt>/etc/grub2/grub.cfg</tt> must be checked.
12e95e
-    
sudo grep vmlinuz {{{ grub2_boot_path }}}/grub.cfg | grep -v 'ipv6.disable=1'
12e95e
-    This command should not return any output. If it does, update the configuration with one of following commands:
12e95e
-    
sudo grub2-mkconfig -o {{{ grub2_boot_path }}}/grub.cfg
12e95e
-    or
12e95e
-    
sudo /sbin/grubby --update-kernel=ALL --args="ipv6.disable=1"
12e95e
-    
12e95e
-{{% else %}}
12e95e
-    Inspect the form of default GRUB2 command line for the Linux operating system
12e95e
-    in <tt>{{{ grub2_boot_path }}}/grubenv</tt>. Check if it includes <tt>ipv6.disable=1</tt>.
12e95e
-    
sudo grep 'kernelopts.*ipv6.disable=1.*' {{{ grub2_boot_path }}}/grubenv
12e95e
-    

12e95e
-    To ensure <tt>ipv6.disable=1</tt> is configured on all installed kernels, the
12e95e
-    following command may be used:
12e95e
-    
12e95e
-    
sudo grub2-editenv - set "$(grub2-editenv - list | grep kernelopts) ipv6.disable=1"
12e95e
-    
12e95e
-{{% endif %}}
12e95e
-
12e95e
+    {{{ ocil_grub2_argument("ipv6.disable=1") | indent(4) }}}
12e95e
 
12e95e
 warnings:
12e95e
     - management: |-
12e95e
diff --git a/linux_os/guide/system/permissions/restrictions/poisoning/grub2_page_poison_argument/rule.yml b/linux_os/guide/system/permissions/restrictions/poisoning/grub2_page_poison_argument/rule.yml
12e95e
index 3bf592fb4d8..1f4e183d9e7 100644
12e95e
--- a/linux_os/guide/system/permissions/restrictions/poisoning/grub2_page_poison_argument/rule.yml
12e95e
+++ b/linux_os/guide/system/permissions/restrictions/poisoning/grub2_page_poison_argument/rule.yml
12e95e
@@ -7,9 +7,8 @@ title: 'Enable page allocator poisoning'
12e95e
 description: |-
12e95e
     To enable poisoning of free pages,
12e95e
     add the argument <tt>page_poison=1</tt> to the default
12e95e
-    GRUB 2 command line for the Linux operating system in
12e95e
-    <tt>/etc/default/grub</tt>, in the manner below:
12e95e
-    
GRUB_CMDLINE_LINUX="page_poison=1"
12e95e
+    GRUB 2 command line for the Linux operating system.
12e95e
+    {{{ describe_grub2_argument("page_poison=1") | indent(4) }}}
12e95e
 
12e95e
 rationale: |-
12e95e
     Poisoning writes an arbitrary value to freed pages, so any modification or
12e95e
@@ -35,15 +34,7 @@ references:
12e95e
 ocil_clause: 'page allocator poisoning is not enabled'
12e95e
 
12e95e
 ocil: |-
12e95e
-    Inspect the form of default GRUB 2 command line for the Linux operating system
12e95e
-    in <tt>/etc/default/grub</tt>. If they include <tt>page_poison=1</tt>,
12e95e
-    then page poisoning is enabled at boot time.
12e95e
-    

12e95e
-    To ensure <tt>page_poison=1</tt> is configured on all installed kernels, the
12e95e
-    following command may be used:
12e95e
-    
12e95e
-    
$ sudo /sbin/grubby --update-kernel=ALL --args="page_poison=1
12e95e
-    
12e95e
+    {{{ ocil_grub2_argument("page_poison=1") | indent(4) }}}
12e95e
 
12e95e
 warnings:
12e95e
     - management: |-
12e95e
diff --git a/linux_os/guide/system/permissions/restrictions/poisoning/grub2_slub_debug_argument/rule.yml b/linux_os/guide/system/permissions/restrictions/poisoning/grub2_slub_debug_argument/rule.yml
12e95e
index 9964399650a..bb5dbc6c125 100644
12e95e
--- a/linux_os/guide/system/permissions/restrictions/poisoning/grub2_slub_debug_argument/rule.yml
12e95e
+++ b/linux_os/guide/system/permissions/restrictions/poisoning/grub2_slub_debug_argument/rule.yml
12e95e
@@ -7,9 +7,8 @@ title: 'Enable SLUB/SLAB allocator poisoning'
12e95e
 description: |-
12e95e
     To enable poisoning of SLUB/SLAB objects,
12e95e
     add the argument <tt>slub_debug=P</tt> to the default
12e95e
-    GRUB 2 command line for the Linux operating system in
12e95e
-    <tt>/etc/default/grub</tt>, in the manner below:
12e95e
-    
GRUB_CMDLINE_LINUX="slub_debug=P"
12e95e
+    GRUB 2 command line for the Linux operating system.
12e95e
+    {{{ describe_grub2_argument("slub_debug=P") | indent(4) }}}
12e95e
 
12e95e
 rationale: |-
12e95e
     Poisoning writes an arbitrary value to freed objects, so any modification or
12e95e
@@ -35,15 +34,7 @@ references:
12e95e
 ocil_clause: 'SLUB/SLAB poisoning is not enabled'
12e95e
 
12e95e
 ocil: |-
12e95e
-    Inspect the form of default GRUB 2 command line for the Linux operating system
12e95e
-    in <tt>/etc/default/grub</tt>. If they include <tt>slub_debug=P</tt>,
12e95e
-    then SLUB/SLAB poisoning is enabled at boot time.
12e95e
-    

12e95e
-    To ensure <tt>slub_debug=P</tt> is configured on all installed kernels, the
12e95e
-    following command may be used:
12e95e
-    
12e95e
-    
$ sudo /sbin/grubby --update-kernel=ALL --args="slub_debug=P
12e95e
-    
12e95e
+    {{{ ocil_grub2_argument("slub_debug=P") | indent(4) }}}
12e95e
 
12e95e
 warnings:
12e95e
     - management: |-
12e95e
12e95e
From 5c39cf81d49f0eb5bb73337057fb95356784e5c6 Mon Sep 17 00:00:00 2001
12e95e
From: Vojtech Polasek <vpolasek@redhat.com>
12e95e
Date: Wed, 9 Feb 2022 16:05:59 +0100
12e95e
Subject: [PATCH 5/8] fix an error in ubuntu version of macro
12e95e
12e95e
---
12e95e
 shared/macros.jinja | 2 +-
12e95e
 1 file changed, 1 insertion(+), 1 deletion(-)
12e95e
12e95e
diff --git a/shared/macros.jinja b/shared/macros.jinja
12e95e
index 16a0404b668..54d2b299a47 100644
12e95e
--- a/shared/macros.jinja
12e95e
+++ b/shared/macros.jinja
12e95e
@@ -1660,7 +1660,7 @@ If this option is set to true, then check that a line is output by the following
12e95e
 If the recovery is disabled, check the line with
12e95e
 
$ grep 'GRUB_CMDLINE_LINUX.*{{{ arg_name_value }}}.*' /etc/default/grub
.
12e95e
 {{%- if 'ubuntu' in product -%}}
12e95e
-Moreover, current Grub2 config file in <tt>/etc/grub2/grub.cfg</tt> must be checked.
12e95e
+Moreover, current Grub2 config file in <tt>{{{ grub2_boot_path }}}/grub.cfg</tt> must be checked.
12e95e
 
# grep vmlinuz {{{ grub2_boot_path }}}/grub.cfg | grep -v '{{{ arg_name_value }}}'
12e95e
 This command should not return any output.
12e95e
 {{%- else -%}}
12e95e
12e95e
From f100d190833d168127715215e788347f806736f3 Mon Sep 17 00:00:00 2001
12e95e
From: Vojtech Polasek <vpolasek@redhat.com>
12e95e
Date: Wed, 9 Feb 2022 16:16:21 +0100
12e95e
Subject: [PATCH 6/8] remove warnings from rules
12e95e
12e95e
they are no longer relevant, we do not use grub2-mkconfig anymore
12e95e
---
12e95e
 .../auditing/grub2_audit_argument/rule.yml     | 18 ------------------
12e95e
 .../rule.yml                                   | 18 ------------------
12e95e
 .../grub2_pti_argument/rule.yml                | 18 ------------------
12e95e
 .../grub2_vsyscall_argument/rule.yml           | 18 ------------------
12e95e
 .../grub2_ipv6_disable_argument/rule.yml       | 18 ------------------
12e95e
 .../grub2_page_poison_argument/rule.yml        | 18 ------------------
12e95e
 .../grub2_slub_debug_argument/rule.yml         | 18 ------------------
12e95e
 7 files changed, 126 deletions(-)
12e95e
12e95e
diff --git a/linux_os/guide/system/auditing/grub2_audit_argument/rule.yml b/linux_os/guide/system/auditing/grub2_audit_argument/rule.yml
12e95e
index aff0521ee73..00a4ded2738 100644
12e95e
--- a/linux_os/guide/system/auditing/grub2_audit_argument/rule.yml
12e95e
+++ b/linux_os/guide/system/auditing/grub2_audit_argument/rule.yml
12e95e
@@ -54,24 +54,6 @@ ocil_clause: 'auditing is not enabled at boot time'
12e95e
 ocil: |-
12e95e
     {{{ ocil_grub2_argument("audit=1") | indent(4) }}}
12e95e
 
12e95e
-warnings:
12e95e
-    - management: |-
12e95e
-        The GRUB 2 configuration file, <tt>grub.cfg</tt>,
12e95e
-        is automatically updated each time a new kernel is installed. Note that any
12e95e
-        changes to <tt>/etc/default/grub</tt> require rebuilding the <tt>grub.cfg</tt>
12e95e
-        file. To update the GRUB 2 configuration file manually, use the
12e95e
-        
grub2-mkconfig -o
command as follows:
12e95e
-        
    12e95e
    -        
  • On BIOS-based machines, issue the following command as <tt>root</tt>:
  • 12e95e
    -        
    ~]# grub2-mkconfig -o {{{ grub2_boot_path }}}/grub.cfg
    12e95e
    -        
  • On UEFI-based machines, issue the following command as <tt>root</tt>:
  • 12e95e
    -{{% if product in ["rhel7", "ol7", "rhel8", "ol8"] %}}
    12e95e
    -        
    ~]# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
    12e95e
    -{{% else %}}
    12e95e
    -        
    ~]# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
    12e95e
    -{{% endif %}}
    12e95e
    -        
    12e95e
    -
    12e95e
     platform: grub2
    12e95e
     
    12e95e
     template:
    12e95e
    diff --git a/linux_os/guide/system/auditing/grub2_audit_backlog_limit_argument/rule.yml b/linux_os/guide/system/auditing/grub2_audit_backlog_limit_argument/rule.yml
    12e95e
    index 868d525014f..efbc3dae1c1 100644
    12e95e
    --- a/linux_os/guide/system/auditing/grub2_audit_backlog_limit_argument/rule.yml
    12e95e
    +++ b/linux_os/guide/system/auditing/grub2_audit_backlog_limit_argument/rule.yml
    12e95e
    @@ -41,24 +41,6 @@ ocil_clause: 'audit backlog limit is not configured'
    12e95e
     ocil: |-
    12e95e
         {{{ ocil_grub2_argument("audit_backlog_limit=8192") | indent(4) }}}
    12e95e
     
    12e95e
    -warnings:
    12e95e
    -    - management: |-
    12e95e
    -        The GRUB 2 configuration file, <tt>grub.cfg</tt>,
    12e95e
    -        is automatically updated each time a new kernel is installed. Note that any
    12e95e
    -        changes to <tt>/etc/default/grub</tt> require rebuilding the <tt>grub.cfg</tt>
    12e95e
    -        file. To update the GRUB 2 configuration file manually, use the
    12e95e
    -        
    grub2-mkconfig -o
    command as follows:
    12e95e
    -        
      12e95e
      -        
    • On BIOS-based machines, issue the following command as <tt>root</tt>:
    • 12e95e
      -        
      ~]# grub2-mkconfig -o {{{ grub2_boot_path }}}/grub.cfg
      12e95e
      -        
    • On UEFI-based machines, issue the following command as <tt>root</tt>:
    • 12e95e
      -{{% if product in ["rhel7", "rhel8", "ol7", "ol8"] %}}
      12e95e
      -        
      ~]# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
      12e95e
      -{{% else %}}
      12e95e
      -        
      ~]# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
      12e95e
      -{{% endif %}}
      12e95e
      -        
      12e95e
      -
      12e95e
       platform: grub2
      12e95e
       
      12e95e
       template:
      12e95e
      diff --git a/linux_os/guide/system/bootloader-grub2/grub2_pti_argument/rule.yml b/linux_os/guide/system/bootloader-grub2/grub2_pti_argument/rule.yml
      12e95e
      index 51b0a284746..52a308e3247 100644
      12e95e
      --- a/linux_os/guide/system/bootloader-grub2/grub2_pti_argument/rule.yml
      12e95e
      +++ b/linux_os/guide/system/bootloader-grub2/grub2_pti_argument/rule.yml
      12e95e
      @@ -34,24 +34,6 @@ ocil_clause: 'Kernel page-table isolation is not enabled'
      12e95e
       ocil: |-
      12e95e
           {{{ ocil_grub2_argument("pti=on") | indent(4) }}}
      12e95e
       
      12e95e
      -warnings:
      12e95e
      -    - management: |-
      12e95e
      -        The GRUB 2 configuration file, <tt>grub.cfg</tt>,
      12e95e
      -        is automatically updated each time a new kernel is installed. Note that any
      12e95e
      -        changes to <tt>/etc/default/grub</tt> require rebuilding the <tt>grub.cfg</tt>
      12e95e
      -        file. To update the GRUB 2 configuration file manually, use the
      12e95e
      -        
      grub2-mkconfig -o
      command as follows:
      12e95e
      -        
        12e95e
        -        
      • On BIOS-based machines, issue the following command as <tt>root</tt>:
      • 12e95e
        -        
        ~]# grub2-mkconfig -o {{{ grub2_boot_path }}}/grub.cfg
        12e95e
        -        
      • On UEFI-based machines, issue the following command as <tt>root</tt>:
      • 12e95e
        -{{% if product in ["rhel8", "ol8"] %}}
        12e95e
        -        
        ~]# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
        12e95e
        -{{% else %}}
        12e95e
        -        
        ~]# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
        12e95e
        -{{% endif %}}
        12e95e
        -        
        12e95e
        -
        12e95e
         platform: machine
        12e95e
         
        12e95e
         template:
        12e95e
        diff --git a/linux_os/guide/system/bootloader-grub2/grub2_vsyscall_argument/rule.yml b/linux_os/guide/system/bootloader-grub2/grub2_vsyscall_argument/rule.yml
        12e95e
        index 1b88d13bd3c..93eb31dad7b 100644
        12e95e
        --- a/linux_os/guide/system/bootloader-grub2/grub2_vsyscall_argument/rule.yml
        12e95e
        +++ b/linux_os/guide/system/bootloader-grub2/grub2_vsyscall_argument/rule.yml
        12e95e
        @@ -34,24 +34,6 @@ ocil_clause: 'vsyscalls are enabled'
        12e95e
         ocil: |-
        12e95e
             {{{ ocil_grub2_argument("vsyscall=none") | indent(4) }}}
        12e95e
         
        12e95e
        -warnings:
        12e95e
        -    - management: |-
        12e95e
        -        The GRUB 2 configuration file, <tt>grub.cfg</tt>,
        12e95e
        -        is automatically updated each time a new kernel is installed. Note that any
        12e95e
        -        changes to <tt>/etc/default/grub</tt> require rebuilding the <tt>grub.cfg</tt>
        12e95e
        -        file. To update the GRUB 2 configuration file manually, use the
        12e95e
        -        
        grub2-mkconfig -o
        command as follows:
        12e95e
        -        
          12e95e
          -        
        • On BIOS-based machines, issue the following command as <tt>root</tt>:
        • 12e95e
          -        
          ~]# grub2-mkconfig -o {{{ grub2_boot_path }}}/grub.cfg
          12e95e
          -        
        • On UEFI-based machines, issue the following command as <tt>root</tt>:
        • 12e95e
          -{{% if product in ["rhel7", "rhel8", "ol7", "ol8"] %}}
          12e95e
          -        
          ~]# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
          12e95e
          -{{% else %}}
          12e95e
          -        
          ~]# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
          12e95e
          -{{% endif %}}
          12e95e
          -        
          12e95e
          -
          12e95e
           platform: machine
          12e95e
           
          12e95e
           template:
          12e95e
          diff --git a/linux_os/guide/system/network/network-ipv6/disabling_ipv6/grub2_ipv6_disable_argument/rule.yml b/linux_os/guide/system/network/network-ipv6/disabling_ipv6/grub2_ipv6_disable_argument/rule.yml
          12e95e
          index c0fda343a1a..9e1ca48efe0 100644
          12e95e
          --- a/linux_os/guide/system/network/network-ipv6/disabling_ipv6/grub2_ipv6_disable_argument/rule.yml
          12e95e
          +++ b/linux_os/guide/system/network/network-ipv6/disabling_ipv6/grub2_ipv6_disable_argument/rule.yml
          12e95e
          @@ -30,24 +30,6 @@ ocil_clause: 'IPv6 is not disabled'
          12e95e
           ocil: |-
          12e95e
               {{{ ocil_grub2_argument("ipv6.disable=1") | indent(4) }}}
          12e95e
           
          12e95e
          -warnings:
          12e95e
          -    - management: |-
          12e95e
          -        The GRUB 2 configuration file, <tt>grub.cfg</tt>,
          12e95e
          -        is automatically updated each time a new kernel is installed. Note that any
          12e95e
          -        changes to <tt>/etc/default/grub</tt> require rebuilding the <tt>grub.cfg</tt>
          12e95e
          -        file. To update the GRUB 2 configuration file manually, use the
          12e95e
          -        
          grub2-mkconfig -o
          command as follows:
          12e95e
          -        
            12e95e
            -        
          • On BIOS-based machines, issue the following command:
          • 12e95e
            -        
            sudo grub2-mkconfig -o {{{ grub2_boot_path }}}/grub.cfg
            12e95e
            -        
          • On UEFI-based machines, issue the following command:
          • 12e95e
            -{{% if product in ["rhel7", "ol7", "rhel8", "ol8"] %}}
            12e95e
            -        
            sudo grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
            12e95e
            -{{% else %}}
            12e95e
            -        
            sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
            12e95e
            -{{% endif %}}
            12e95e
            -        
            12e95e
            -
            12e95e
             platform: grub2
            12e95e
             
            12e95e
             template:
            12e95e
            diff --git a/linux_os/guide/system/permissions/restrictions/poisoning/grub2_page_poison_argument/rule.yml b/linux_os/guide/system/permissions/restrictions/poisoning/grub2_page_poison_argument/rule.yml
            12e95e
            index 1f4e183d9e7..1ad6c6b3c44 100644
            12e95e
            --- a/linux_os/guide/system/permissions/restrictions/poisoning/grub2_page_poison_argument/rule.yml
            12e95e
            +++ b/linux_os/guide/system/permissions/restrictions/poisoning/grub2_page_poison_argument/rule.yml
            12e95e
            @@ -36,24 +36,6 @@ ocil_clause: 'page allocator poisoning is not enabled'
            12e95e
             ocil: |-
            12e95e
                 {{{ ocil_grub2_argument("page_poison=1") | indent(4) }}}
            12e95e
             
            12e95e
            -warnings:
            12e95e
            -    - management: |-
            12e95e
            -        The GRUB 2 configuration file, <tt>grub.cfg</tt>,
            12e95e
            -        is automatically updated each time a new kernel is installed. Note that any
            12e95e
            -        changes to <tt>/etc/default/grub</tt> require rebuilding the <tt>grub.cfg</tt>
            12e95e
            -        file. To update the GRUB 2 configuration file manually, use the
            12e95e
            -        
            grub2-mkconfig -o
            command as follows:
            12e95e
            -        
              12e95e
              -        
            • On BIOS-based machines, issue the following command as <tt>root</tt>:
            • 12e95e
              -        
              ~]# grub2-mkconfig -o {{{ grub2_boot_path }}}/grub.cfg
              12e95e
              -        
            • On UEFI-based machines, issue the following command as <tt>root</tt>:
            • 12e95e
              -{{% if product in ["rhel7", "rhel8", "ol7", "ol8"] %}}
              12e95e
              -        
              ~]# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
              12e95e
              -{{% else %}}
              12e95e
              -        
              ~]# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
              12e95e
              -{{% endif %}}
              12e95e
              -        
              12e95e
              -
              12e95e
               platform: grub2
              12e95e
               
              12e95e
               template:
              12e95e
              diff --git a/linux_os/guide/system/permissions/restrictions/poisoning/grub2_slub_debug_argument/rule.yml b/linux_os/guide/system/permissions/restrictions/poisoning/grub2_slub_debug_argument/rule.yml
              12e95e
              index bb5dbc6c125..e40f5377c61 100644
              12e95e
              --- a/linux_os/guide/system/permissions/restrictions/poisoning/grub2_slub_debug_argument/rule.yml
              12e95e
              +++ b/linux_os/guide/system/permissions/restrictions/poisoning/grub2_slub_debug_argument/rule.yml
              12e95e
              @@ -36,24 +36,6 @@ ocil_clause: 'SLUB/SLAB poisoning is not enabled'
              12e95e
               ocil: |-
              12e95e
                   {{{ ocil_grub2_argument("slub_debug=P") | indent(4) }}}
              12e95e
               
              12e95e
              -warnings:
              12e95e
              -    - management: |-
              12e95e
              -        The GRUB 2 configuration file, <tt>grub.cfg</tt>,
              12e95e
              -        is automatically updated each time a new kernel is installed. Note that any
              12e95e
              -        changes to <tt>/etc/default/grub</tt> require rebuilding the <tt>grub.cfg</tt>
              12e95e
              -        file. To update the GRUB 2 configuration file manually, use the
              12e95e
              -        
              grub2-mkconfig -o
              command as follows:
              12e95e
              -        
                12e95e
                -        
              • On BIOS-based machines, issue the following command as <tt>root</tt>:
              • 12e95e
                -        
                ~]# grub2-mkconfig -o {{{ grub2_boot_path }}}/grub.cfg
                12e95e
                -        
              • On UEFI-based machines, issue the following command as <tt>root</tt>:
              • 12e95e
                -{{% if product in ["rhel7", "rhel8", "ol7", "ol8"] %}}
                12e95e
                -        
                ~]# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
                12e95e
                -{{% else %}}
                12e95e
                -        
                ~]# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
                12e95e
                -{{% endif %}}
                12e95e
                -        
                12e95e
                -
                12e95e
                 platform: grub2
                12e95e
                 
                12e95e
                 template:
                12e95e
                12e95e
                From bbc3cc093004efd0457ccb33722a4fb14b0b2fb8 Mon Sep 17 00:00:00 2001
                12e95e
                From: vojtapolasek <krecoun@gmail.com>
                12e95e
                Date: Mon, 14 Feb 2022 14:29:15 +0100
                12e95e
                Subject: [PATCH 7/8] Update shared/macros.jinja
                12e95e
                MIME-Version: 1.0
                12e95e
                Content-Type: text/plain; charset=UTF-8
                12e95e
                Content-Transfer-Encoding: 8bit
                12e95e
                12e95e
                Co-authored-by: Matěj Týč <matej.tyc@gmail.com>
                12e95e
                ---
                12e95e
                 shared/macros.jinja | 7 ++++++-
                12e95e
                 1 file changed, 6 insertions(+), 1 deletion(-)
                12e95e
                12e95e
                diff --git a/shared/macros.jinja b/shared/macros.jinja
                12e95e
                index 54d2b299a47..392181e2b24 100644
                12e95e
                --- a/shared/macros.jinja
                12e95e
                +++ b/shared/macros.jinja
                12e95e
                @@ -1671,7 +1671,12 @@ The command should not return any output.
                12e95e
                 {{%- endif -%}}
                12e95e
                 {{%- else -%}}
                12e95e
                 Inspect the form of default GRUB 2 command line for the Linux operating system
                12e95e
                -in <tt>{{{ grub2_boot_path }}}/grubenv</tt>. If they include <tt>{{{ arg_name_value }}}</tt>, then the parameter
                12e95e
                +{{% if grub2_boot_path == grub2_uefi_boot_path or not grub2_uefi_boot_path -%}}
                12e95e
                +in <tt>{{{ grub2_boot_path }}}/grubenv</tt>.
                12e95e
                +{{%- else -%}}
                12e95e
                +in <tt>grubenv</tt> that can be found either in <tt>{{{ grub2_boot_path }}}</tt> in case of legacy BIOS systems, or in <tt>{{{ grub2_uefi_boot_path }}}</tt> in case of UEFI systems.
                12e95e
                +{{%- endif %}}
                12e95e
                +If they include <tt>{{{ arg_name_value }}}</tt>, then the parameter
                12e95e
                 is configured at boot time.
                12e95e
                 
                # grep 'kernelopts.*{{{ arg_name_value }}}.*' {{{ grub2_boot_path }}}/grubenv
                12e95e
                 {{%- endif -%}}
                12e95e
                12e95e
                From 8121376668b43d21cf0f9700994bc011c3e313d7 Mon Sep 17 00:00:00 2001
                12e95e
                From: Vojtech Polasek <vpolasek@redhat.com>
                12e95e
                Date: Mon, 14 Feb 2022 15:17:33 +0100
                12e95e
                Subject: [PATCH 8/8] more modifications to description and ocil
                12e95e
                12e95e
                final touches
                12e95e
                ---
                12e95e
                 shared/macros.jinja | 15 ++++++++++-----
                12e95e
                 1 file changed, 10 insertions(+), 5 deletions(-)
                12e95e
                12e95e
                diff --git a/shared/macros.jinja b/shared/macros.jinja
                12e95e
                index 392181e2b24..a89bac12f53 100644
                12e95e
                --- a/shared/macros.jinja
                12e95e
                +++ b/shared/macros.jinja
                12e95e
                @@ -1626,7 +1626,7 @@ The audit daemon must be restarted for the changes to take effect.
                12e95e
                     The parameter should be in form `parameter=value`.
                12e95e
                 #}}
                12e95e
                 {{%- macro describe_grub2_argument(arg_name_value) -%}}
                12e95e
                -{{%- if product in ["rhel7", "ol7", "rhel9"] or 'ubuntu' in product -%}}
                12e95e
                +{{%- if product in ["rhel7", "ol7", "rhel8", "ol8", "rhel9"] or 'ubuntu' in product -%}}
                12e95e
                 To ensure that <tt>{{{ arg_name_value }}}</tt> is added as a kernel command line
                12e95e
                 argument to newly installed kernels, ad <tt>{{{ arg_name_value }}}</tt> to the
                12e95e
                 default Grub2 command line for Linux operating systems.  Modify the line within
                12e95e
                @@ -1649,7 +1649,7 @@ Configure the default Grub2 kernel command line to contain {{{ arg_name_value }}
                12e95e
                     The parameter should have form `parameter=value`.
                12e95e
                 #}}
                12e95e
                 {{%- macro ocil_grub2_argument(arg_name_value) -%}}
                12e95e
                -{{%- if product in ["rhel7", "ol7", "rhel9"] or 'ubuntu' in product -%}}
                12e95e
                +{{%- if product in ["rhel7", "ol7", "rhel8", "ol8", "rhel9"] or 'ubuntu' in product -%}}
                12e95e
                 Inspect the form of default GRUB 2 command line for the Linux operating system
                12e95e
                 in <tt>/etc/default/grub</tt>. If it includes <tt>{{{ arg_name_value }}}</tt>,
                12e95e
                 then the parameter will be configured for newly installed kernels.
                12e95e
                @@ -1660,8 +1660,12 @@ If this option is set to true, then check that a line is output by the following
                12e95e
                 If the recovery is disabled, check the line with
                12e95e
                 
                $ grep 'GRUB_CMDLINE_LINUX.*{{{ arg_name_value }}}.*' /etc/default/grub
                .
                12e95e
                 {{%- if 'ubuntu' in product -%}}
                12e95e
                -Moreover, current Grub2 config file in <tt>{{{ grub2_boot_path }}}/grub.cfg</tt> must be checked.
                12e95e
                -
                # grep vmlinuz {{{ grub2_boot_path }}}/grub.cfg | grep -v '{{{ arg_name_value }}}'
                12e95e
                +Moreover, current Grub config file <tt>grub.cfg</tt> must be checked. The file can be found
                12e95e
                +either in <tt>{{{ grub2_boot_path }}}</tt> in case of legacy BIOS systems, or in <tt>{{{ grub2_uefi_boot_path }}}</tt> in case of UEFI systems.
                12e95e
                +If they include <tt>{{{ arg_name_value }}}</tt>, then the parameter
                12e95e
                +is configured at boot time.
                12e95e
                +
                # grep vmlinuz GRUB_CFG_FILE_PATH | grep -v '{{{ arg_name_value }}}'
                12e95e
                +Fill in <tt>GRUB_CFG_FILE_PATH</tt> based on information above.
                12e95e
                 This command should not return any output.
                12e95e
                 {{%- else -%}}
                12e95e
                 Moreover, command line parameters for currently installed kernels should be checked as well.
                12e95e
                @@ -1678,6 +1682,7 @@ in <tt>grubenv</tt> that can be found either in <tt>{{{ grub2_boot_path }}}</tt>
                12e95e
                 {{%- endif %}}
                12e95e
                 If they include <tt>{{{ arg_name_value }}}</tt>, then the parameter
                12e95e
                 is configured at boot time.
                12e95e
                -
                # grep 'kernelopts.*{{{ arg_name_value }}}.*' {{{ grub2_boot_path }}}/grubenv
                12e95e
                +
                # grep 'kernelopts.*{{{ arg_name_value }}}.*' GRUBENV_FILE_LOCATION
                12e95e
                +Fill in <tt>GRUBENV_FILE_LOCATION</tt> based on information above.
                12e95e
                 {{%- endif -%}}
                12e95e
                 {{%- endmacro -%}}