1*7f2fe78bSCy SchubertKDC preauthentication interface (kdcpreauth) 2*7f2fe78bSCy Schubert============================================ 3*7f2fe78bSCy Schubert 4*7f2fe78bSCy SchubertThe kdcpreauth interface allows the addition of KDC support for 5*7f2fe78bSCy Schubertpreauthentication mechanisms beyond those included in the core MIT 6*7f2fe78bSCy Schubertkrb5 code base. For a detailed description of the kdcpreauth 7*7f2fe78bSCy Schubertinterface, see the header file ``<krb5/kdcpreauth_plugin.h>`` (or 8*7f2fe78bSCy Schubert``<krb5/preauth_plugin.h>`` before release 1.12). 9*7f2fe78bSCy Schubert 10*7f2fe78bSCy SchubertA kdcpreauth module is generally responsible for: 11*7f2fe78bSCy Schubert 12*7f2fe78bSCy Schubert* Supplying a list of preauth type numbers used by the module in the 13*7f2fe78bSCy Schubert **pa_type_list** field of the vtable structure. 14*7f2fe78bSCy Schubert 15*7f2fe78bSCy Schubert* Indicating what kind of preauthentication mechanism it implements, 16*7f2fe78bSCy Schubert with the **flags** method. If the mechanism computes a new reply 17*7f2fe78bSCy Schubert key, it must specify the ``PA_REPLACES_KEY`` flag. If the mechanism 18*7f2fe78bSCy Schubert is generally only used with hardware tokens, the ``PA_HARDWARE`` 19*7f2fe78bSCy Schubert flag allows the mechanism to work with principals which have the 20*7f2fe78bSCy Schubert **requires_hwauth** flag set. 21*7f2fe78bSCy Schubert 22*7f2fe78bSCy Schubert* Producing a padata value to be sent with a preauth_required error, 23*7f2fe78bSCy Schubert with the **edata** method. 24*7f2fe78bSCy Schubert 25*7f2fe78bSCy Schubert* Examining a padata value sent by a client and verifying that it 26*7f2fe78bSCy Schubert proves knowledge of the appropriate client credential information. 27*7f2fe78bSCy Schubert This is done with the **verify** method. 28*7f2fe78bSCy Schubert 29*7f2fe78bSCy Schubert* Producing a padata response value for the client, and possibly 30*7f2fe78bSCy Schubert computing a reply key. This is done with the **return_padata** 31*7f2fe78bSCy Schubert method. 32*7f2fe78bSCy Schubert 33*7f2fe78bSCy SchubertA module can create and destroy per-KDC state objects by implementing 34*7f2fe78bSCy Schubertthe **init** and **fini** methods. Per-KDC state objects have the 35*7f2fe78bSCy Schuberttype krb5_kdcpreauth_moddata, which is an abstract pointer types. A 36*7f2fe78bSCy Schubertmodule should typically cast this to an internal type for the state 37*7f2fe78bSCy Schubertobject. 38*7f2fe78bSCy Schubert 39*7f2fe78bSCy SchubertA module can create a per-request state object by returning one in the 40*7f2fe78bSCy Schubert**verify** method, receiving it in the **return_padata** method, and 41*7f2fe78bSCy Schubertdestroying it in the **free_modreq** method. Note that these state 42*7f2fe78bSCy Schubertobjects only apply to the processing of a single AS request packet, 43*7f2fe78bSCy Schubertnot to an entire authentication exchange (since an authentication 44*7f2fe78bSCy Schubertexchange may remain unfinished by the client or may involve multiple 45*7f2fe78bSCy Schubertdifferent KDC hosts). Per-request state objects have the type 46*7f2fe78bSCy Schubertkrb5_kdcpreauth_modreq, which is an abstract pointer type. 47*7f2fe78bSCy Schubert 48*7f2fe78bSCy SchubertThe **edata**, **verify**, and **return_padata** methods have access 49*7f2fe78bSCy Schubertto a callback function and handle (called a "rock") which can be used 50*7f2fe78bSCy Schubertto get additional information about the current request, including the 51*7f2fe78bSCy Schubertmaximum allowable clock skew, the client's long-term keys, the 52*7f2fe78bSCy SchubertDER-encoded request body, the FAST armor key, string attributes on the 53*7f2fe78bSCy Schubertclient's database entry, and the client's database entry itself. The 54*7f2fe78bSCy Schubert**verify** method can assert one or more authentication indicators to 55*7f2fe78bSCy Schubertbe included in the issued ticket using the ``add_auth_indicator`` 56*7f2fe78bSCy Schubertcallback (new in release 1.14). 57*7f2fe78bSCy Schubert 58*7f2fe78bSCy SchubertA module can generate state information to be included with the next 59*7f2fe78bSCy Schubertclient request using the ``set_cookie`` callback (new in release 60*7f2fe78bSCy Schubert1.14). On the next request, the module can read this state 61*7f2fe78bSCy Schubertinformation using the ``get_cookie`` callback. Cookie information is 62*7f2fe78bSCy Schubertencrypted, timestamped, and transmitted to the client in a 63*7f2fe78bSCy Schubert``PA-FX-COOKIE`` pa-data item. Older clients may not support cookies 64*7f2fe78bSCy Schubertand therefore may not transmit the cookie in the next request; in this 65*7f2fe78bSCy Schubertcase, ``get_cookie`` will not yield the saved information. 66*7f2fe78bSCy Schubert 67*7f2fe78bSCy SchubertIf a module implements a mechanism which requires multiple round 68*7f2fe78bSCy Schuberttrips, its **verify** method can respond with the code 69*7f2fe78bSCy Schubert``KRB5KDC_ERR_MORE_PREAUTH_DATA_REQUIRED`` and a list of pa-data in 70*7f2fe78bSCy Schubertthe *e_data* parameter to be processed by the client. 71*7f2fe78bSCy Schubert 72*7f2fe78bSCy SchubertThe **edata** and **verify** methods can be implemented 73*7f2fe78bSCy Schubertasynchronously. Because of this, they do not return values directly 74*7f2fe78bSCy Schubertto the caller, but must instead invoke responder functions with their 75*7f2fe78bSCy Schubertresults. A synchronous implementation can invoke the responder 76*7f2fe78bSCy Schubertfunction immediately. An asynchronous implementation can use the 77*7f2fe78bSCy Schubertcallback to get an event context for use with the libverto_ API. 78*7f2fe78bSCy Schubert 79*7f2fe78bSCy Schubert.. _libverto: https://fedorahosted.org/libverto/ 80