Skip to content

Commit

Permalink
Optimize platform expressions in bootloader-grub2 group
Browse files Browse the repository at this point in the history
The bootloader-grub2 group contains multiple different platform
expressions. However, all of them are related to grub2 and all of them
should be applicable for bootable container, therefore, the platform can
be set on the group level in group.yml to `grub2 and system_with_kernel`.
Setting the platform on the group level allows us to simplify platform
expressions in individual rules. Most of them that only set platform
to `machine` or to `system_with_kernel` can be removed completely.
  • Loading branch information
jan-cerny committed Dec 12, 2024
1 parent f078617 commit 2ce53c4
Show file tree
Hide file tree
Showing 39 changed files with 2 additions and 40 deletions.
2 changes: 1 addition & 1 deletion linux_os/guide/system/bootloader-grub2/group.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ description: |-
with a password and ensure its configuration file's permissions
are set properly.
platform: grub2
platform: grub2 and system_with_kernel
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,3 @@ fixtext: |-
Then, run the following command:
$ sudo {{{ grub_command("update") }}}
platform: grub2
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ identifiers:
cce@sle12: CCE-91532-2
cce@sle15: CCE-91217-0

platform: system_with_kernel

ocil_clause: 'I/OMMU is not activated'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ ocil_clause: 'the kernel is not configured to zero out memory before allocation'
ocil: |-
{{{ ocil_grub2_argument("init_on_alloc=1") | indent(4) }}}
platform: system_with_kernel
template:
name: grub2_bootloader_argument
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ ocil: |-
the kernel, check that the option is configured through boot parameter.
{{{ ocil_grub2_argument("random.trust_cpu=on") | indent(4) }}}
platform: system_with_kernel
template:
name: grub2_bootloader_argument
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ ocil_clause: 'l1tf mitigations are not configured appropriately'
ocil: |-
{{{ ocil_grub2_argument("l1tf=" + xccdf_value("var_l1tf_options")) | indent(4) }}}
platform: system_with_kernel
template:
name: grub2_bootloader_argument
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ ocil_clause: 'MCE tolerance is not set to zero'
ocil: |-
{{{ ocil_grub2_argument("mce=0") | indent(4) }}}
platform: system_with_kernel
template:
name: grub2_bootloader_argument
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ ocil_clause: 'MDS mitigations are not configured appropriately'
ocil: |-
{{{ ocil_grub2_argument("mds=" + xccdf_value(var_mds_options)) | indent(4) }}}
platform: system_with_kernel
template:
name: grub2_bootloader_argument
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ references:
srg: SRG-OS-000480-GPOS-00227
stigid@ol8: OL08-00-010424

platform: system_with_kernel

ocil_clause: 'mitigations is set to off'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ ocil: |-
<pre>grep -q nosmap /boot/config-`uname -r`</pre>
If the command returns a line, it means that SMAP is being disabled.
platform: system_with_kernel
template:
name: grub2_bootloader_argument_absent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ ocil: |-
<pre>grep -q nosmep /boot/config-`uname -r`</pre>
If the command returns a line, it means that SMEP is being disabled.
platform: system_with_kernel
template:
name: grub2_bootloader_argument_absent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ ocil_clause: 'randomization of the page allocator is not enabled in the kernel'
ocil: |-
{{{ ocil_grub2_argument("page_alloc.shuffle=1") | indent(4) }}}
platform: system_with_kernel
template:
name: grub2_bootloader_argument
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ ocil_clause: 'Kernel page-table isolation is not enabled'
ocil: |-
{{{ ocil_grub2_argument("pti=on") | indent(4) }}}
platform: system_with_kernel
template:
name: grub2_bootloader_argument
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ ocil_clause: 'trust on hardware random number generator is not configured approp
ocil: |-
{{{ ocil_grub2_argument("rng_core.default_quality=" + xccdf_value("var_rng_core_default_quality")) | indent(4) }}}
platform: system_with_kernel
template:
name: grub2_bootloader_argument
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ ocil_clause: 'merging of slabs with similar size is enabled'
ocil: |-
{{{ ocil_grub2_argument("slab_nomerge=yes") | indent(4) }}}
platform: system_with_kernel
template:
name: grub2_bootloader_argument
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ ocil_clause: 'SSB is not configured appropriately'
ocil: |-
{{{ ocil_grub2_argument("spec_store_bypass_disable=" + xccdf_value("var_spec_store_bypass_disable_options")) | indent(4) }}}
platform: system_with_kernel
template:
name: grub2_bootloader_argument
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ ocil_clause: 'spectre_v2 mitigation is not enforced'
ocil: |-
{{{ ocil_grub2_argument("spectre_v2=on") | indent(4) }}}
platform: system_with_kernel
template:
name: grub2_bootloader_argument
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ ocil: |-
fixtext: |-
{{{ fixtext_grub2_bootloader_argument_absent("debug-shell") | indent(4) }}}
platform: system_with_kernel
template:
name: grub2_bootloader_argument_absent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ocil_clause: 'vsyscalls are enabled'
ocil: |-
{{{ ocil_grub2_argument("vsyscall=none") | indent(4) }}}
platform: system_with_kernel and x86_64_arch
platform: x86_64_arch

template:
name: grub2_bootloader_argument
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ fixtext: '{{{ fixtext_file_group_owner(grub2_boot_path ~ "/grub.cfg", "root") }}

srg_requirement: '{{{ srg_requirement_file_group_owner(grub2_boot_path ~ "/grub.cfg", "root") }}}'

platform: system_with_kernel

template:
name: file_groupowner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ fixtext: '{{{ fixtext_file_group_owner(grub2_boot_path ~ "/user.cfg", "root") }}

srg_requirement: '{{{ srg_requirement_file_group_owner(grub2_boot_path ~ "/user.cfg", "root") }}}'

platform: machine

template:
name: file_groupowner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ ocil_clause: '{{{ ocil_clause_file_owner(file=grub2_boot_path ~ "/grub.cfg", own
ocil: |-
{{{ ocil_file_owner(file=grub2_boot_path ~ "/grub.cfg", owner="root") }}}
platform: system_with_kernel
template:
name: file_owner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ ocil_clause: '{{{ ocil_clause_file_owner(file=grub2_boot_path ~ "/user.cfg", own
ocil: |-
{{{ ocil_file_owner(file=grub2_boot_path ~ "/user.cfg", owner="root") }}}
platform: machine
template:
name: file_owner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ ocil: |-
If properly configured, the output should indicate the following
permissions: <tt>-rw-------</tt>
platform: system_with_kernel
template:
name: file_permissions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ ocil_clause: '{{{ ocil_clause_file_permissions(file=grub2_boot_path ~ "/user.cfg
ocil: |-
{{{ ocil_file_permissions(file=grub2_boot_path ~ "/user.cfg", perms="-rw-------") }}}
platform: machine
template:
name: file_permissions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ warnings:
Also, do NOT manually add the superuser account and password to the
<tt>grub.cfg</tt> file as the grub2-mkconfig command overwrites this file.
platform: machine
fixtext: |-
Configure {{{ full_name }}} to have a unique username for the grub superuser account.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ ocil: |-
media which should not exist in the lines:
<pre>set root='hd0,msdos1'</pre>
platform: machine
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ warnings:
Also, do NOT manually add the superuser account and password to the
<tt>grub.cfg</tt> file as the grub2-mkconfig command overwrites this file.
platform: machine
fixtext: |-
Configure {{{ full_name }}} to require a grub bootloader password for the grub superuser account.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,3 @@ warnings:
Also, do NOT manually add the superuser account and password to the
<tt>grub.cfg</tt> file as the grub2-mkconfig command overwrites this file.
platform: system_with_kernel
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ ocil_clause: '{{{ ocil_clause_file_group_owner(file=grub2_uefi_boot_path ~ "/gru
ocil: |-
{{{ ocil_file_group_owner(file=grub2_uefi_boot_path ~ "/grub.cfg", group="root") }}}
platform: machine
template:
name: file_groupowner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ ocil_clause: '{{{ ocil_clause_file_group_owner(file=grub2_uefi_boot_path ~ "/use
ocil: |-
{{{ ocil_file_group_owner(file=grub2_uefi_boot_path ~ "/user.cfg", group="root") }}}
platform: machine
template:
name: file_groupowner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ ocil_clause: '{{{ ocil_clause_file_owner(file=grub2_uefi_boot_path ~ "/grub.cfg"
ocil: |-
{{{ ocil_file_owner(file=grub2_uefi_boot_path ~ "/grub.cfg", owner="root") }}}
platform: machine
template:
name: file_owner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ ocil_clause: '{{{ ocil_clause_file_owner(file=grub2_uefi_boot_path ~ "/user.cfg"
ocil: |-
{{{ ocil_file_owner(file=grub2_uefi_boot_path ~ "/user.cfg", owner="root") }}}
platform: machine
template:
name: file_owner
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ ocil: |-
If properly configured, the output should indicate the following
permissions: <tt>-rwx------</tt>
platform: machine
template:
name: file_permissions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ ocil_clause: '{{{ ocil_clause_file_permissions(file=grub2_uefi_boot_path ~ "/use
ocil: |-
{{{ ocil_file_permissions(file=grub2_uefi_boot_path ~ "/user.cfg", perms="-rw-------") }}}
platform: machine
template:
name: file_permissions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ warnings:
Also, do NOT manually add the superuser account and password to the
<tt>grub.cfg</tt> file as the grub2-mkconfig command overwrites this file.
platform: machine
fixtext: |-
Configure {{{ full_name }}} to have a unique username for the grub superuser account.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ warnings:
Also, do NOT manually add the superuser account and password to the
<tt>grub.cfg</tt> file as the grub2-mkconfig command overwrites this file.
platform: system_with_kernel
fixtext: |-
Configure {{{ full_name }}} to use a secure UEFI boot loader password.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,3 @@ warnings:
Also, do NOT manually add the superuser account and password to the
<tt>grub.cfg</tt> file as the grub2-mkconfig command overwrites this file.
platform: machine
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ ocil: |-
media which should not exist in the lines:
<pre>set root='hd0,msdos1'</pre>
platform: machine

0 comments on commit 2ce53c4

Please sign in to comment.