lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230908213428.731513-1-eric.snowberg@oracle.com>
Date:   Fri,  8 Sep 2023 17:34:28 -0400
From:   Eric Snowberg <eric.snowberg@...cle.com>
To:     jarkko@...nel.org, zohar@...ux.ibm.com, dhowells@...hat.com,
        dwmw2@...radead.org
Cc:     mic@...ux.microsoft.com, eric.snowberg@...cle.com,
        kanth.ghatraju@...cle.com, konrad.wilk@...cle.com,
        linux-integrity@...r.kernel.org, keyrings@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] certs: Restrict blacklist updates to the secondary trusted keyring

Currently root can dynamically update the blacklist keyring if the hash
being added is signed and vouched for by the builtin trusted keyring.
Currently keys in the secondary trusted keyring can not be used.

Keys within the secondary trusted keyring carry the same capabilities as
the builtin trusted keyring.  Relax the current restriction for updating
the .blacklist keyring and allow the secondary to also be referenced as
a trust source.  Since the machine keyring is linked to the secondary
trusted keyring, any key within it may also be used.

An example use case for this is IMA appraisal.  Now that IMA both
references the blacklist keyring and allows the machine owner to add
custom IMA CA certs via the machine keyring, this adds the additional
capability for the machine owner to also do revocations on a running
system.

IMA appraisal usage example to add a revocation for /usr/foo:

sha256sum /bin/foo | awk '{printf "bin:" $1}' > hash.txt

openssl smime -sign -in hash.txt -inkey machine-private-key.pem \
       -signer machine-certificate.pem -noattr -binary -outform DER \
       -out hash.p7s

keyctl padd blacklist "$(< hash.txt)" %:.blacklist < hash.p7s

Signed-off-by: Eric Snowberg <eric.snowberg@...cle.com>
---
 certs/Kconfig     | 2 +-
 certs/blacklist.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/certs/Kconfig b/certs/Kconfig
index 1f109b070877..23dc87c52aff 100644
--- a/certs/Kconfig
+++ b/certs/Kconfig
@@ -134,7 +134,7 @@ config SYSTEM_BLACKLIST_AUTH_UPDATE
 	depends on SYSTEM_DATA_VERIFICATION
 	help
 	  If set, provide the ability to load new blacklist keys at run time if
-	  they are signed and vouched by a certificate from the builtin trusted
+	  they are signed and vouched by a certificate from the secondary trusted
 	  keyring.  The PKCS#7 signature of the description is set in the key
 	  payload.  Blacklist keys cannot be removed.
 
diff --git a/certs/blacklist.c b/certs/blacklist.c
index 675dd7a8f07a..0b346048ae2d 100644
--- a/certs/blacklist.c
+++ b/certs/blacklist.c
@@ -102,12 +102,12 @@ static int blacklist_key_instantiate(struct key *key,
 
 #ifdef CONFIG_SYSTEM_BLACKLIST_AUTH_UPDATE
 	/*
-	 * Verifies the description's PKCS#7 signature against the builtin
+	 * Verifies the description's PKCS#7 signature against the secondary
 	 * trusted keyring.
 	 */
 	err = verify_pkcs7_signature(key->description,
 			strlen(key->description), prep->data, prep->datalen,
-			NULL, VERIFYING_UNSPECIFIED_SIGNATURE, NULL, NULL);
+			VERIFY_USE_SECONDARY_KEYRING, VERIFYING_UNSPECIFIED_SIGNATURE, NULL, NULL);
 	if (err)
 		return err;
 #else
-- 
2.39.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ