Skip to contentSkip to conversation

certs: Add EFI_CERT_X509_GUID support for dbx entries

PATCH Superseded Eric Snowberg 7 participants 22 messages Sep 16, 2020 – Jan 30, 2021

Subsystems (8)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Eric Snowberg

author reviewer
#0 lore raw

PATCH v4 1/1 certs: Add EFI_CERT_X509_GUID support for dbx entries

The Secure Boot Forbidden Signature Database, dbx, contains a list of now revoked signatures and keys previously approved to boot with UEFI Secure Boot enabled. The dbx is capable of containing any number of EFI_CERT_X509_SHA256_GUID, EFI_CERT_SHA256_GUID, and EFI_CERT_X509_GUID entries.

Currently when EFI_CERT_X509_GUID are contained in the dbx, the entries are skipped.

Add support for EFI_CERT_X509_GUID dbx entries. When a EFI_CERT_X509_GUID is found, it is added as an asymmetrical key to the .blacklist keyring. Anytime the .platform keyring is used, the keys in the .blacklist keyring are referenced, if a matching key is found, the key will be rejected.

---
v4:
Remove unneeded symbol export found by Jarkko Sakkinen

v3:
Fixed an issue when CONFIG_PKCS7_MESSAGE_PARSER is not builtin and defined as a module instead, pointed out by Randy Dunlap

v2:
Fixed build issue reported by kernel test robot <[email protected]> Commit message update (suggested by Jarkko Sakkinen)

---
 certs/blacklist.c                             | 32 +++++++++++++++++++
 certs/blacklist.h                             | 12 +++++++
 certs/system_keyring.c                        |  6 ++++
 include/keys/system_keyring.h                 | 11 +++++++
 .../platform_certs/keyring_handler.c          | 11 +++++++
 5 files changed, 72 insertions(+)
certs/blacklist.c +32 -0
index 6514f9ebc943..4adac7f8fd94 100644
@@ -100,6 +100,38 @@ int mark_hash_blacklisted(const char *hash)
 	return 0;
 }
 
+int mark_key_revocationlisted(const char *data, size_t size)
+{
+	key_ref_t key;
+
+	key = key_create_or_update(make_key_ref(blacklist_keyring, true),
+				   "asymmetric",
+				   NULL,
+				   data,
+				   size,
+				   ((KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_VIEW),
+				   KEY_ALLOC_NOT_IN_QUOTA | KEY_ALLOC_BUILT_IN);
+
+	if (IS_ERR(key)) {
+		pr_err("Problem with revocation key (%ld)\n", PTR_ERR(key));
+		return PTR_ERR(key);
+	}
+
+	return 0;
+}
+
+int is_key_revocationlisted(struct pkcs7_message *pkcs7)
+{
+	int ret;
+
+	ret = validate_trust(pkcs7, blacklist_keyring);
+
+	if (ret = 0)
+		return -EKEYREJECTED;
+
+	return -ENOKEY;
+}
+
 /**
  * is_hash_blacklisted - Determine if a hash is blacklisted
  * @hash: The hash to be checked as a binary blob
certs/blacklist.h +12 -0
index 1efd6fa0dc60..420bb7c86e07 100644
@@ -1,3 +1,15 @@
 #include <linux/kernel.h>
+#include <linux/errno.h>
+#include <crypto/pkcs7.h>
 
 extern const char __initconst *const blacklist_hashes[];
+
+#ifdef CONFIG_INTEGRITY_PLATFORM_KEYRING
+#define validate_trust pkcs7_validate_trust
+#else
+static inline int validate_trust(struct pkcs7_message *pkcs7,
+				 struct key *trust_keyring)
+{
+	return -ENOKEY;
+}
+#endif
certs/system_keyring.c +6 -0
index 798291177186..f8ea96219155 100644
@@ -241,6 +241,12 @@ 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_revocationlisted(pkcs7);
+		if (ret != -ENOKEY) {
+			pr_devel("PKCS#7 platform key revocationlisted\n");
+			goto error;
+		}
 	}
 	ret = pkcs7_validate_trust(pkcs7, trusted_keys);
 	if (ret < 0) {
include/keys/system_keyring.h +11 -0
index fb8b07daa9d1..b6991cfe1b6d 100644
@@ -31,11 +31,14 @@ extern int restrict_link_by_builtin_and_secondary_trusted(
 #define restrict_link_by_builtin_and_secondary_trusted restrict_link_by_builtin_trusted
 #endif
 
+extern struct pkcs7_message *pkcs7;
 #ifdef CONFIG_SYSTEM_BLACKLIST_KEYRING
 extern int mark_hash_blacklisted(const char *hash);
+extern int mark_key_revocationlisted(const char *data, size_t size);
 extern int is_hash_blacklisted(const u8 *hash, size_t hash_len,
 			       const char *type);
 extern int is_binary_blacklisted(const u8 *hash, size_t hash_len);
+extern int is_key_revocationlisted(struct pkcs7_message *pkcs7);
 #else
 static inline int is_hash_blacklisted(const u8 *hash, size_t hash_len,
 				      const char *type)
@@ -47,6 +50,14 @@ static inline int is_binary_blacklisted(const u8 *hash, size_t hash_len)
 {
 	return 0;
 }
+static inline int mark_key_revocationlisted(const char *data, size_t size)
+{
+	return 0;
+}
+static inline int is_key_revocationlisted(struct pkcs7_message *pkcs7)
+{
+	return -ENOKEY;
+}
 #endif
 
 #ifdef CONFIG_IMA_BLACKLIST_KEYRING
security/integrity/platform_certs/keyring_handler.c +11 -0
index c5ba695c10e3..cc5a43804bc4 100644
@@ -55,6 +55,15 @@ static __init void uefi_blacklist_binary(const char *source,
 	uefi_blacklist_hash(source, data, len, "bin:", 4);
 }
 
+/*
+ * Revocationlist the X509 cert
+ */
+static __init void uefi_revocationlist_x509(const char *source,
+					    const void *data, size_t len)
+{
+	mark_key_revocationlisted(data, len);
+}
+
 /*
  * Return the appropriate handler for particular signature list types found in
  * the UEFI db and MokListRT tables.
@@ -76,5 +85,7 @@ __init efi_element_handler_t get_handler_for_dbx(const efi_guid_t *sig_type)
 		return uefi_blacklist_x509_tbs;
 	if (efi_guidcmp(*sig_type, efi_cert_sha256_guid) = 0)
 		return uefi_blacklist_binary;
+	if (efi_guidcmp(*sig_type, efi_cert_x509_guid) = 0)
+		return uefi_revocationlist_x509;
 	return 0;
 }
Signature · 1 line
2.18.1
Reviewed-by on v4 1/1
#1 lore raw
Quoted 9 lines · Eric Snowberg

The Secure Boot Forbidden Signature Database, dbx, contains a list of now revoked signatures and keys previously approved to boot with UEFI Secure Boot enabled. The dbx is capable of containing any number of EFI_CERT_X509_SHA256_GUID, EFI_CERT_SHA256_GUID, and EFI_CERT_X509_GUID entries.

Currently when EFI_CERT_X509_GUID are contained in the dbx, the entries are skipped.

Quoted 6 lines

Add support for EFI_CERT_X509_GUID dbx entries. When a EFI_CERT_X509_GUID is found, it is added as an asymmetrical key to the .blacklist keyring. Anytime the .platform keyring is used, the keys in the .blacklist keyring are referenced, if a matching key is found, the key will be rejected.

Looks good to me.

/Jarkko

maintainer
#2 lore raw
In reply to Eric Snowberg
Quoted 4 lines · Eric Snowberg

Add support for EFI_CERT_X509_GUID dbx entries. When a EFI_CERT_X509_GUID is found, it is added as an asymmetrical key to the .blacklist keyring. Anytime the .platform keyring is used, the keys in the .blacklist keyring are referenced, if a matching key is found, the key will be rejected.

Ummm... Why this way and not as a blacklist key which takes up less space? I'm guessing that you're using the key chain matching logic. We really only need to blacklist the key IDs.

Also, what should happen if a revocation cert rejected by the blacklist?

Quoted 1 line

+int mark_key_revocationlisted(const char *data, size_t size)

Hmmm... The name looks wrong, but I can see the potential issue that kernel keys can actually be marked revoked as a separate concept. How about add_key_to_revocation_list() and is_key_on_revocation_list().

David

author reviewer
#3 lore raw
Quoted 13 lines · David Howells
Quoted 4 lines · Eric Snowberg

Add support for EFI_CERT_X509_GUID dbx entries. When a EFI_CERT_X509_GUID is found, it is added as an asymmetrical key to the .blacklist keyring. Anytime the .platform keyring is used, the keys in the .blacklist keyring are referenced, if a matching key is found, the key will be rejected.

Ummm... Why this way and not as a blacklist key which takes up less space? I'm guessing that you're using the key chain matching logic. We really only need to blacklist the key IDs.

I implemented it this way so that certs in the dbx would only impact the .platform keyring. I was under the impression we didn’t want to have Secure Boot UEFI db/dbx certs dictate keyring functionality within the kernel itself. Meaning if we have a matching dbx cert in any other keyring (builtin, secondary, ima, etc.), it would be allowed. If that is not how you’d like to see it done, let me know and I’ll make the change.

Quoted 1 line

Also, what should happen if a revocation cert rejected by the blacklist?

I’m not sure I understand the question. How would it be rejected?

Quoted 5 lines
Quoted 1 line

+int mark_key_revocationlisted(const char *data, size_t size)

Hmmm... The name looks wrong, but I can see the potential issue that kernel keys can actually be marked revoked as a separate concept. How about add_key_to_revocation_list() and is_key_on_revocation_list().

I'll update the names in the next version.

Thanks.

maintainer
#4 lore raw
Quoted 13 lines · Eric Snowberg
Quoted 12 lines · David Howells
Quoted 4 lines · Eric Snowberg

Add support for EFI_CERT_X509_GUID dbx entries. When a EFI_CERT_X509_GUID is found, it is added as an asymmetrical key to the .blacklist keyring. Anytime the .platform keyring is used, the keys in the .blacklist keyring are referenced, if a matching key is found, the key will be rejected.

Ummm... Why this way and not as a blacklist key which takes up less space? I'm guessing that you're using the key chain matching logic. We really only need to blacklist the key IDs.

Quoted 6 lines

I implemented it this way so that certs in the dbx would only impact the .platform keyring. I was under the impression we didn’t want to have Secure Boot UEFI db/dbx certs dictate keyring functionality within the kernel itself. Meaning if we have a matching dbx cert in any other keyring (builtin, secondary, ima, etc.), it would be allowed. If that is not how you’d like to see it done, let me know and I’ll make the change.

I wonder if that is that the right thing to do. I guess this is a policy decision and may depend on the particular user.

Quoted 3 lines
Quoted 1 line

Also, what should happen if a revocation cert rejected by the blacklist?

I’m not sure I understand the question. How would it be rejected?

The SHA256 of a revocation cert being loaded could match an already-blacklisted SHA256 sum, either compiled in or already loaded from UEFI.

David

#5 lore raw
Quoted 22 lines · David Howells
Quoted 13 lines · Eric Snowberg
Quoted 12 lines · David Howells
Quoted 4 lines · Eric Snowberg

Add support for EFI_CERT_X509_GUID dbx entries. When a EFI_CERT_X509_GUID is found, it is added as an asymmetrical key to the .blacklist keyring. Anytime the .platform keyring is used, the keys in the .blacklist keyring are referenced, if a matching key is found, the key will be rejected.

Ummm... Why this way and not as a blacklist key which takes up less space? I'm guessing that you're using the key chain matching logic. We really only need to blacklist the key IDs.

Quoted 6 lines

I implemented it this way so that certs in the dbx would only impact the .platform keyring. I was under the impression we didn’t want to have Secure Boot UEFI db/dbx certs dictate keyring functionality within the kernel itself. Meaning if we have a matching dbx cert in any other keyring (builtin, secondary, ima, etc.), it would be allowed. If that is not how you’d like to see it done, let me know and I’ll make the change.

Quoted 2 lines

I wonder if that is that the right thing to do. I guess this is a policy decision and may depend on the particular user.

Why would you want to allow dbx entry in any keyring?

/Jarkko

author reviewer
#6 lore raw
Quoted 26 lines · Jarkko Sakkinen
Quoted 22 lines · David Howells
Quoted 19 lines · Eric Snowberg
Quoted 12 lines · David Howells
Quoted 4 lines · Eric Snowberg

Add support for EFI_CERT_X509_GUID dbx entries. When a EFI_CERT_X509_GUID is found, it is added as an asymmetrical key to the .blacklist keyring. Anytime the .platform keyring is used, the keys in the .blacklist keyring are referenced, if a matching key is found, the key will be rejected.

Ummm... Why this way and not as a blacklist key which takes up less space? I'm guessing that you're using the key chain matching logic. We really only need to blacklist the key IDs.

I implemented it this way so that certs in the dbx would only impact the .platform keyring. I was under the impression we didn’t want to have Secure Boot UEFI db/dbx certs dictate keyring functionality within the kernel itself. Meaning if we have a matching dbx cert in any other keyring (builtin, secondary, ima, etc.), it would be allowed. If that is not how you’d like to see it done, let me know and I’ll make the change.

Quoted 4 lines
Quoted 2 lines

I wonder if that is that the right thing to do. I guess this is a policy decision and may depend on the particular user.

Why would you want to allow dbx entry in any keyring?

Today, DB and MOK certs go into the platform keyring. These certs are only referenced during kexec. They can’t be used for other things like validating kernel module signatures. If we follow the same pattern, the DBX and MOKX entries in the blacklist keyring should only impact kexec.

Currently, Mickaël Salaün has another outstanding series to allow root to update the blacklist keyring. I assume the use case for this is around certificates used within the kernel, for example revoking kernel module signatures. The question I have is, should another keyring be introduced? One that carries DBX and MOKX, which just correspond to certs/hashes in the platform keyring; this keyring would only be referenced for kexec, just like the platform keyring is today. Then, the current blacklist keyring would be used for everything internal to the kernel.

maintainer
#7 lore raw
Quoted 36 lines · Eric Snowberg
Quoted 26 lines · Jarkko Sakkinen
Quoted 22 lines · David Howells
Quoted 19 lines · Eric Snowberg
Quoted 12 lines · David Howells
Quoted 4 lines · Eric Snowberg

Add support for EFI_CERT_X509_GUID dbx entries. When a EFI_CERT_X509_GUID is found, it is added as an asymmetrical key to the .blacklist keyring. Anytime the .platform keyring is used, the keys in the .blacklist keyring are referenced, if a matching key is found, the key will be rejected.

Ummm... Why this way and not as a blacklist key which takes up less space? I'm guessing that you're using the key chain matching logic. We really only need to blacklist the key IDs.

I implemented it this way so that certs in the dbx would only impact the .platform keyring. I was under the impression we didn’t want to have Secure Boot UEFI db/dbx certs dictate keyring functionality within the kernel itself. Meaning if we have a matching dbx cert in any other keyring (builtin, secondary, ima, etc.), it would be allowed. If that is not how you’d like to see it done, let me know and I’ll make the change.

Quoted 4 lines
Quoted 2 lines

I wonder if that is that the right thing to do. I guess this is a policy decision and may depend on the particular user.

Why would you want to allow dbx entry in any keyring?

Today, DB and MOK certs go into the platform keyring. These certs are only referenced during kexec. They can’t be used for other things like validating kernel module signatures. If we follow the same pattern, the DBX and MOKX entries in the blacklist keyring should only impact kexec.

Quoted 7 lines

Currently, Mickaël Salaün has another outstanding series to allow root to update the blacklist keyring. I assume the use case for this is around certificates used within the kernel, for example revoking kernel module signatures. The question I have is, should another keyring be introduced? One that carries DBX and MOKX, which just correspond to certs/hashes in the platform keyring; this keyring would only be referenced for kexec, just like the platform keyring is today. Then, the current blacklist keyring would be used for everything internal to the kernel.

Right, I'm following actively that series.

Why couldn't user space drive this process and use that feature to do it?

/Jarkko

author reviewer
#8 lore raw
Quoted 48 lines · Jarkko Sakkinen
Quoted 36 lines · Eric Snowberg
Quoted 26 lines · Jarkko Sakkinen
Quoted 22 lines · David Howells
Quoted 19 lines · Eric Snowberg
Quoted 12 lines · David Howells
Quoted 4 lines · Eric Snowberg

Add support for EFI_CERT_X509_GUID dbx entries. When a EFI_CERT_X509_GUID is found, it is added as an asymmetrical key to the .blacklist keyring. Anytime the .platform keyring is used, the keys in the .blacklist keyring are referenced, if a matching key is found, the key will be rejected.

Ummm... Why this way and not as a blacklist key which takes up less space? I'm guessing that you're using the key chain matching logic. We really only need to blacklist the key IDs.

I implemented it this way so that certs in the dbx would only impact the .platform keyring. I was under the impression we didn’t want to have Secure Boot UEFI db/dbx certs dictate keyring functionality within the kernel itself. Meaning if we have a matching dbx cert in any other keyring (builtin, secondary, ima, etc.), it would be allowed. If that is not how you’d like to see it done, let me know and I’ll make the change.

Quoted 4 lines
Quoted 2 lines

I wonder if that is that the right thing to do. I guess this is a policy decision and may depend on the particular user.

Why would you want to allow dbx entry in any keyring?

Today, DB and MOK certs go into the platform keyring. These certs are only referenced during kexec. They can’t be used for other things like validating kernel module signatures. If we follow the same pattern, the DBX and MOKX entries in the blacklist keyring should only impact kexec.

Quoted 7 lines

Currently, Mickaël Salaün has another outstanding series to allow root to update the blacklist keyring. I assume the use case for this is around certificates used within the kernel, for example revoking kernel module signatures. The question I have is, should another keyring be introduced? One that carries DBX and MOKX, which just correspond to certs/hashes in the platform keyring; this keyring would only be referenced for kexec, just like the platform keyring is today. Then, the current blacklist keyring would be used for everything internal to the kernel.

Quoted 3 lines

Right, I'm following actively that series.

Why couldn't user space drive this process and use that feature to do it?

I could see where the user would want to use both. With Mickaël Salaün’s series, the blacklist keyring is updated immediately. However it does not survive a reboot. With my patch, the blacklist keyring is updated during boot, based on what is in the dbx. Neither approach needs a new kernel build.

maintainer
#9 lore raw
Quoted 50 lines · Eric Snowberg
Quoted 50 lines · Jarkko Sakkinen
Quoted 36 lines · Eric Snowberg
Quoted 26 lines · Jarkko Sakkinen
Quoted 22 lines · David Howells
Quoted 19 lines · Eric Snowberg
Quoted 12 lines · David Howells
Quoted 4 lines · Eric Snowberg

Add support for EFI_CERT_X509_GUID dbx entries. When a EFI_CERT_X509_GUID is found, it is added as an asymmetrical key to the .blacklist keyring. Anytime the .platform keyring is used, the keys in the .blacklist keyring are referenced, if a matching key is found, the key will be rejected.

Ummm... Why this way and not as a blacklist key which takes up less space? I'm guessing that you're using the key chain matching logic. We really only need to blacklist the key IDs.

I implemented it this way so that certs in the dbx would only impact the .platform keyring. I was under the impression we didn’t want to have Secure Boot UEFI db/dbx certs dictate keyring functionality within the kernel itself. Meaning if we have a matching dbx cert in any other keyring (builtin, secondary, ima, etc.), it would be allowed. If that is not how you’d like to see it done, let me know and I’ll make the change.

Quoted 4 lines
Quoted 2 lines

I wonder if that is that the right thing to do. I guess this is a policy decision and may depend on the particular user.

Why would you want to allow dbx entry in any keyring?

Today, DB and MOK certs go into the platform keyring. These certs are only referenced during kexec. They can’t be used for other things like validating kernel module signatures. If we follow the same pattern, the DBX and MOKX entries in the blacklist keyring should only impact kexec.

Quoted 7 lines

Currently, Mickaël Salaün has another outstanding series to allow root to update the blacklist keyring. I assume the use case for this is around certificates used within the kernel, for example revoking kernel module signatures. The question I have is, should another keyring be introduced? One that carries DBX and MOKX, which just correspond to certs/hashes in the platform keyring; this keyring would only be referenced for kexec, just like the platform keyring is today. Then, the current blacklist keyring would be used for everything internal to the kernel.

Right, I'm following actively that series.

Quoted 7 lines
Quoted 1 line

Why couldn't user space drive this process and use that feature to do it?

I could see where the user would want to use both. With Mickaël Salaün’s series, the blacklist keyring is updated immediately. However it does not survive a reboot. With my patch, the blacklist keyring is updated during boot, based on what is in the dbx. Neither approach needs a new kernel build.

I don't want to purposely challenge this, but why does it matter that it doesn't survive the boot? I'm referring here to the golden principle of kernel defining a mechanism, not policy. User space can do the population however it wants to for every boot.

E.g. systemd service could do this.

What am I missing here?

/Jarkko

author reviewer
#10 lore raw
Quoted 62 lines · Jarkko Sakkinen
Quoted 50 lines · Eric Snowberg
Quoted 50 lines · Jarkko Sakkinen
Quoted 36 lines · Eric Snowberg
Quoted 26 lines · Jarkko Sakkinen
Quoted 22 lines · David Howells
Quoted 19 lines · Eric Snowberg
Quoted 12 lines · David Howells
Quoted 4 lines · Eric Snowberg

Add support for EFI_CERT_X509_GUID dbx entries. When a EFI_CERT_X509_GUID is found, it is added as an asymmetrical key to the .blacklist keyring. Anytime the .platform keyring is used, the keys in the .blacklist keyring are referenced, if a matching key is found, the key will be rejected.

Ummm... Why this way and not as a blacklist key which takes up less space? I'm guessing that you're using the key chain matching logic. We really only need to blacklist the key IDs.

I implemented it this way so that certs in the dbx would only impact the .platform keyring. I was under the impression we didn’t want to have Secure Boot UEFI db/dbx certs dictate keyring functionality within the kernel itself. Meaning if we have a matching dbx cert in any other keyring (builtin, secondary, ima, etc.), it would be allowed. If that is not how you’d like to see it done, let me know and I’ll make the change.

Quoted 4 lines
Quoted 2 lines

I wonder if that is that the right thing to do. I guess this is a policy decision and may depend on the particular user.

Why would you want to allow dbx entry in any keyring?

Today, DB and MOK certs go into the platform keyring. These certs are only referenced during kexec. They can’t be used for other things like validating kernel module signatures. If we follow the same pattern, the DBX and MOKX entries in the blacklist keyring should only impact kexec.

Quoted 7 lines

Currently, Mickaël Salaün has another outstanding series to allow root to update the blacklist keyring. I assume the use case for this is around certificates used within the kernel, for example revoking kernel module signatures. The question I have is, should another keyring be introduced? One that carries DBX and MOKX, which just correspond to certs/hashes in the platform keyring; this keyring would only be referenced for kexec, just like the platform keyring is today. Then, the current blacklist keyring would be used for everything internal to the kernel.

Right, I'm following actively that series.

Quoted 7 lines
Quoted 1 line

Why couldn't user space drive this process and use that feature to do it?

I could see where the user would want to use both. With Mickaël Salaün’s series, the blacklist keyring is updated immediately. However it does not survive a reboot. With my patch, the blacklist keyring is updated during boot, based on what is in the dbx. Neither approach needs a new kernel build.

Quoted 8 lines

I don't want to purposely challenge this, but why does it matter that it doesn't survive the boot? I'm referring here to the golden principle of kernel defining a mechanism, not policy. User space can do the population however it wants to for every boot.

E.g. systemd service could do this.

What am I missing here?

This change simply adds support for a missing type. The kernel already supports cert and hash entries (EFI_CERT_X509_SHA256_GUID, EFI_CERT_SHA256_GUID) that originate from the dbx and are loaded into the blacklist keyring during boot. I’m not sure why a cert defined with EFI_CERT_X509_GUID should be handled in a different manner.

I suppose a user space tool could be created. But wouldn’t what is currently done in the kernel in this area need to be removed?

maintainer
#11 lore raw
Quoted 78 lines · Eric Snowberg
Quoted 62 lines · Jarkko Sakkinen
Quoted 50 lines · Eric Snowberg
Quoted 50 lines · Jarkko Sakkinen
Quoted 36 lines · Eric Snowberg
Quoted 26 lines · Jarkko Sakkinen
Quoted 22 lines · David Howells
Quoted 19 lines · Eric Snowberg
Quoted 12 lines · David Howells
Quoted 4 lines · Eric Snowberg

Add support for EFI_CERT_X509_GUID dbx entries. When a EFI_CERT_X509_GUID is found, it is added as an asymmetrical key to the .blacklist keyring. Anytime the .platform keyring is used, the keys in the .blacklist keyring are referenced, if a matching key is found, the key will be rejected.

Ummm... Why this way and not as a blacklist key which takes up less space? I'm guessing that you're using the key chain matching logic. We really only need to blacklist the key IDs.

I implemented it this way so that certs in the dbx would only impact the .platform keyring. I was under the impression we didn’t want to have Secure Boot UEFI db/dbx certs dictate keyring functionality within the kernel itself. Meaning if we have a matching dbx cert in any other keyring (builtin, secondary, ima, etc.), it would be allowed. If that is not how you’d like to see it done, let me know and I’ll make the change.

Quoted 4 lines
Quoted 2 lines

I wonder if that is that the right thing to do. I guess this is a policy decision and may depend on the particular user.

Why would you want to allow dbx entry in any keyring?

Today, DB and MOK certs go into the platform keyring. These certs are only referenced during kexec. They can’t be used for other things like validating kernel module signatures. If we follow the same pattern, the DBX and MOKX entries in the blacklist keyring should only impact kexec.

Quoted 7 lines

Currently, Mickaël Salaün has another outstanding series to allow root to update the blacklist keyring. I assume the use case for this is around certificates used within the kernel, for example revoking kernel module signatures. The question I have is, should another keyring be introduced? One that carries DBX and MOKX, which just correspond to certs/hashes in the platform keyring; this keyring would only be referenced for kexec, just like the platform keyring is today. Then, the current blacklist keyring would be used for everything internal to the kernel.

Right, I'm following actively that series.

Quoted 7 lines
Quoted 1 line

Why couldn't user space drive this process and use that feature to do it?

I could see where the user would want to use both. With Mickaël Salaün’s series, the blacklist keyring is updated immediately. However it does not survive a reboot. With my patch, the blacklist keyring is updated during boot, based on what is in the dbx. Neither approach needs a new kernel build.

Quoted 8 lines

I don't want to purposely challenge this, but why does it matter that it doesn't survive the boot? I'm referring here to the golden principle of kernel defining a mechanism, not policy. User space can do the population however it wants to for every boot.

E.g. systemd service could do this.

What am I missing here?

This change simply adds support for a missing type. The kernel already supports cert and hash entries (EFI_CERT_X509_SHA256_GUID, EFI_CERT_SHA256_GUID) that originate from the dbx and are loaded into the blacklist keyring during boot. I’m not sure why a cert defined with EFI_CERT_X509_GUID should be handled in a different manner.

Quoted 2 lines

I suppose a user space tool could be created. But wouldn’t what is currently done in the kernel in this area need to be removed?

Right. I don't think this was a great idea in the first place to do to the kernel but since it exists, I guess the patch does make sense.

/Jarkko

maintainer
#12 lore raw
Quoted 6 lines · Jarkko Sakkinen
Quoted 2 lines

I suppose a user space tool could be created. But wouldn’t what is currently done in the kernel in this area need to be removed?

Right. I don't think this was a great idea in the first place to do to the kernel but since it exists, I guess the patch does make sense.

This information needs to be loaded from the UEFI tables before the system starts loading any kernel modules or running any programs (if we do verification of such, which I think IMA can do).

David

maintainer
#13 lore raw

[Cc'ing linux-integrity]

Quoted 5 lines · David Howells
Quoted 3 lines · Jarkko Sakkinen
Quoted 2 lines

I suppose a user space tool could be created. But wouldn’t what is currently done in the kernel in this area need to be removed?

Quoted 7 lines
Quoted 3 lines

Right. I don't think this was a great idea in the first place to do to the kernel but since it exists, I guess the patch does make sense.

This information needs to be loaded from the UEFI tables before the system starts loading any kernel modules or running any programs (if we do verification of such, which I think IMA can do).

There needs to a clear distinction between the pre-boot and post-boot keys. UEFI has its own trust model, which should be limited to UEFI. The .platform keyring was upstreamed and limited to verifying the kexec
kernel image. Any other usage of the .platform keyring keys is
abusing its intended purpose.

The cover letter says, "Anytime the .platform keyring is used, the
keys in the .blacklist keyring are referenced, if a matching key is
found, the key will be rejected." I don't have a problem with loading
the UEFI X509 dbx entries as long as its usage is limited to verifying the kexec kernel image.

Mimi

author reviewer
#14 lore raw
Quoted 25 lines · Mimi Zohar

[Cc'ing linux-integrity]

Quoted 5 lines · David Howells
Quoted 3 lines · Jarkko Sakkinen
Quoted 2 lines

I suppose a user space tool could be created. But wouldn’t what is currently done in the kernel in this area need to be removed?

Quoted 7 lines
Quoted 3 lines

Right. I don't think this was a great idea in the first place to do to the kernel but since it exists, I guess the patch does make sense.

This information needs to be loaded from the UEFI tables before the system starts loading any kernel modules or running any programs (if we do verification of such, which I think IMA can do).

There needs to a clear distinction between the pre-boot and post-boot keys. UEFI has its own trust model, which should be limited to UEFI. The .platform keyring was upstreamed and limited to verifying the kexec
kernel image. Any other usage of the .platform keyring keys is
abusing its intended purpose.

Quoted 5 lines

The cover letter says, "Anytime the .platform keyring is used, the
keys in the .blacklist keyring are referenced, if a matching key is
found, the key will be rejected." I don't have a problem with loading
the UEFI X509 dbx entries as long as its usage is limited to verifying the kexec kernel image.

Correct, with my patch, when EFI_CERT_X509_GUID entries are found in the dbx, they will only be used during kexec. I believe the latest dbx file on uefi.org contains three of these entires.

Based on my understanding of why the platform keyring was introduced, I intentionally only used these for kexec. I do question the current upstream mainline code though. Currently, when EFI_CERT_X509_SHA256_GUID or EFI_CERT_SHA256_GUID entries are found in the dbx, they are applied everywhere. It seems like there should be a dbx revocation keyring equivalent to the current platform keyring that is only used for pre-boot.

If that is a direction you would like to see this go in the future, let me know, I’d be happy to work on it.

#15 lore raw
Quoted 37 lines · Eric Snowberg
Quoted 21 lines · Mimi Zohar

[Cc'ing linux-integrity]

Quoted 10 lines · David Howells
Quoted 5 lines · Jarkko Sakkinen
Quoted 2 lines

I suppose a user space tool could be created. But wouldn’t what is currently done in the kernel in this area need to be removed?

Right. I don't think this was a great idea in the first place to do to the kernel but since it exists, I guess the patch does make sense.

This information needs to be loaded from the UEFI tables before the system starts loading any kernel modules or running any programs (if we do verification of such, which I think IMA can do).

There needs to a clear distinction between the pre-boot and post-boot keys. UEFI has its own trust model, which should be limited to UEFI. The .platform keyring was upstreamed and limited to verifying the kexec
kernel image. Any other usage of the .platform keyring keys is
abusing its intended purpose.

Quoted 5 lines

The cover letter says, "Anytime the .platform keyring is used, the
keys in the .blacklist keyring are referenced, if a matching key is
found, the key will be rejected." I don't have a problem with loading
the UEFI X509 dbx entries as long as its usage is limited to verifying the kexec kernel image.

Correct, with my patch, when EFI_CERT_X509_GUID entries are found in the dbx, they will only be used during kexec. I believe the latest dbx file on uefi.org contains three of these entires.

Based on my understanding of why the platform keyring was introduced, I intentionally only used these for kexec. I do question the current upstream mainline code though. Currently, when EFI_CERT_X509_SHA256_GUID or EFI_CERT_SHA256_GUID entries are found in the dbx, they are applied everywhere. It seems like there should be a dbx revocation keyring equivalent to the current platform keyring that is only used for pre-boot.

Quoted 3 lines

If that is a direction you would like to see this go in the future, let me know, I’d be happy to work on it.

Yes, as you said, currently blacklist entries from dbx for EFI_CERT_X509_SHA256_GUID or EFI_CERT_SHA256_GUID are applied everywhere, and does not satisfy the trust model for .platform keyring. We should fix this, but changing now might break some existing systems. Probably it should be discussed as separate thread from this patchset.

Thanks & Regards,

      - Nayna

maintainer
#16 lore raw
In reply to Eric Snowberg
Quoted 42 lines · Eric Snowberg
Quoted 25 lines · Mimi Zohar

[Cc'ing linux-integrity]

Quoted 5 lines · David Howells
Quoted 3 lines · Jarkko Sakkinen
Quoted 2 lines

I suppose a user space tool could be created. But wouldn’t what is currently done in the kernel in this area need to be removed?

Quoted 7 lines
Quoted 3 lines

Right. I don't think this was a great idea in the first place to do to the kernel but since it exists, I guess the patch does make sense.

This information needs to be loaded from the UEFI tables before the system starts loading any kernel modules or running any programs (if we do verification of such, which I think IMA can do).

There needs to a clear distinction between the pre-boot and post-boot keys. UEFI has its own trust model, which should be limited to UEFI. The .platform keyring was upstreamed and limited to verifying the kexec
kernel image. Any other usage of the .platform keyring keys is
abusing its intended purpose.

Quoted 5 lines

The cover letter says, "Anytime the .platform keyring is used, the
keys in the .blacklist keyring are referenced, if a matching key is
found, the key will be rejected." I don't have a problem with loading
the UEFI X509 dbx entries as long as its usage is limited to verifying the kexec kernel image.

Correct, with my patch, when EFI_CERT_X509_GUID entries are found in the dbx, they will only be used during kexec. I believe the latest dbx file on uefi.org contains three of these entires.

Based on my understanding of why the platform keyring was introduced, I intentionally only used these for kexec. I do question the current upstream mainline code though. Currently, when EFI_CERT_X509_SHA256_GUID or EFI_CERT_SHA256_GUID entries are found in the dbx, they are applied everywhere. It seems like there should be a dbx revocation keyring equivalent to the current platform keyring that is only used for pre-boot.

Quoted 2 lines

If that is a direction you would like to see this go in the future, let me know, I’d be happy to work on it.

I would tend to agree with this.

/Jarkko

maintainer
#17 lore raw
In reply to Mimi Zohar
Quoted 22 lines · Mimi Zohar

[Cc'ing linux-integrity]

Quoted 5 lines · David Howells
Quoted 3 lines · Jarkko Sakkinen
Quoted 2 lines

I suppose a user space tool could be created. But wouldn’t what is currently done in the kernel in this area need to be removed?

Quoted 7 lines
Quoted 3 lines

Right. I don't think this was a great idea in the first place to do to the kernel but since it exists, I guess the patch does make sense.

This information needs to be loaded from the UEFI tables before the system starts loading any kernel modules or running any programs (if we do verification of such, which I think IMA can do).

There needs to a clear distinction between the pre-boot and post-boot keys. UEFI has its own trust model, which should be limited to UEFI. The .platform keyring was upstreamed and limited to verifying the kexec
kernel image. Any other usage of the .platform keyring keys is
abusing its intended purpose.

Quoted 7 lines

The cover letter says, "Anytime the .platform keyring is used, the
keys in the .blacklist keyring are referenced, if a matching key is
found, the key will be rejected." I don't have a problem with loading
the UEFI X509 dbx entries as long as its usage is limited to verifying the kexec kernel image.

Mimi

Thanks Mimi, this is a valid argument. I agree.

/Jarkko

maintainer Reviewed-by Jarkko Sakkinen
#18 lore raw
In reply to Eric Snowberg

How about the attached? I've changed the function names to something that I think reads better, but otherwise it's the same.

David
---
commit 8913866babb96fcfe452aac6042ca8862d4c0b53

Author: Eric Snowberg <[email protected]>
Date:   Tue Sep 15 20:49:27 2020 -0400

certs: Add EFI_CERT_X509_GUID support for dbx entries

The Secure Boot Forbidden Signature Database, dbx, contains a list of now revoked signatures and keys previously approved to boot with UEFI Secure Boot enabled. The dbx is capable of containing any number of EFI_CERT_X509_SHA256_GUID, EFI_CERT_SHA256_GUID, and EFI_CERT_X509_GUID entries.

Currently when EFI_CERT_X509_GUID are contained in the dbx, the entries are skipped.

Add support for EFI_CERT_X509_GUID dbx entries. When a EFI_CERT_X509_GUID is found, it is added as an asymmetrical key to the .blacklist keyring. Anytime the .platform keyring is used, the keys in the .blacklist keyring are referenced, if a matching key is found, the key will be rejected.

certs/blacklist.c +32 -0
index 6514f9ebc943..a7f021878a4b 100644
@@ -100,6 +100,38 @@ int mark_hash_blacklisted(const char *hash)
 	return 0;
 }
 
+int add_key_to_revocation_list(const char *data, size_t size)
+{
+	key_ref_t key;
+
+	key = key_create_or_update(make_key_ref(blacklist_keyring, true),
+				   "asymmetric",
+				   NULL,
+				   data,
+				   size,
+				   ((KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_VIEW),
+				   KEY_ALLOC_NOT_IN_QUOTA | KEY_ALLOC_BUILT_IN);
+
+	if (IS_ERR(key)) {
+		pr_err("Problem with revocation key (%ld)\n", PTR_ERR(key));
+		return PTR_ERR(key);
+	}
+
+	return 0;
+}
+
+int is_key_on_revocation_list(struct pkcs7_message *pkcs7)
+{
+	int ret;
+
+	ret = validate_trust(pkcs7, blacklist_keyring);
+
+	if (ret == 0)
+		return -EKEYREJECTED;
+
+	return -ENOKEY;
+}
+
 /**
  * is_hash_blacklisted - Determine if a hash is blacklisted
  * @hash: The hash to be checked as a binary blob
certs/blacklist.h +12 -0
index 1efd6fa0dc60..420bb7c86e07 100644
@@ -1,3 +1,15 @@
 #include <linux/kernel.h>
+#include <linux/errno.h>
+#include <crypto/pkcs7.h>
 
 extern const char __initconst *const blacklist_hashes[];
+
+#ifdef CONFIG_INTEGRITY_PLATFORM_KEYRING
+#define validate_trust pkcs7_validate_trust
+#else
+static inline int validate_trust(struct pkcs7_message *pkcs7,
+				 struct key *trust_keyring)
+{
+	return -ENOKEY;
+}
+#endif
certs/system_keyring.c +6 -0
index 798291177186..cc165b359ea3 100644
@@ -241,6 +241,12 @@ 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) {
include/keys/system_keyring.h +11 -0
index fb8b07daa9d1..61f98739e8b1 100644
@@ -31,11 +31,14 @@ extern int restrict_link_by_builtin_and_secondary_trusted(
 #define restrict_link_by_builtin_and_secondary_trusted restrict_link_by_builtin_trusted
 #endif
 
+extern struct pkcs7_message *pkcs7;
 #ifdef CONFIG_SYSTEM_BLACKLIST_KEYRING
 extern int mark_hash_blacklisted(const char *hash);
+extern int add_key_to_revocation_list(const char *data, size_t size);
 extern int is_hash_blacklisted(const u8 *hash, size_t hash_len,
 			       const char *type);
 extern int is_binary_blacklisted(const u8 *hash, size_t hash_len);
+extern int is_key_on_revocation_list(struct pkcs7_message *pkcs7);
 #else
 static inline int is_hash_blacklisted(const u8 *hash, size_t hash_len,
 				      const char *type)
@@ -47,6 +50,14 @@ static inline int is_binary_blacklisted(const u8 *hash, size_t hash_len)
 {
 	return 0;
 }
+static inline int add_key_to_revocation_list(const char *data, size_t size)
+{
+	return 0;
+}
+static inline int is_key_on_revocation_list(struct pkcs7_message *pkcs7)
+{
+	return -ENOKEY;
+}
 #endif
 
 #ifdef CONFIG_IMA_BLACKLIST_KEYRING
security/integrity/platform_certs/keyring_handler.c +11 -0
index c5ba695c10e3..5604bd57c990 100644
@@ -55,6 +55,15 @@ static __init void uefi_blacklist_binary(const char *source,
 	uefi_blacklist_hash(source, data, len, "bin:", 4);
 }
 
+/*
+ * Add an X509 cert to the revocation list.
+ */
+static __init void uefi_revocation_list_x509(const char *source,
+					     const void *data, size_t len)
+{
+	add_key_to_revocation_list(data, len);
+}
+
 /*
  * Return the appropriate handler for particular signature list types found in
  * the UEFI db and MokListRT tables.
@@ -76,5 +85,7 @@ __init efi_element_handler_t get_handler_for_dbx(const efi_guid_t *sig_type)
 		return uefi_blacklist_x509_tbs;
 	if (efi_guidcmp(*sig_type, efi_cert_sha256_guid) == 0)
 		return uefi_blacklist_binary;
+	if (efi_guidcmp(*sig_type, efi_cert_x509_guid) == 0)
+		return uefi_revocation_list_x509;
 	return 0;
 }
author reviewer
#19 lore raw
Quoted 4 lines · David Howells

How about the attached?

This looks good to me.

Quoted 2 lines

I've changed the function names to something that I think reads better, but otherwise it's the same.

I agree, the function name changes you made sound better.

We are starting to see platforms with KEK signed DBX updates containing certs like this following boothole, so it would be great if we could get something like this in. I also had a follow on series that allowed these certs to be compiled into the kernel.

https://lkml.org/lkml/2020/9/30/1301

I’d appreciate any feedback on that series as well.

Thanks

Quoted 169 lines

David
---
commit 8913866babb96fcfe452aac6042ca8862d4c0b53

Author: Eric Snowberg <[email protected]>
Date:   Tue Sep 15 20:49:27 2020 -0400

certs: Add EFI_CERT_X509_GUID support for dbx entries

The Secure Boot Forbidden Signature Database, dbx, contains a list of now revoked signatures and keys previously approved to boot with UEFI Secure Boot enabled. The dbx is capable of containing any number of EFI_CERT_X509_SHA256_GUID, EFI_CERT_SHA256_GUID, and EFI_CERT_X509_GUID entries.

Currently when EFI_CERT_X509_GUID are contained in the dbx, the entries are skipped.

Add support for EFI_CERT_X509_GUID dbx entries. When a EFI_CERT_X509_GUID is found, it is added as an asymmetrical key to the .blacklist keyring. Anytime the .platform keyring is used, the keys in the .blacklist keyring are referenced, if a matching key is found, the key will be rejected.

certs/blacklist.c +32 -0
index 6514f9ebc943..a7f021878a4b 100644
@@ -100,6 +100,38 @@ int mark_hash_blacklisted(const char *hash)
 	return 0;
 }
 
+int add_key_to_revocation_list(const char *data, size_t size)
+{
+	key_ref_t key;
+
+	key = key_create_or_update(make_key_ref(blacklist_keyring, true),
+				   "asymmetric",
+				   NULL,
+				   data,
+				   size,
+				   ((KEY_POS_ALL & ~KEY_POS_SETATTR) | KEY_USR_VIEW),
+				   KEY_ALLOC_NOT_IN_QUOTA | KEY_ALLOC_BUILT_IN);
+
+	if (IS_ERR(key)) {
+		pr_err("Problem with revocation key (%ld)\n", PTR_ERR(key));
+		return PTR_ERR(key);
+	}
+
+	return 0;
+}
+
+int is_key_on_revocation_list(struct pkcs7_message *pkcs7)
+{
+	int ret;
+
+	ret = validate_trust(pkcs7, blacklist_keyring);
+
+	if (ret == 0)
+		return -EKEYREJECTED;
+
+	return -ENOKEY;
+}
+
 /**
 * is_hash_blacklisted - Determine if a hash is blacklisted
 * @hash: The hash to be checked as a binary blob
certs/blacklist.h +12 -0
index 1efd6fa0dc60..420bb7c86e07 100644
@@ -1,3 +1,15 @@
 #include <linux/kernel.h>
+#include <linux/errno.h>
+#include <crypto/pkcs7.h>
 
 extern const char __initconst *const blacklist_hashes[];
+
+#ifdef CONFIG_INTEGRITY_PLATFORM_KEYRING
+#define validate_trust pkcs7_validate_trust
+#else
+static inline int validate_trust(struct pkcs7_message *pkcs7,
+				 struct key *trust_keyring)
+{
+	return -ENOKEY;
+}
+#endif
certs/system_keyring.c +6 -0
index 798291177186..cc165b359ea3 100644
@@ -241,6 +241,12 @@ 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) {
include/keys/system_keyring.h +11 -0
index fb8b07daa9d1..61f98739e8b1 100644
@@ -31,11 +31,14 @@ extern int restrict_link_by_builtin_and_secondary_trusted(
 #define restrict_link_by_builtin_and_secondary_trusted restrict_link_by_builtin_trusted
 #endif
 
+extern struct pkcs7_message *pkcs7;
 #ifdef CONFIG_SYSTEM_BLACKLIST_KEYRING
 extern int mark_hash_blacklisted(const char *hash);
+extern int add_key_to_revocation_list(const char *data, size_t size);
 extern int is_hash_blacklisted(const u8 *hash, size_t hash_len,
 			       const char *type);
 extern int is_binary_blacklisted(const u8 *hash, size_t hash_len);
+extern int is_key_on_revocation_list(struct pkcs7_message *pkcs7);
 #else
 static inline int is_hash_blacklisted(const u8 *hash, size_t hash_len,
 				      const char *type)
@@ -47,6 +50,14 @@ static inline int is_binary_blacklisted(const u8 *hash, size_t hash_len)
 {
 	return 0;
 }
+static inline int add_key_to_revocation_list(const char *data, size_t size)
+{
+	return 0;
+}
+static inline int is_key_on_revocation_list(struct pkcs7_message *pkcs7)
+{
+	return -ENOKEY;
+}
 #endif
 
 #ifdef CONFIG_IMA_BLACKLIST_KEYRING
security/integrity/platform_certs/keyring_handler.c +11 -0
index c5ba695c10e3..5604bd57c990 100644
@@ -55,6 +55,15 @@ static __init void uefi_blacklist_binary(const char *source,
 	uefi_blacklist_hash(source, data, len, "bin:", 4);
 }
 
+/*
+ * Add an X509 cert to the revocation list.
+ */
+static __init void uefi_revocation_list_x509(const char *source,
+					     const void *data, size_t len)
+{
+	add_key_to_revocation_list(data, len);
+}
+
 /*
 * Return the appropriate handler for particular signature list types found in
 * the UEFI db and MokListRT tables.
@@ -76,5 +85,7 @@ __init efi_element_handler_t get_handler_for_dbx(const efi_guid_t *sig_type)
 		return uefi_blacklist_x509_tbs;
 	if (efi_guidcmp(*sig_type, efi_cert_sha256_guid) == 0)
 		return uefi_blacklist_binary;
+	if (efi_guidcmp(*sig_type, efi_cert_x509_guid) == 0)
+		return uefi_revocation_list_x509;
 	return 0;
 }
maintainer
#20 lore raw
In reply to Eric Snowberg
Quoted 9 lines · Eric Snowberg

The Secure Boot Forbidden Signature Database, dbx, contains a list of now revoked signatures and keys previously approved to boot with UEFI Secure Boot enabled. The dbx is capable of containing any number of EFI_CERT_X509_SHA256_GUID, EFI_CERT_SHA256_GUID, and EFI_CERT_X509_GUID entries.

Currently when EFI_CERT_X509_GUID are contained in the dbx, the entries are skipped.

Quoted 7 lines

Add support for EFI_CERT_X509_GUID dbx entries. When a EFI_CERT_X509_GUID is found, it is added as an asymmetrical key to the .blacklist keyring. Anytime the .platform keyring is used, the keys in the .blacklist keyring are referenced, if a matching key is found, the key will be rejected.

If you're using shim, as most of our users are, you have no access to dbx to blacklist certificates. Plus our security envelope includes the Mok variables, so you should also be paying attestion to MokListX (or it's RT equivalent: MokListXRT).

If you add this to the patch, we get something that is mechanistically complete and which also allows users to add certs to their Mok blacklist.

James

author reviewer
#21 lore raw
Quoted 21 lines · James Bottomley
Quoted 9 lines · Eric Snowberg

The Secure Boot Forbidden Signature Database, dbx, contains a list of now revoked signatures and keys previously approved to boot with UEFI Secure Boot enabled. The dbx is capable of containing any number of EFI_CERT_X509_SHA256_GUID, EFI_CERT_SHA256_GUID, and EFI_CERT_X509_GUID entries.

Currently when EFI_CERT_X509_GUID are contained in the dbx, the entries are skipped.

Quoted 7 lines

Add support for EFI_CERT_X509_GUID dbx entries. When a EFI_CERT_X509_GUID is found, it is added as an asymmetrical key to the .blacklist keyring. Anytime the .platform keyring is used, the keys in the .blacklist keyring are referenced, if a matching key is found, the key will be rejected.

Quoted 8 lines

If you're using shim, as most of our users are, you have no access to dbx to blacklist certificates. Plus our security envelope includes the Mok variables, so you should also be paying attestion to MokListX (or it's RT equivalent: MokListXRT).

If you add this to the patch, we get something that is mechanistically complete and which also allows users to add certs to their Mok blacklist.

That make sense. I’ll work on a patch to add this ability.