]> git.ipfire.org Git - thirdparty/grub.git/commit
kern: Add lockdown support
authorJavier Martinez Canillas <javierm@redhat.com>
Mon, 28 Sep 2020 18:08:02 +0000 (20:08 +0200)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 2 Mar 2021 14:54:15 +0000 (15:54 +0100)
commit578c95298bcc46e0296f4c786db64c2ff26ce2cc
tree57534e912b4b6095dc874fbb53eb0b07cb252049
parent5e280caa6530ed160dcf2920c94f1605fb1f1f7c
kern: Add lockdown support

When the GRUB starts on a secure boot platform, some commands can be
used to subvert the protections provided by the verification mechanism and
could lead to booting untrusted system.

To prevent that situation, allow GRUB to be locked down. That way the code
may check if GRUB has been locked down and further restrict the commands
that are registered or what subset of their functionality could be used.

The lockdown support adds the following components:

* The grub_lockdown() function which can be used to lockdown GRUB if,
  e.g., UEFI Secure Boot is enabled.

* The grub_is_lockdown() function which can be used to check if the GRUB
  was locked down.

* A verifier that flags OS kernels, the GRUB modules, Device Trees and ACPI
  tables as GRUB_VERIFY_FLAGS_DEFER_AUTH to defer verification to other
  verifiers. These files are only successfully verified if another registered
  verifier returns success. Otherwise, the whole verification process fails.

  For example, PE/COFF binaries verification can be done by the shim_lock
  verifier which validates the signatures using the shim_lock protocol.
  However, the verification is not deferred directly to the shim_lock verifier.
  The shim_lock verifier is hooked into the verification process instead.

* A set of grub_{command,extcmd}_lockdown functions that can be used by
  code registering command handlers, to only register unsafe commands if
  the GRUB has not been locked down.

Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
conf/Makefile.common
docs/grub-dev.texi
docs/grub.texi
grub-core/Makefile.am
grub-core/Makefile.core.def
grub-core/commands/extcmd.c
grub-core/kern/command.c
grub-core/kern/lockdown.c [new file with mode: 0644]
include/grub/command.h
include/grub/extcmd.h
include/grub/lockdown.h [new file with mode: 0644]