tasks: auth: Pass --unrestricted to Linux Grub2 entries

The password protection aims to only prevent users from editing the
menu entries not from booting the system altogether. Fedora is patching
the 10_linux file to use '--unrestricted' so all users can boot the
system. As such, we apply a similar patch to the rest of the distros.

Change-Id: I1390a330ea1f0b48e71fdcb548614d5582fffbd4
Link: http://pkgs.fedoraproject.org/cgit/rpms/grub2.git/tree/0109-Don-t-require-a-password-to-boot-entries-generated-b.patch
Link: https://www.gnu.org/software/grub/manual/grub/html_node/Authentication-and-authorisation.html#Authentication-and-authorisation
Closes-Bug: 1735709
This commit is contained in:
Markos Chandras 2018-01-10 16:08:57 +00:00
parent 8025799fe6
commit 65dce4045a
2 changed files with 21 additions and 10 deletions

View File

@ -174,19 +174,28 @@
- always
- name: Set a GRUB 2 password for single-user/maintenance modes
blockinfile:
path: "{{ grub_custom_file }}"
insertbefore: EOF
marker: "# {mark} MANAGED BY ANSIBLE-HARDENING"
block: |
set superusers="root"
password_pbkdf2 root {{ security_grub_password_hash }}
state: present
block:
- blockinfile:
path: "{{ grub_custom_file }}"
insertbefore: EOF
marker: "# {mark} MANAGED BY ANSIBLE-HARDENING"
block: |
set superusers="root"
password_pbkdf2 root {{ security_grub_password_hash }}
state: present
notify:
- update grub config
- lineinfile:
path: "{{ grub_linux_file }}"
regexp: '^CLASS=.*'
line: 'CLASS="--class gnu-linux --class gnu --class os --unrestricted"'
state: present
backrefs: yes
notify:
- update grub config
when:
- grub_custom_file_check.stat.exists | bool
- security_require_grub_authentication | bool
notify:
- update grub config
tags:
- auth
- high

View File

@ -22,6 +22,8 @@
## grub custom configuration
grub_custom_file: /etc/grub.d/40_custom
## grub main linux configuration
grub_linux_file: /etc/grub.d/10_linux
## auditd configuration
auditd_config: