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

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

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

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

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

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

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

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

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

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