Added option to add a salt, this will allow ansible to idempotently set the password

Signed-off-by: Jeffrey van Pelt <jeff@vanpelt.one>
This commit is contained in:
Jeffrey van Pelt 2025-06-05 22:41:33 +02:00
parent d08e7380d6
commit 59eca28b3c
No known key found for this signature in database
GPG key ID: 39EFF6AA1F5B11A0
2 changed files with 4 additions and 1 deletions

View file

@ -563,6 +563,9 @@ rhel9cis_selinux_enforce: enforcing
# This variable will store the GRUB bootloader password to be stored in '/boot/grub2/user.cfg' file. The default value must be changed. # This variable will store the GRUB bootloader password to be stored in '/boot/grub2/user.cfg' file. The default value must be changed.
rhel9cis_bootloader_password: password # pragma: allowlist secret rhel9cis_bootloader_password: password # pragma: allowlist secret
# Set this value to anything secure to have predictable hashes, which will prevent unnecessary changes
rhel9cis_bootloader_salt: ''
## Control 1.4.1 ## Control 1.4.1
# This variable governs whether a bootloader password should be set in '/boot/grub2/user.cfg' file. # This variable governs whether a bootloader password should be set in '/boot/grub2/user.cfg' file.
rhel9cis_set_boot_pass: true rhel9cis_set_boot_pass: true

View file

@ -13,7 +13,7 @@
- NIST800-53R5_AC-3 - NIST800-53R5_AC-3
ansible.builtin.copy: ansible.builtin.copy:
dest: /boot/grub2/user.cfg dest: /boot/grub2/user.cfg
content: "GRUB2_PASSWORD={{ rhel9cis_bootloader_password_hash | default(rhel9cis_bootloader_password | grub_hash) }}" # noqa template-instead-of-copy content: "GRUB2_PASSWORD={{ rhel9cis_bootloader_password_hash | default(rhel9cis_bootloader_password | grub_hash(salt=rhel9cis_bootloader_salt)) }}" # noqa template-instead-of-copy
owner: root owner: root
group: root group: root
mode: 'go-rwx' mode: 'go-rwx'