linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipe: allow secondary and platform keyrings to install/update policies
@ 2024-09-13 23:48 luca.boccassi
  2024-09-15  4:27 ` Fan Wu
  2024-09-15  9:11 ` [PATCH v2] " luca.boccassi
  0 siblings, 2 replies; 7+ messages in thread
From: luca.boccassi @ 2024-09-13 23:48 UTC (permalink / raw)
  To: linux-security-module; +Cc: wufan, paul

From: Luca Boccassi <bluca@debian.org>

The current policy management makes it impossible to use IPE
in a general purpose distribution. In such cases the users are not
building the kernel, the distribution is, and access to the private
key included in the trusted keyring is, for obvious reason, not
available.
This means that users have no way to enable IPE, since there will
be no built-in generic policy, and no access to the key to sign
updates validated by the trusted keyring.

Just as we do for dm-verity, kernel modules and more, allow the
secondary and platform keyrings to also validate policies. This
allows users enrolling their own keys in UEFI db or MOK to also
sign policies, and enroll them. This makes it sensible to enable
IPE in general purpose distributions, as it becomes usable by
any user wishing to do so. Keys in these keyrings can already
load kernels and kernel modules, so there is no security
downgrade.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
 security/ipe/policy.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/security/ipe/policy.c b/security/ipe/policy.c
index d8e7db857a2e..cac304dc86c2 100644
--- a/security/ipe/policy.c
+++ b/security/ipe/policy.c
@@ -169,9 +169,15 @@ struct ipe_policy *ipe_new_policy(const char *text, size_t textlen,
 			goto err;
 		}
 
-		rc = verify_pkcs7_signature(NULL, 0, new->pkcs7, pkcs7len, NULL,
+		rc = verify_pkcs7_signature(NULL, 0, new->pkcs7, pkcs7len,
+					    VERIFY_USE_SECONDARY_KEYRING,
 					    VERIFYING_UNSPECIFIED_SIGNATURE,
 					    set_pkcs7_data, new);
+		if (rc == -ENOKEY)
+			rc = verify_pkcs7_signature(NULL, 0, new->pkcs7, pkcs7len,
+						    VERIFY_USE_PLATFORM_KEYRING,
+						    VERIFYING_UNSPECIFIED_SIGNATURE,
+						    set_pkcs7_data, new);
 		if (rc)
 			goto err;
 	} else {
-- 
2.39.2


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

end of thread, other threads:[~2024-09-20 13:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-13 23:48 [PATCH] ipe: allow secondary and platform keyrings to install/update policies luca.boccassi
2024-09-15  4:27 ` Fan Wu
2024-09-15  9:14   ` Luca Boccassi
2024-09-15  9:11 ` [PATCH v2] " luca.boccassi
2024-09-20  2:02   ` Serge E. Hallyn
2024-09-20  7:54     ` Luca Boccassi
2024-09-20 13:02       ` Serge E. Hallyn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).