Skip to content

RFC module: Optionally use .platform keyring for signatures verification

Vitaly Kuznetsov keyrings linux-doc linux-integrity linux-modules linux-security-module lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest1 patch 17 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1module: Make use of platform keyring for module signature verifyDocumentation/admin-guide/module-signing.rst kernel/module/Kconfig kernel/module/signing.c +1 more+26 -27 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH RFC 0/1] module: Optionally use .platform keyring for signatures verification

UEFI SecureBoot 'db' keys are currently not trusted for modules signatures verification. RedHat based downstream distros (RHEL, Fedora, ...) carry a patch changing that for many years (since 2019 at least). This RFC is an attempt to upstream it as the functionality seems to be generally useful.

Previously, pre-boot keys (SecureBoot 'db', MOK) were not trusted within kernel at all. Things have changed since '.machine' keyring got introduced making MOK keys optionally trusted. Before that, there was a discussion to make .platform trusted by default:
https://lore.kernel.org/lkml/[email protected]/
which didn't go very far because the assumption was that this is only useful when the user has control over 'db'. I believe there's a fairly common use-case where this is true.

The use-case: virtualized and cloud infrastructure generally provide an ability to customize SecureBoot variables, in particular, it is possible to bring your own SecureBoot 'db'. This may come handy when a user wants to load a third party kernel module (self built or provided by a third party vendor) while still using a distro provided kernel. Generally, distro provided kernels sign modules with an ephemeral key and discard the private part during the build. While MOK can sometimes be used to sign something out-of-tree, it is a tedious process requiring either a manual intervention with shim or a 'certmule'
(see https://blogs.oracle.com/linux/post/the-machine-keyring). In contrast, the beauty of using SecureBoot 'db' in this scenario is that for public clouds and virtualized infrastructure it is normally a property of the OS image (or the whole infrastructure/host) and not an individual instance; this means that all instances created from the same template will have 'db' keys in '.platform' by default.

The suggested approach is not to change the default, but to introduce a Kconfig variable (CONFIG_MODULE_SIG_PLATFORM) doing the job. Note, the kernel already trusts '.platform' for kexec (see commit 278311e417be ("kexec, KEYS: Make use of platform keyring for signature verify")) and dm-verity (see commit 6fce1f40e951 ("dm verity: add support for signature verification with platform keyring")) so maybe changing the default or introducing a generic '.plarform is fully trusted' option would actually be better.

Vitaly Kuznetsov (1):
module: Make use of platform keyring for module signature verify

 Documentation/admin-guide/module-signing.rst |  6 ++++++
 kernel/module/Kconfig                        | 11 +++++++++++
 kernel/module/signing.c                      |  9 ++++++++-
 security/integrity/Kconfig                   |  2 +-
 4 files changed, 26 insertions(+), 2 deletions(-)
Signature · 1 line
2.49.0