Skip to content

Commit b0e9319

Browse files
Merge pull request #14330 from teacup-on-rockingchair/sle16_grub2_uefi_pass
SLE16 fix for grub2_uefi_pass
2 parents d05b4cf + 7a40a85 commit b0e9319

2 files changed

Lines changed: 32 additions & 4 deletions

File tree

  • linux_os/guide/system/bootloader-grub2/uefi/grub2_uefi_password
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<def-group>
2+
<definition class="compliance" id="grub2_uefi_password" version="1">
3+
{{{ oval_metadata("The UEFI grub2 boot loader should have password protection enabled.") }}}
4+
5+
<criteria operator="AND">
6+
<criterion comment="make sure a password is defined in {{{ grub2_uefi_boot_path }}}/grub.cfg" test_ref="test_grub2_uefi_password_grubcfg" />
7+
<criterion comment="make sure a superuser is defined in {{{ grub2_uefi_boot_path }}}/grub.cfg" test_ref="test_bootloader_uefi_superuser"/>
8+
</criteria>
9+
</definition>
10+
11+
<ind:textfilecontent54_test check="all" check_existence="all_exist" comment="superuser is defined in {{{ grub2_uefi_boot_path }}}/grub.cfg" id="test_bootloader_uefi_superuser" version="2">
12+
<ind:object object_ref="object_bootloader_uefi_superuser" />
13+
</ind:textfilecontent54_test>
14+
<ind:textfilecontent54_object id="object_bootloader_uefi_superuser" version="2">
15+
<ind:filepath>{{{ grub2_uefi_boot_path }}}/grub.cfg</ind:filepath>
16+
<ind:pattern operation="pattern match">^[\s]*set[\s]+superusers=("?)[a-zA-Z_]+\1$</ind:pattern>
17+
<ind:instance datatype="int">1</ind:instance>
18+
</ind:textfilecontent54_object>
19+
20+
<ind:textfilecontent54_test check="all" check_existence="all_exist" comment="make sure a password is defined in {{{ grub2_uefi_boot_path }}}/grub.cfg" id="test_grub2_uefi_password_grubcfg" version="1">
21+
<ind:object object_ref="object_grub2_uefi_password_grubcfg" />
22+
</ind:textfilecontent54_test>
23+
<ind:textfilecontent54_object id="object_grub2_uefi_password_grubcfg" version="1">
24+
<ind:filepath>{{{ grub2_uefi_boot_path }}}/grub.cfg</ind:filepath>
25+
<ind:pattern operation="pattern match">^[\s]*password_pbkdf2[\s]+.*[\s]+grub\.pbkdf2\.sha512.*$</ind:pattern>
26+
<ind:instance datatype="int">1</ind:instance>
27+
</ind:textfilecontent54_object>
28+
</def-group>

linux_os/guide/system/bootloader-grub2/uefi/grub2_uefi_password/rule.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ description: |-
99
<br /><br />
1010
Since plaintext passwords are a security risk, generate a hash for the password
1111
by running the following command:
12-
{{% if product in ["sle12", "sle15", "slmicro5", "slmicro6", "ubuntu2204", "ubuntu2404"] %}}
12+
{{% if "sle" in product or "slmicro" in product or product in ["ubuntu2204", "ubuntu2404"] %}}
1313
<pre># grub2-mkpasswd-pbkdf2</pre>
1414
{{% else %}}
1515
<pre># grub2-setpassword</pre>
1616
{{% endif %}}
1717
When prompted, enter the password that was selected.
1818
<br /><br />
19-
{{% if product in ["sle12", "sle15", "slmicro5", "slmicro6", "ubuntu2204", "ubuntu2404"] %}}
19+
{{% if "sle" in product or "slmicro" in product or product in ["ubuntu2204", "ubuntu2404"] %}}
2020
Using the hash from the output, modify the <tt>/etc/grub.d/40_custom</tt>
2121
file with the following content:
2222
<pre>set superusers="boot"
@@ -27,7 +27,7 @@ description: |-
2727
Once the superuser password has been added,
2828
update the
2929
<tt>grub.cfg</tt> file by running:
30-
{{%- if "rhel" in product %}}
30+
{{%- if "rhel" in product or "sle" in product or "slmicro" in product %}}
3131
<pre>grub2-mkconfig -o /boot/grub2/grub.cfg</pre>
3232
{{%- else %}}
3333
<pre>{{{ grub_command("update") }}}</pre>
@@ -108,7 +108,7 @@ fixtext: |-
108108
109109
Then, update the grub.cfg file by running:
110110
111-
{{%- if "rhel" in product %}}
111+
{{%- if "rhel" in product or product in ["sle12", "sle15", "sle16", "slmicro5", "slmicro6"] %}}
112112
<pre>grub2-mkconfig -o /boot/grub2/grub.cfg</pre>
113113
{{%- else %}}
114114
<pre>{{{ grub_command("update") }}}</pre>

0 commit comments

Comments
 (0)