Discussion:
recent certificate failure for pkinit
(too old to reply)
Matt Zagrabelny
2024-07-08 18:54:40 UTC
Permalink
Greetings Kerberos-users,

I've been successfully using OTP and pkinit for the past year or so. Within
the last week, or so, it has started to fail with:

client:
$ /usr/bin/kinit -n -c /tmp/.kerberos_cache
kinit: Preauthentication failed while getting initial credentials

KDC:
KDC_RETURN_PADATA: WELLKNOWN/***@EXAMPLE.COM for krbtgt/
***@EXAMPLE.COM, Failed to verify own certificate (depth 0): unable
to get local issuer certificate

I've looked at the KDC and CA certs and their expiration dates are still
valid.

Looking at the system, the packages have recently been updated due to
Debian patching the krb5 packages for a CVE:

krb5 (1.20.1-2+deb12u2) bookworm-security; urgency=high

* CVE-2024-37370: an unauthenticated attacker can modify the
extra count in an RFC 4121 GSS token, causing the token to appear
truncated.
* CVE-2024-37371: an attacker can cause invalid memory reads by
sending an invalid GSS token.

-- Sam Hartman <***@debian.org> Mon, 01 Jul 2024 11:31:35 -0600

I've tried to downgrade the packages, but the error persists.

I have enabled tracing via the KRB5_TRACE=/dev/stdout variable, for both
the client and KDC. Nothing really stands out.

Does anyone have any ideas about where to look next?

Thanks for the help!

-m
Carson Gaspar
2024-07-08 21:52:21 UTC
Permalink
Post by Matt Zagrabelny
Greetings Kerberos-users,
I've been successfully using OTP and pkinit for the past year or so. Within
$ /usr/bin/kinit -n -c /tmp/.kerberos_cache
kinit: Preauthentication failed while getting initial credentials
to get local issuer certificate
I've run into this error before. MIT's KDC, for some bizarre reason,
insists that its server cert validate against the same set of CAs used
to authorize client PKINIT certs. This is insecure and a terrible idea,
but oh well. So make sure that the KDC server cert validates against the
set of CAs you've specified in the config file.

If you want more debugging, AFAIK you'll need to recompile the pkinit
plugin and set a CPP debug macro to 1 to get more useful info out of it
(and the debug output goes to stderr as I recall).
--
Carson
Ken Hornstein
2024-07-09 01:29:32 UTC
Permalink
Post by Carson Gaspar
Post by Matt Zagrabelny
to get local issuer certificate
I've run into this error before. MIT's KDC, for some bizarre reason,
insists that its server cert validate against the same set of CAs used
to authorize client PKINIT certs. This is insecure and a terrible idea,
but oh well. So make sure that the KDC server cert validates against the
set of CAs you've specified in the config file.
The full chain is needed on the KDC side so intermediate certificates
can be sent in the CMS object, and the easiest way to get the full chain
with OpenSSL is to call X509_verify_cert().

However, I disagree with your assertion that this is insecure. In my
experience certificates used by the KDC and clients are all issued by
the same PKI, so there's nothing insecure about trusting the same set
of certificates for both (and in the above example if you are using
anonymous PKINIT you're not using a client certificate anyway).

If I was in the situation where client certificates were issued by a
different PKI than the KDC certificate and I didn't trust the PKI
that was issuing the KDC certificate I would probably write a certauth
plugin to reject client certificates signed by the "wrong" PKI.

--Ken

Loading...