diff mbox series

[v3,2/6] integrity: ignore keys failing CA restrictions on non-UEFI platform

Message ID 20230813021531.1382815-3-nayna@linux.ibm.com (mailing list archive)
State Handled Elsewhere
Headers show
Series Enable loading local and third party keys on PowerVM guest | expand

Commit Message

Nayna Jain Aug. 13, 2023, 2:15 a.m. UTC
On non-UEFI platforms, handle restrict_link_by_ca failures differently.

Certificates which do not satisfy CA restrictions on non-UEFI platforms
are ignored.

Signed-off-by: Nayna Jain <nayna@linux.ibm.com>
Reviewed-and-tested-by: Mimi Zohar <zohar@linux.ibm.com>
---
 security/integrity/platform_certs/machine_keyring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jarkko Sakkinen Aug. 14, 2023, 5:38 p.m. UTC | #1
On Sun Aug 13, 2023 at 5:15 AM EEST, Nayna Jain wrote:
> On non-UEFI platforms, handle restrict_link_by_ca failures differently.
>
> Certificates which do not satisfy CA restrictions on non-UEFI platforms
> are ignored.
>
> Signed-off-by: Nayna Jain <nayna@linux.ibm.com>
> Reviewed-and-tested-by: Mimi Zohar <zohar@linux.ibm.com>
> ---
>  security/integrity/platform_certs/machine_keyring.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/security/integrity/platform_certs/machine_keyring.c b/security/integrity/platform_certs/machine_keyring.c
> index 7aaed7950b6e..389a6e7c9245 100644
> --- a/security/integrity/platform_certs/machine_keyring.c
> +++ b/security/integrity/platform_certs/machine_keyring.c
> @@ -36,7 +36,7 @@ void __init add_to_machine_keyring(const char *source, const void *data, size_t
>  	 * If the restriction check does not pass and the platform keyring
>  	 * is configured, try to add it into that keyring instead.
>  	 */
> -	if (rc && IS_ENABLED(CONFIG_INTEGRITY_PLATFORM_KEYRING))
> +	if (rc && efi_enabled(EFI_BOOT) && IS_ENABLED(CONFIG_INTEGRITY_PLATFORM_KEYRING))
>  		rc = integrity_load_cert(INTEGRITY_KEYRING_PLATFORM, source,
>  					 data, len, perm);
>  
> -- 
> 2.31.1

Acked-by: Jarkko Sakkinen <jarkko@kernel.org>

BR, Jarkko
Mimi Zohar Aug. 16, 2023, 12:58 p.m. UTC | #2
On Mon, 2023-08-14 at 20:38 +0300, Jarkko Sakkinen wrote:
> On Sun Aug 13, 2023 at 5:15 AM EEST, Nayna Jain wrote:
> > On non-UEFI platforms, handle restrict_link_by_ca failures differently.
> >
> > Certificates which do not satisfy CA restrictions on non-UEFI platforms
> > are ignored.
> >
> > Signed-off-by: Nayna Jain <nayna@linux.ibm.com>
> > Reviewed-and-tested-by: Mimi Zohar <zohar@linux.ibm.com>
> > ---
> >  security/integrity/platform_certs/machine_keyring.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/security/integrity/platform_certs/machine_keyring.c b/security/integrity/platform_certs/machine_keyring.c
> > index 7aaed7950b6e..389a6e7c9245 100644
> > --- a/security/integrity/platform_certs/machine_keyring.c
> > +++ b/security/integrity/platform_certs/machine_keyring.c
> > @@ -36,7 +36,7 @@ void __init add_to_machine_keyring(const char *source, const void *data, size_t
> >  	 * If the restriction check does not pass and the platform keyring
> >  	 * is configured, try to add it into that keyring instead.
> >  	 */
> > -	if (rc && IS_ENABLED(CONFIG_INTEGRITY_PLATFORM_KEYRING))
> > +	if (rc && efi_enabled(EFI_BOOT) && IS_ENABLED(CONFIG_INTEGRITY_PLATFORM_KEYRING))
> >  		rc = integrity_load_cert(INTEGRITY_KEYRING_PLATFORM, source,
> >  					 data, len, perm);
> >  
> > -- 
> > 2.31.1
> 
> Acked-by: Jarkko Sakkinen <jarkko@kernel.org>

Hi Jarkko,

Without the following two commits in your master branch, the last patch
in this series "[PATCH v4 6/6] integrity: PowerVM support for loading
third party code signing keys"   doesn't apply cleanly.

- commit 409b465f8a83 ("integrity: Enforce digitalSignature usage in
the ima and evm keyrings")
- commit e34a6c7dd192 ("KEYS: DigitalSignature link restriction")

If you're not planning on upstreaming this patch set, I'd appreciate
your creating a topic branch with these two commits.
Jarkko Sakkinen Aug. 16, 2023, 9:04 p.m. UTC | #3
On Wed Aug 16, 2023 at 3:58 PM EEST, Mimi Zohar wrote:
> On Mon, 2023-08-14 at 20:38 +0300, Jarkko Sakkinen wrote:
> > On Sun Aug 13, 2023 at 5:15 AM EEST, Nayna Jain wrote:
> > > On non-UEFI platforms, handle restrict_link_by_ca failures differently.
> > >
> > > Certificates which do not satisfy CA restrictions on non-UEFI platforms
> > > are ignored.
> > >
> > > Signed-off-by: Nayna Jain <nayna@linux.ibm.com>
> > > Reviewed-and-tested-by: Mimi Zohar <zohar@linux.ibm.com>
> > > ---
> > >  security/integrity/platform_certs/machine_keyring.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/security/integrity/platform_certs/machine_keyring.c b/security/integrity/platform_certs/machine_keyring.c
> > > index 7aaed7950b6e..389a6e7c9245 100644
> > > --- a/security/integrity/platform_certs/machine_keyring.c
> > > +++ b/security/integrity/platform_certs/machine_keyring.c
> > > @@ -36,7 +36,7 @@ void __init add_to_machine_keyring(const char *source, const void *data, size_t
> > >  	 * If the restriction check does not pass and the platform keyring
> > >  	 * is configured, try to add it into that keyring instead.
> > >  	 */
> > > -	if (rc && IS_ENABLED(CONFIG_INTEGRITY_PLATFORM_KEYRING))
> > > +	if (rc && efi_enabled(EFI_BOOT) && IS_ENABLED(CONFIG_INTEGRITY_PLATFORM_KEYRING))
> > >  		rc = integrity_load_cert(INTEGRITY_KEYRING_PLATFORM, source,
> > >  					 data, len, perm);
> > >  
> > > -- 
> > > 2.31.1
> > 
> > Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
>
> Hi Jarkko,
>
> Without the following two commits in your master branch, the last patch
> in this series "[PATCH v4 6/6] integrity: PowerVM support for loading
> third party code signing keys"   doesn't apply cleanly.
>
> - commit 409b465f8a83 ("integrity: Enforce digitalSignature usage in
> the ima and evm keyrings")
> - commit e34a6c7dd192 ("KEYS: DigitalSignature link restriction")
>
> If you're not planning on upstreaming this patch set, I'd appreciate
> your creating a topic branch with these two commits.

They reside now in my -next. I'll send PR for the next release Fri.

> -- 
> thanks,
>
> Mimi

BR, Jarkko
diff mbox series

Patch

diff --git a/security/integrity/platform_certs/machine_keyring.c b/security/integrity/platform_certs/machine_keyring.c
index 7aaed7950b6e..389a6e7c9245 100644
--- a/security/integrity/platform_certs/machine_keyring.c
+++ b/security/integrity/platform_certs/machine_keyring.c
@@ -36,7 +36,7 @@  void __init add_to_machine_keyring(const char *source, const void *data, size_t
 	 * If the restriction check does not pass and the platform keyring
 	 * is configured, try to add it into that keyring instead.
 	 */
-	if (rc && IS_ENABLED(CONFIG_INTEGRITY_PLATFORM_KEYRING))
+	if (rc && efi_enabled(EFI_BOOT) && IS_ENABLED(CONFIG_INTEGRITY_PLATFORM_KEYRING))
 		rc = integrity_load_cert(INTEGRITY_KEYRING_PLATFORM, source,
 					 data, len, perm);