All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] certs: Reference revocation list for all keyrings
@ 2023-01-17 17:15 Eric Snowberg
  2023-01-21  3:20 ` Jarkko Sakkinen
  2023-07-14 22:11 ` Mimi Zohar
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Snowberg @ 2023-01-17 17:15 UTC (permalink / raw)
  To: dhowells, jarkko, dwmw2
  Cc: keyrings, linux-kernel, eric.snowberg, kanth.ghatraju, konrad.wilk

Systems booted with shim have a Forbidden Signature Database called mokx.
During boot, hashes and certs contained within the mokx are loaded into the
blacklist keyring.  When calling verify_pkcs7_message_sig the contents of
the blacklist keyring (or revocation list) are referenced when validating
keys on the platform keyring. Currently, when validating against the
secondary or builtin keyrings, the revocation list is not referenced.  Move
up the check to allow the revocation list to be used with all keyrings,
including the secondary and builtin, allowing the system owner to take
corrective action should a vulnerability be found within keys contained
within either keyring.

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
---
 certs/system_keyring.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/certs/system_keyring.c b/certs/system_keyring.c
index 5042cc54fa5e..865a0510fdeb 100644
--- a/certs/system_keyring.c
+++ b/certs/system_keyring.c
@@ -243,6 +243,12 @@ int verify_pkcs7_message_sig(const void *data, size_t len,
 	if (ret < 0)
 		goto error;
 
+	ret = is_key_on_revocation_list(pkcs7);
+	if (ret != -ENOKEY) {
+		pr_devel("PKCS#7 key is on revocation list\n");
+		goto error;
+	}
+
 	if (!trusted_keys) {
 		trusted_keys = builtin_trusted_keys;
 	} else if (trusted_keys == VERIFY_USE_SECONDARY_KEYRING) {
@@ -262,12 +268,6 @@ int verify_pkcs7_message_sig(const void *data, size_t len,
 			pr_devel("PKCS#7 platform keyring is not available\n");
 			goto error;
 		}
-
-		ret = is_key_on_revocation_list(pkcs7);
-		if (ret != -ENOKEY) {
-			pr_devel("PKCS#7 platform key is on revocation list\n");
-			goto error;
-		}
 	}
 	ret = pkcs7_validate_trust(pkcs7, trusted_keys);
 	if (ret < 0) {
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] certs: Reference revocation list for all keyrings
  2023-01-17 17:15 [PATCH] certs: Reference revocation list for all keyrings Eric Snowberg
@ 2023-01-21  3:20 ` Jarkko Sakkinen
  2023-01-21  3:21   ` Jarkko Sakkinen
  2023-07-14 22:11 ` Mimi Zohar
  1 sibling, 1 reply; 4+ messages in thread
From: Jarkko Sakkinen @ 2023-01-21  3:20 UTC (permalink / raw)
  To: Eric Snowberg
  Cc: dhowells, dwmw2, keyrings, linux-kernel, kanth.ghatraju, konrad.wilk

On Tue, Jan 17, 2023 at 12:15:06PM -0500, Eric Snowberg wrote:
> Systems booted with shim have a Forbidden Signature Database called mokx.
> During boot, hashes and certs contained within the mokx are loaded into the
> blacklist keyring.  When calling verify_pkcs7_message_sig the contents of
> the blacklist keyring (or revocation list) are referenced when validating
> keys on the platform keyring. Currently, when validating against the
> secondary or builtin keyrings, the revocation list is not referenced.  Move
> up the check to allow the revocation list to be used with all keyrings,
> including the secondary and builtin, allowing the system owner to take
> corrective action should a vulnerability be found within keys contained
> within either keyring.
> 
> Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
> ---
>  certs/system_keyring.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/certs/system_keyring.c b/certs/system_keyring.c
> index 5042cc54fa5e..865a0510fdeb 100644
> --- a/certs/system_keyring.c
> +++ b/certs/system_keyring.c
> @@ -243,6 +243,12 @@ int verify_pkcs7_message_sig(const void *data, size_t len,
>  	if (ret < 0)
>  		goto error;
>  
> +	ret = is_key_on_revocation_list(pkcs7);
> +	if (ret != -ENOKEY) {
> +		pr_devel("PKCS#7 key is on revocation list\n");
> +		goto error;
> +	}
> +
>  	if (!trusted_keys) {
>  		trusted_keys = builtin_trusted_keys;
>  	} else if (trusted_keys == VERIFY_USE_SECONDARY_KEYRING) {
> @@ -262,12 +268,6 @@ int verify_pkcs7_message_sig(const void *data, size_t len,
>  			pr_devel("PKCS#7 platform keyring is not available\n");
>  			goto error;
>  		}
> -
> -		ret = is_key_on_revocation_list(pkcs7);
> -		if (ret != -ENOKEY) {
> -			pr_devel("PKCS#7 platform key is on revocation list\n");
> -			goto error;
> -		}
>  	}
>  	ret = pkcs7_validate_trust(pkcs7, trusted_keys);
>  	if (ret < 0) {
> -- 
> 2.27.0
> 

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

BR, Jarkko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] certs: Reference revocation list for all keyrings
  2023-01-21  3:20 ` Jarkko Sakkinen
@ 2023-01-21  3:21   ` Jarkko Sakkinen
  0 siblings, 0 replies; 4+ messages in thread
From: Jarkko Sakkinen @ 2023-01-21  3:21 UTC (permalink / raw)
  To: Eric Snowberg
  Cc: dhowells, dwmw2, keyrings, linux-kernel, kanth.ghatraju, konrad.wilk

On Sat, Jan 21, 2023 at 03:20:46AM +0000, Jarkko Sakkinen wrote:
> On Tue, Jan 17, 2023 at 12:15:06PM -0500, Eric Snowberg wrote:
> > Systems booted with shim have a Forbidden Signature Database called mokx.
> > During boot, hashes and certs contained within the mokx are loaded into the
> > blacklist keyring.  When calling verify_pkcs7_message_sig the contents of
> > the blacklist keyring (or revocation list) are referenced when validating
> > keys on the platform keyring. Currently, when validating against the
> > secondary or builtin keyrings, the revocation list is not referenced.  Move
> > up the check to allow the revocation list to be used with all keyrings,
> > including the secondary and builtin, allowing the system owner to take
> > corrective action should a vulnerability be found within keys contained
> > within either keyring.
> > 
> > Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
> > ---
> >  certs/system_keyring.c | 12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/certs/system_keyring.c b/certs/system_keyring.c
> > index 5042cc54fa5e..865a0510fdeb 100644
> > --- a/certs/system_keyring.c
> > +++ b/certs/system_keyring.c
> > @@ -243,6 +243,12 @@ int verify_pkcs7_message_sig(const void *data, size_t len,
> >  	if (ret < 0)
> >  		goto error;
> >  
> > +	ret = is_key_on_revocation_list(pkcs7);
> > +	if (ret != -ENOKEY) {
> > +		pr_devel("PKCS#7 key is on revocation list\n");
> > +		goto error;
> > +	}
> > +
> >  	if (!trusted_keys) {
> >  		trusted_keys = builtin_trusted_keys;
> >  	} else if (trusted_keys == VERIFY_USE_SECONDARY_KEYRING) {
> > @@ -262,12 +268,6 @@ int verify_pkcs7_message_sig(const void *data, size_t len,
> >  			pr_devel("PKCS#7 platform keyring is not available\n");
> >  			goto error;
> >  		}
> > -
> > -		ret = is_key_on_revocation_list(pkcs7);
> > -		if (ret != -ENOKEY) {
> > -			pr_devel("PKCS#7 platform key is on revocation list\n");
> > -			goto error;
> > -		}
> >  	}
> >  	ret = pkcs7_validate_trust(pkcs7, trusted_keys);
> >  	if (ret < 0) {
> > -- 
> > 2.27.0
> > 
> 
> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

Should I pick this?

BR, Jarkko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] certs: Reference revocation list for all keyrings
  2023-01-17 17:15 [PATCH] certs: Reference revocation list for all keyrings Eric Snowberg
  2023-01-21  3:20 ` Jarkko Sakkinen
@ 2023-07-14 22:11 ` Mimi Zohar
  1 sibling, 0 replies; 4+ messages in thread
From: Mimi Zohar @ 2023-07-14 22:11 UTC (permalink / raw)
  To: Eric Snowberg, dhowells, jarkko, dwmw2
  Cc: keyrings, linux-kernel, kanth.ghatraju, konrad.wilk

On Tue, 2023-01-17 at 12:15 -0500, Eric Snowberg wrote:
> Systems booted with shim have a Forbidden Signature Database called mokx.
> During boot, hashes and certs contained within the mokx are loaded into the
> blacklist keyring.  When calling verify_pkcs7_message_sig the contents of
> the blacklist keyring (or revocation list) are referenced when validating
> keys on the platform keyring. Currently, when validating against the
> secondary or builtin keyrings, the revocation list is not referenced.  Move
> up the check to allow the revocation list to be used with all keyrings,
> including the secondary and builtin, allowing the system owner to take
> corrective action should a vulnerability be found within keys contained
> within either keyring.
> 
> Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>

Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-14 22:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-17 17:15 [PATCH] certs: Reference revocation list for all keyrings Eric Snowberg
2023-01-21  3:20 ` Jarkko Sakkinen
2023-01-21  3:21   ` Jarkko Sakkinen
2023-07-14 22:11 ` Mimi Zohar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.