Re: [PATCH v9 2/8] integrity: Introduce a Linux keyring called machine
From: Eric Snowberg
Date: Mon Jan 10 2022 - 18:25:43 EST
> On Jan 9, 2022, at 2:57 PM, Mimi Zohar <zohar@xxxxxxxxxxxxx> wrote:
>
> On Wed, 2022-01-05 at 18:50 -0500, Eric Snowberg wrote:
>> Many UEFI Linux distributions boot using shim. The UEFI shim provides
>> what is called Machine Owner Keys (MOK). Shim uses both the UEFI Secure
>> Boot DB and MOK keys to validate the next step in the boot chain. The
>> MOK facility can be used to import user generated keys. These keys can
>> be used to sign an end-users development kernel build. When Linux
>> boots, both UEFI Secure Boot DB and MOK keys get loaded in the Linux
>> .platform keyring.
>>
>> Define a new Linux keyring called machine. This keyring shall contain just
>> MOK CA keys and not the remaining keys in the platform keyring. This new
>> machine keyring will be used in follow on patches. Unlike keys in the
>> platform keyring, keys contained in the machine keyring will be trusted
>> within the kernel if the end-user has chosen to do so.
>
> True, from an IMA perspective only the CA keys should be loaded onto
> the .machine keyring, but this version (v9) of the patch set does not
> enforce that. The patch set and this paragraph are out of sync.
I missed that when I dropped IMA support. I will strike that sentence
in the next round. Or if no code changes are identified, feel free to
remove that sentence.
> Jarkko, my concern is that once this version of the patch set is
> upstreamed, would limiting which keys may be loaded onto the .machine
> keyring be considered a regression?
Currently certificates built into the kernel do not have a CA restriction on them.
IMA will trust anything in this keyring even if the CA bit is not set. While it would
be advisable for a kernel to be built with a CA, nothing currently enforces it.
My thinking for the dropped CA restriction patches was to introduce a new Kconfig.
This Kconfig would do the CA enforcement on the machine keyring. However if the
Kconfig option was not set for enforcement, it would work as it does in this series,
plus it would allow IMA to work with non-CA keys. This would be done by removing
the restriction placed in this patch. Let me know your thoughts on whether this would
be an appropriate solution. I believe this would get around what you are identifying as
a possible regression.