Date: Mon, 28 Jul 2025 15:32:44 -0700 From: Benjamin Kaduk <bjkfbsd@gmail.com> To: Rick Macklem <rick.macklem@gmail.com> Cc: Konstantin Belousov <kostikbel@gmail.com>, Cy Schubert <Cy.Schubert@cschubert.com>, Jessica Clarke <jrtc27@freebsd.org>, Cy Schubert <cy@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@freebsd.org> Subject: Re: git: c7da9fb90b0b - main - KRB5: Enable MIT KRB5 by default Message-ID: <CAJ5_RoBXD4rkudaqo4BA%2BrggYcy%2BLUSnPrK2_FO4Cp_xG0fS=Q@mail.gmail.com> In-Reply-To: <CAJ5_RoBjpX_BoKgZTdOof5b83cdxjZyvn4iPM4m5voPHEr2SeQ@mail.gmail.com> References: <202507211410.56LEAD6J066633@gitrepo.freebsd.org> <47C3CC37-6F32-4376-900A-B5387B9817D5@freebsd.org> <20250721144645.3BA391BE@slippy.cwsent.com> <aH98iNXobigu39On@kib.kiev.ua> <20250722155941.AC7EB121@slippy.cwsent.com> <CAM5tNy63Ri73x3ByJUPFh7a0eCVjWPGW1hQwrkG0wz6pJ6-W3Q@mail.gmail.com> <aIcyq6JuYngAm4Ko@kib.kiev.ua> <CAM5tNy6pAUS1HD4W1=rxLXvfctAs1Ms_fxwUWz1X3tFNuVTVZg@mail.gmail.com> <CAJ5_RoBjpX_BoKgZTdOof5b83cdxjZyvn4iPM4m5voPHEr2SeQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--0000000000008f1cdc063b04dfbb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jul 28, 2025 at 3:04=E2=80=AFPM Benjamin Kaduk <bjkfbsd@gmail.com> = wrote: > > Note that MIT krb5 provides the gss_krb5_export_lucid_sec_context() API > that does a lot of the work of getting useful bits out of an established > GSS security context. > > And a bit more context on what is going on here and why kgssapi has to care= : The GSS-API (RFC 2743) is all about a way to "establish a security context" (i.e., do crypto negotiation, authentication, sometimes authorization, etc.) between two entities, the initiator and the acceprot, and then exchanging protected messages between the two (which can be either encrypted or just integrity protection tags for otherweise cleartext data); later extensions included the ability to produce identical PRF output on both parties, etc.. The details are "mechanism-specific", and for this purpose we're exclusively talking about the krb5 mechanism. The steps to establish the security context are complicated and sometimes fiddly, and in the general case can require a large number of round-trips between the initiator and acceptor before the security context is established. The individual message-protection parts are comparatively simple and amendable to implementation in the kernel for processing efficiency. RFC 2743 also defines functions for GSS_Export_sec_context() and GSS_Import_sec_context(), that are designed essentially to pass information about an established security context from one process to another on the same machine (which are presumably using the same implementation and version of the implementation), so the contents of the exported blob are opaque and implementation-specific. We are abusing that mechanism to export information about the security context that gssd has established and feed that information into the kernel implementation of the per-message processing routines. At present, this necessarily entails knowing the details of the implementation-specific opaque blob that is the "export sec context token", which is what the sys/kgssapi/krb5/krb5_mech.c code is doing. But if we can get the information we want without breaking the abstraction barrier, such as via the gss_krb5_export_lucid_sec_context() API, we are in a more robust posture overall and somewhat future-proofed against future evolution by MIT krb5. (I note that recent Heimdal versions seem to also expose a gss_krb5_export_lucid_sec_context() API, so part of the problem is just that the Heimdal in base is so old.) -Ben --0000000000008f1cdc063b04dfbb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr">On Mon, Jul 28, 2025 at 3:04=E2=80=AFPM B= enjamin Kaduk <<a href=3D"mailto:bjkfbsd@gmail.com">bjkfbsd@gmail.com</a= >> wrote:</div><div class=3D"gmail_quote gmail_quote_container"><blockqu= ote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px= solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div dir=3D"ltr"= ><br></div><div class=3D"gmail_quote"><div>Note that MIT krb5 provides the= =C2=A0gss_krb5_export_lucid_sec_context() API that does a lot of the work o= f getting useful bits out of an established GSS security context.</div><div= >=C2=A0</div></div></div></blockquote><div><br></div><div><br></div><div><b= r></div><div>And a bit more context on what is going on here and why kgssap= i has to care:</div><div>The GSS-API (RFC 2743) is all about a way to "= ;establish a security context" (i.e., do crypto negotiation, authentic= ation, sometimes authorization, etc.) between two entities, the initiator a= nd the acceprot, and then exchanging protected messages between the two (wh= ich can be either encrypted or just integrity protection tags for otherweis= e cleartext data); later extensions included the ability to produce identic= al PRF output on both parties, etc..=C2=A0 The details are "mechanism-= specific", and for this purpose we're exclusively talking about th= e krb5 mechanism.=C2=A0 The steps to establish the security context are com= plicated and sometimes fiddly, and in the general case can require a large = number of round-trips between the initiator and acceptor before the securit= y context is established.=C2=A0 The individual message-protection parts are= comparatively simple and amendable to implementation in the kernel for pro= cessing efficiency.</div><div>RFC 2743 also defines functions for GSS_Expor= t_sec_context() and GSS_Import_sec_context(), that are designed essentially= to pass information about an established security context from one process= to another on the same machine (which are presumably using the same implem= entation and version of the implementation), so the contents of the exporte= d blob are opaque and implementation-specific.=C2=A0 We are abusing that me= chanism to export information about the security context that gssd has esta= blished and feed that information into the kernel implementation of the per= -message processing routines.=C2=A0 At present, this necessarily entails kn= owing the details of the implementation-specific opaque blob that is the &q= uot;export sec context token", which is what the sys/kgssapi/krb5/krb5= _mech.c code is doing.=C2=A0 But if we can get the information we want with= out breaking the abstraction barrier, such as via the gss_krb5_export_lucid= _sec_context() API, we are in a more robust posture overall and somewhat fu= ture-proofed against future evolution by MIT krb5.</div><div>(I note that r= ecent Heimdal versions seem to also expose a gss_krb5_export_lucid_sec_cont= ext() API, so part of the problem is just that the Heimdal in base is so ol= d.)</div><div><br></div><div>-Ben</div></div></div> --0000000000008f1cdc063b04dfbb--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ5_RoBXD4rkudaqo4BA%2BrggYcy%2BLUSnPrK2_FO4Cp_xG0fS=Q>