Linux Integrity Measurement development
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Bruno Meneguele <bmeneg@redhat.com>, linux-integrity@vger.kernel.org
Cc: "Jarkko Sakkinen" <jarkko@kernel.org>,
	"David Howells" <dhowells@redhat.com>,
	"Roberto Sassu" <roberto.sassu@huawei.com>,
	"Mickaël Salaün" <mic@digikod.net>,
	keyrings@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] certs: blacklist: define skid: entries and add is_key_blacklisted()
Date: Wed, 02 Dec 2026 17:18:17 -0500	[thread overview]
Message-ID: <130326f3dc0cdccadb8577d411b0cd5645c70115.camel@linux.ibm.com> (raw)
In-Reply-To: <DN66LCLCYBP5.O2KSAOOS8SYO@redhat.com>

On Fri, 2026-11-27 at 14:49 -0300, Bruno Meneguele wrote:
> On Fri Nov 6, 2026 at 2:31 PM -03, Mimi Zohar wrote:
> > A "tbs:" blacklist entry is only compared against certificates being
> > added to a keyring or presented in a signature chain, so it does not
> > stop a key that is already loaded from being used as a trust anchor.
> > 
> > Define a new "skid:<hex>" blacklist entry, holding a Subject Key
> > Identifier, and add is_key_blacklisted(), which looks up the SKID of an
> > asymmetric key in the system blacklist.  Entries are added like "tbs:"
> > and "bin:" entries and are subject to CONFIG_SYSTEM_BLACKLIST_AUTH_UPDATE.
> > 
> > blacklist_vet_description() now uses a prefix table, since the prefixes
> > no longer all have the same length.  "tbs:" and "bin:" entries behave
> > as before.
> > 
> > For example, to add an entry for a certificate (the signed string must
> > not include a trailing newline):
> > 
> >   skid=$(openssl x509 -in cert.pem -noout -ext subjectKeyIdentifier |
> >          sed -n '2s/[ :]//gp' | tr A-F a-f)
> >   printf 'skid:%s' "$skid" > skid.txt
> >   openssl smime -sign -binary -noattr -in skid.txt -signer signer.crt \
> >           -inkey signer.key -outform DER -out skid.p7s
> >   keyctl padd blacklist "skid:$skid" %:.blacklist < skid.p7s
> > 
> > The SKID is also the hex string in the description of the key on a
> > keyring, and its last four bytes are the key ID in the security.ima
> > xattr, so an entry is easy to correlate with the key it revokes:
> > 
> >   # keyctl show %:.ima | grep 073d
> >   927946571 --als--v  0  0   \_ asymmetric: test signing key: b7809c3372a07fe87248dcec7ff047a40fb3073d
> >   # keyctl show %:.blacklist | grep skid
> >   1014808518 ----s--v 0  0   \_ blacklist: skid:b7809c3372a07fe87248dcec7ff047a40fb3073d
> > 
> > Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
> > ---
> > Changelog v1:
> > - Addressed Sashiko issues: drop Kconfig change, linking issues when
> > blacklist support configured, but without CONFIG_ASYMMETRIC_KEY_TYPE
> > configured.
> > 
> >  certs/blacklist.c             | 83 ++++++++++++++++++++++++-----------
> >  include/keys/system_keyring.h | 12 +++++
> >  2 files changed, 70 insertions(+), 25 deletions(-)
> > 
> > diff --git a/certs/blacklist.c b/certs/blacklist.c
> > index fa561c12eabf..9158bd9f9fc9 100644
> > --- a/certs/blacklist.c
> > +++ b/certs/blacklist.c
> > @@ -32,6 +32,7 @@
> > 
> >  static const char tbs_prefix[] = "tbs";
> >  static const char bin_prefix[] = "bin";
> > +static const char skid_prefix[] = "skid";
> > 
> >  static struct key *blacklist_keyring;
> > 
> 
> Hi Mimi,
> 
> the script certs/check-blacklist-hashes.awk needs to be updated to allow "skid:"
> hash type too, otherwise build fails with "unknown prefix":
> 
> $ echo '"skid:3afbecd5ee1d3d787c61270797e5c85065d030cc"' > certs/blacklist.txt
> $ scripts/config --set-str SYSTEM_BLACKLIST_HASH_LIST certs/blacklist.txt
> $ make certs/
>   DESCEND objtool
>   GEN     certs/blacklist_hash_list
> Unknown prefix (item 1): skid:3afbecd5ee1d3d787c61270797e5c85065d030cc
> make[3]: *** [certs/Makefile:21: certs/blacklist_hash_list] Error 1
> make[2]: *** [scripts/Makefile.build:572: certs] Error 2
> make[1]: *** [/home/brdeoliv/git/linux/Makefile:2244: .] Error 2
> make: *** [Makefile:248: __sub-make] Error 2
> 
> It seems to be just a single line of code and the file documentation:
> 
> -       if (!match(part1[1], "^(tbs|bin):(.*)$", part2)) {
> +       if (!match(part1[1], "^(tbs|bin|skid):(.*)$", part2)) {
> 
> At the same time, I noticed you also dropped the Kconfig documentation change
> for CONFIG_SYSTEM_BLACKLIST_HASH_LIST when you fixed Sashiko's report.

Based on Sashiko's comment, either drop the documentation change making the code
self consistent or, as you suggested, update the script to fully support "skid:"
rules like "tbs:" and "bin:".

Either way is acceptable, at least to me.

Mimi

  reply	other threads:[~2026-12-02 22:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 17:31 [PATCH 0/3] ima: use the system blacklist in lieu of the IMA blacklist keyring Mimi Zohar
2026-11-06 17:31 ` [PATCH 1/3] certs: blacklist: define skid: entries and add is_key_blacklisted() Mimi Zohar
2026-11-27 17:49   ` Bruno Meneguele
2026-12-02 22:18     ` Mimi Zohar [this message]
2026-11-06 17:31 ` [PATCH 2/3] integrity: use is_key_blacklisted() in asymmetric_verify() Mimi Zohar
2026-11-06 17:31 ` [PATCH 3/3] ima: remove the experimental IMA blacklist keyring Mimi Zohar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=130326f3dc0cdccadb8577d411b0cd5645c70115.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=bmeneg@redhat.com \
    --cc=dhowells@redhat.com \
    --cc=jarkko@kernel.org \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mic@digikod.net \
    --cc=roberto.sassu@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox