1*7934SMark.Phalan@Sun.COM 2*7934SMark.Phalan@Sun.COM /* 3*7934SMark.Phalan@Sun.COM * <krb5/preauth_plugin.h> 4*7934SMark.Phalan@Sun.COM * 5*7934SMark.Phalan@Sun.COM * Copyright (c) 2006 Red Hat, Inc. 6*7934SMark.Phalan@Sun.COM * Portions copyright (c) 2006 Massachusetts Institute of Technology 7*7934SMark.Phalan@Sun.COM * All Rights Reserved. 8*7934SMark.Phalan@Sun.COM * 9*7934SMark.Phalan@Sun.COM * Redistribution and use in source and binary forms, with or without 10*7934SMark.Phalan@Sun.COM * modification, are permitted provided that the following conditions are met: 11*7934SMark.Phalan@Sun.COM * 12*7934SMark.Phalan@Sun.COM * * Redistributions of source code must retain the above copyright 13*7934SMark.Phalan@Sun.COM * notice, this list of conditions and the following disclaimer. 14*7934SMark.Phalan@Sun.COM * * Redistributions in binary form must reproduce the above copyright 15*7934SMark.Phalan@Sun.COM * notice, this list of conditions and the following disclaimer in 16*7934SMark.Phalan@Sun.COM * the documentation and/or other materials provided with the 17*7934SMark.Phalan@Sun.COM * distribution. 18*7934SMark.Phalan@Sun.COM * * Neither the name of Red Hat, Inc., nor the names of its 19*7934SMark.Phalan@Sun.COM * contributors may be used to endorse or promote products derived 20*7934SMark.Phalan@Sun.COM * from this software without specific prior written permission. 21*7934SMark.Phalan@Sun.COM * 22*7934SMark.Phalan@Sun.COM * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 23*7934SMark.Phalan@Sun.COM * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 24*7934SMark.Phalan@Sun.COM * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 25*7934SMark.Phalan@Sun.COM * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 26*7934SMark.Phalan@Sun.COM * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 27*7934SMark.Phalan@Sun.COM * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 28*7934SMark.Phalan@Sun.COM * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 29*7934SMark.Phalan@Sun.COM * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30*7934SMark.Phalan@Sun.COM * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31*7934SMark.Phalan@Sun.COM * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32*7934SMark.Phalan@Sun.COM * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33*7934SMark.Phalan@Sun.COM * 34*7934SMark.Phalan@Sun.COM * Preauthentication plugin definitions for Kerberos 5. 35*7934SMark.Phalan@Sun.COM */ 36*7934SMark.Phalan@Sun.COM 37*7934SMark.Phalan@Sun.COM #ifndef KRB5_PREAUTH_PLUGIN_H_INCLUDED 38*7934SMark.Phalan@Sun.COM #define KRB5_PREAUTH_PLUGIN_H_INCLUDED 39*7934SMark.Phalan@Sun.COM #include <krb5.h> 40*7934SMark.Phalan@Sun.COM 41*7934SMark.Phalan@Sun.COM /* 42*7934SMark.Phalan@Sun.COM * While arguments of these types are passed-in, for the most part a preauth 43*7934SMark.Phalan@Sun.COM * module can treat them as opaque. If we need keying data, we can ask for 44*7934SMark.Phalan@Sun.COM * it directly. 45*7934SMark.Phalan@Sun.COM */ 46*7934SMark.Phalan@Sun.COM struct _krb5_db_entry_new; 47*7934SMark.Phalan@Sun.COM struct _krb5_key_data; 48*7934SMark.Phalan@Sun.COM struct _krb5_preauth_client_rock; 49*7934SMark.Phalan@Sun.COM 50*7934SMark.Phalan@Sun.COM /* 51*7934SMark.Phalan@Sun.COM * Preauth mechanism property flags, unified from previous definitions in the 52*7934SMark.Phalan@Sun.COM * KDC and libkrb5 sources. 53*7934SMark.Phalan@Sun.COM */ 54*7934SMark.Phalan@Sun.COM 55*7934SMark.Phalan@Sun.COM /* Provides a real answer which we can send back to the KDC (client-only). The 56*7934SMark.Phalan@Sun.COM * client assumes that one real answer will be enough. */ 57*7934SMark.Phalan@Sun.COM #define PA_REAL 0x00000001 58*7934SMark.Phalan@Sun.COM 59*7934SMark.Phalan@Sun.COM /* Doesn't provide a real answer, but must be given a chance to run before any 60*7934SMark.Phalan@Sun.COM * REAL mechanism callbacks (client-only). */ 61*7934SMark.Phalan@Sun.COM #define PA_INFO 0x00000002 62*7934SMark.Phalan@Sun.COM 63*7934SMark.Phalan@Sun.COM /* Causes the KDC to include this mechanism in a list of supported preauth 64*7934SMark.Phalan@Sun.COM * types if the user's DB entry flags the user as requiring hardware-based 65*7934SMark.Phalan@Sun.COM * preauthentication (server-only). */ 66*7934SMark.Phalan@Sun.COM #define PA_HARDWARE 0x00000004 67*7934SMark.Phalan@Sun.COM 68*7934SMark.Phalan@Sun.COM /* Causes the KDC to include this mechanism in a list of supported preauth 69*7934SMark.Phalan@Sun.COM * types if the user's DB entry flags the user as requiring preauthentication, 70*7934SMark.Phalan@Sun.COM * and to fail preauthentication if we can't verify the client data. The 71*7934SMark.Phalan@Sun.COM * flipside of PA_SUFFICIENT (server-only). */ 72*7934SMark.Phalan@Sun.COM #define PA_REQUIRED 0x00000008 73*7934SMark.Phalan@Sun.COM 74*7934SMark.Phalan@Sun.COM /* Causes the KDC to include this mechanism in a list of supported preauth 75*7934SMark.Phalan@Sun.COM * types if the user's DB entry flags the user as requiring preauthentication, 76*7934SMark.Phalan@Sun.COM * and to mark preauthentication as successful if we can verify the client 77*7934SMark.Phalan@Sun.COM * data. The flipside of PA_REQUIRED (server-only). */ 78*7934SMark.Phalan@Sun.COM #define PA_SUFFICIENT 0x00000010 79*7934SMark.Phalan@Sun.COM 80*7934SMark.Phalan@Sun.COM /* Marks this preauthentication mechanism as one which changes the key which is 81*7934SMark.Phalan@Sun.COM * used for encrypting the response to the client. Modules which have this 82*7934SMark.Phalan@Sun.COM * flag have their server_return_proc called before modules which do not, and 83*7934SMark.Phalan@Sun.COM * are passed over if a previously-called module has modified the encrypting 84*7934SMark.Phalan@Sun.COM * key (server-only). */ 85*7934SMark.Phalan@Sun.COM #define PA_REPLACES_KEY 0x00000020 86*7934SMark.Phalan@Sun.COM 87*7934SMark.Phalan@Sun.COM /* Causes the KDC to check with this preauthentication module even if the 88*7934SMark.Phalan@Sun.COM * client has no entry in the realm database. If the module returns a success 89*7934SMark.Phalan@Sun.COM * code, continue processing and assume that its return_padata callback will 90*7934SMark.Phalan@Sun.COM * supply us with a key for encrypting the AS reply (server-only). */ 91*7934SMark.Phalan@Sun.COM /* #define PA_VIRTUAL (0x00000040 | PA_REPLACES_KEY) */ 92*7934SMark.Phalan@Sun.COM 93*7934SMark.Phalan@Sun.COM /* Not really a padata type, so don't include it in any list of preauth types 94*7934SMark.Phalan@Sun.COM * which gets sent over the wire. */ 95*7934SMark.Phalan@Sun.COM #define PA_PSEUDO 0x00000080 96*7934SMark.Phalan@Sun.COM 97*7934SMark.Phalan@Sun.COM 98*7934SMark.Phalan@Sun.COM /*************************************************************************** 99*7934SMark.Phalan@Sun.COM * 100*7934SMark.Phalan@Sun.COM * Client-side preauthentication plugin interface definition. 101*7934SMark.Phalan@Sun.COM * 102*7934SMark.Phalan@Sun.COM ***************************************************************************/ 103*7934SMark.Phalan@Sun.COM 104*7934SMark.Phalan@Sun.COM /* 105*7934SMark.Phalan@Sun.COM * A callback which will obtain the user's long-term AS key by prompting the 106*7934SMark.Phalan@Sun.COM * user for the password, then salting it properly, and so on. For the moment, 107*7934SMark.Phalan@Sun.COM * it's identical to the get_as_key callback used inside of libkrb5, but we 108*7934SMark.Phalan@Sun.COM * define a new typedef here instead of making the existing one public to 109*7934SMark.Phalan@Sun.COM * isolate ourselves from potential future changes. 110*7934SMark.Phalan@Sun.COM */ 111*7934SMark.Phalan@Sun.COM typedef krb5_error_code 112*7934SMark.Phalan@Sun.COM (*preauth_get_as_key_proc)(krb5_context, 113*7934SMark.Phalan@Sun.COM krb5_principal, 114*7934SMark.Phalan@Sun.COM krb5_enctype, 115*7934SMark.Phalan@Sun.COM krb5_prompter_fct, 116*7934SMark.Phalan@Sun.COM void *prompter_data, 117*7934SMark.Phalan@Sun.COM krb5_data *salt, 118*7934SMark.Phalan@Sun.COM krb5_data *s2kparams, 119*7934SMark.Phalan@Sun.COM krb5_keyblock *as_key, 120*7934SMark.Phalan@Sun.COM void *gak_data); 121*7934SMark.Phalan@Sun.COM 122*7934SMark.Phalan@Sun.COM /* 123*7934SMark.Phalan@Sun.COM * A client module's callback functions are allowed to request various 124*7934SMark.Phalan@Sun.COM * information to enable it to process a request. 125*7934SMark.Phalan@Sun.COM */ 126*7934SMark.Phalan@Sun.COM enum krb5plugin_preauth_client_request_type { 127*7934SMark.Phalan@Sun.COM /* The returned krb5_data item holds the enctype used to encrypt the 128*7934SMark.Phalan@Sun.COM * encrypted portion of the AS_REP packet. */ 129*7934SMark.Phalan@Sun.COM krb5plugin_preauth_client_get_etype = 1, 130*7934SMark.Phalan@Sun.COM /* Free the data returned from krb5plugin_preauth_client_req_get_etype */ 131*7934SMark.Phalan@Sun.COM krb5plugin_preauth_client_free_etype = 2 132*7934SMark.Phalan@Sun.COM }; 133*7934SMark.Phalan@Sun.COM typedef krb5_error_code 134*7934SMark.Phalan@Sun.COM (*preauth_get_client_data_proc)(krb5_context, 135*7934SMark.Phalan@Sun.COM struct _krb5_preauth_client_rock *, 136*7934SMark.Phalan@Sun.COM krb5_int32 request_type, 137*7934SMark.Phalan@Sun.COM krb5_data **); 138*7934SMark.Phalan@Sun.COM 139*7934SMark.Phalan@Sun.COM /* Per-plugin initialization/cleanup. The init function is called 140*7934SMark.Phalan@Sun.COM * by libkrb5 when the plugin is loaded, and the fini function is 141*7934SMark.Phalan@Sun.COM * called before the plugin is unloaded. Both are optional and 142*7934SMark.Phalan@Sun.COM * may be called multiple times in case the plugin is used in 143*7934SMark.Phalan@Sun.COM * multiple contexts. The returned context lives the lifetime of 144*7934SMark.Phalan@Sun.COM * the krb5_context */ 145*7934SMark.Phalan@Sun.COM typedef krb5_error_code 146*7934SMark.Phalan@Sun.COM (*preauth_client_plugin_init_proc)(krb5_context context, 147*7934SMark.Phalan@Sun.COM void **plugin_context); 148*7934SMark.Phalan@Sun.COM typedef void 149*7934SMark.Phalan@Sun.COM (*preauth_client_plugin_fini_proc)(krb5_context context, 150*7934SMark.Phalan@Sun.COM void *plugin_context); 151*7934SMark.Phalan@Sun.COM 152*7934SMark.Phalan@Sun.COM /* A callback which returns flags indicating if the module is a "real" or 153*7934SMark.Phalan@Sun.COM * an "info" mechanism, and so on. This function is called for each entry 154*7934SMark.Phalan@Sun.COM * in the client_pa_type_list. */ 155*7934SMark.Phalan@Sun.COM typedef int 156*7934SMark.Phalan@Sun.COM (*preauth_client_get_flags_proc)(krb5_context context, 157*7934SMark.Phalan@Sun.COM krb5_preauthtype pa_type); 158*7934SMark.Phalan@Sun.COM 159*7934SMark.Phalan@Sun.COM /* Per-request initialization/cleanup. The request_init function is 160*7934SMark.Phalan@Sun.COM * called when beginning to process a get_init_creds request and the 161*7934SMark.Phalan@Sun.COM * request_fini function is called when processing of the request is 162*7934SMark.Phalan@Sun.COM * complete. This is optional. It may be called multiple times in 163*7934SMark.Phalan@Sun.COM * the lifetime of a krb5_context. */ 164*7934SMark.Phalan@Sun.COM typedef void 165*7934SMark.Phalan@Sun.COM (*preauth_client_request_init_proc)(krb5_context context, 166*7934SMark.Phalan@Sun.COM void *plugin_context, 167*7934SMark.Phalan@Sun.COM void **request_context); 168*7934SMark.Phalan@Sun.COM typedef void 169*7934SMark.Phalan@Sun.COM (*preauth_client_request_fini_proc)(krb5_context context, 170*7934SMark.Phalan@Sun.COM void *plugin_context, 171*7934SMark.Phalan@Sun.COM void *request_context); 172*7934SMark.Phalan@Sun.COM 173*7934SMark.Phalan@Sun.COM /* Client function which processes server-supplied data in pa_data, 174*7934SMark.Phalan@Sun.COM * returns created data in out_pa_data, storing any of its own state in 175*7934SMark.Phalan@Sun.COM * client_context if data for the associated preauthentication type is 176*7934SMark.Phalan@Sun.COM * needed. It is also called after the AS-REP is received if the AS-REP 177*7934SMark.Phalan@Sun.COM * includes preauthentication data of the associated type. 178*7934SMark.Phalan@Sun.COM * NOTE! the encoded_previous_request will be NULL the first time this 179*7934SMark.Phalan@Sun.COM * function is called, because it is expected to only ever contain the data 180*7934SMark.Phalan@Sun.COM * obtained from a previous call to this function. */ 181*7934SMark.Phalan@Sun.COM typedef krb5_error_code 182*7934SMark.Phalan@Sun.COM (*preauth_client_process_proc)(krb5_context context, 183*7934SMark.Phalan@Sun.COM void *plugin_context, 184*7934SMark.Phalan@Sun.COM void *request_context, 185*7934SMark.Phalan@Sun.COM krb5_get_init_creds_opt *opt, 186*7934SMark.Phalan@Sun.COM preauth_get_client_data_proc get_data_proc, 187*7934SMark.Phalan@Sun.COM struct _krb5_preauth_client_rock *rock, 188*7934SMark.Phalan@Sun.COM krb5_kdc_req *request, 189*7934SMark.Phalan@Sun.COM krb5_data *encoded_request_body, 190*7934SMark.Phalan@Sun.COM krb5_data *encoded_previous_request, 191*7934SMark.Phalan@Sun.COM krb5_pa_data *pa_data, 192*7934SMark.Phalan@Sun.COM krb5_prompter_fct prompter, 193*7934SMark.Phalan@Sun.COM void *prompter_data, 194*7934SMark.Phalan@Sun.COM preauth_get_as_key_proc gak_fct, 195*7934SMark.Phalan@Sun.COM void *gak_data, 196*7934SMark.Phalan@Sun.COM krb5_data *salt, 197*7934SMark.Phalan@Sun.COM krb5_data *s2kparams, 198*7934SMark.Phalan@Sun.COM krb5_keyblock *as_key, 199*7934SMark.Phalan@Sun.COM krb5_pa_data ***out_pa_data); 200*7934SMark.Phalan@Sun.COM 201*7934SMark.Phalan@Sun.COM /* Client function which can attempt to use e-data in the error response to 202*7934SMark.Phalan@Sun.COM * try to recover from the given error. If this function is not NULL, and 203*7934SMark.Phalan@Sun.COM * it stores data in out_pa_data which is different data from the contents 204*7934SMark.Phalan@Sun.COM * of in_pa_data, then the client library will retransmit the request. */ 205*7934SMark.Phalan@Sun.COM typedef krb5_error_code 206*7934SMark.Phalan@Sun.COM (*preauth_client_tryagain_proc)(krb5_context context, 207*7934SMark.Phalan@Sun.COM void *plugin_context, 208*7934SMark.Phalan@Sun.COM void *request_context, 209*7934SMark.Phalan@Sun.COM krb5_get_init_creds_opt *opt, 210*7934SMark.Phalan@Sun.COM preauth_get_client_data_proc get_data_proc, 211*7934SMark.Phalan@Sun.COM struct _krb5_preauth_client_rock *rock, 212*7934SMark.Phalan@Sun.COM krb5_kdc_req *request, 213*7934SMark.Phalan@Sun.COM krb5_data *encoded_request_body, 214*7934SMark.Phalan@Sun.COM krb5_data *encoded_previous_request, 215*7934SMark.Phalan@Sun.COM krb5_pa_data *in_pa_data, 216*7934SMark.Phalan@Sun.COM krb5_error *error, 217*7934SMark.Phalan@Sun.COM krb5_prompter_fct prompter, 218*7934SMark.Phalan@Sun.COM void *prompter_data, 219*7934SMark.Phalan@Sun.COM preauth_get_as_key_proc gak_fct, 220*7934SMark.Phalan@Sun.COM void *gak_data, 221*7934SMark.Phalan@Sun.COM krb5_data *salt, 222*7934SMark.Phalan@Sun.COM krb5_data *s2kparams, 223*7934SMark.Phalan@Sun.COM krb5_keyblock *as_key, 224*7934SMark.Phalan@Sun.COM krb5_pa_data ***out_pa_data); 225*7934SMark.Phalan@Sun.COM 226*7934SMark.Phalan@Sun.COM /* 227*7934SMark.Phalan@Sun.COM * Client function which receives krb5_get_init_creds_opt information. 228*7934SMark.Phalan@Sun.COM * The attr and value information supplied should be copied locally by 229*7934SMark.Phalan@Sun.COM * the module if it wishes to reference it after returning from this call. 230*7934SMark.Phalan@Sun.COM */ 231*7934SMark.Phalan@Sun.COM typedef krb5_error_code 232*7934SMark.Phalan@Sun.COM (*preauth_client_supply_gic_opts_proc)(krb5_context context, 233*7934SMark.Phalan@Sun.COM void *plugin_context, 234*7934SMark.Phalan@Sun.COM krb5_get_init_creds_opt *opt, 235*7934SMark.Phalan@Sun.COM const char *attr, 236*7934SMark.Phalan@Sun.COM const char *value); 237*7934SMark.Phalan@Sun.COM 238*7934SMark.Phalan@Sun.COM /* 239*7934SMark.Phalan@Sun.COM * The function table / structure which a preauth client module must export as 240*7934SMark.Phalan@Sun.COM * "preauthentication_client_0". If the interfaces work correctly, future 241*7934SMark.Phalan@Sun.COM * versions of the table will add either more callbacks or more arguments to 242*7934SMark.Phalan@Sun.COM * callbacks, and in both cases we'll be able to wrap the v0 functions. 243*7934SMark.Phalan@Sun.COM */ 244*7934SMark.Phalan@Sun.COM typedef struct krb5plugin_preauth_client_ftable_v1 { 245*7934SMark.Phalan@Sun.COM /* Not-usually-visible name. */ 246*7934SMark.Phalan@Sun.COM char *name; 247*7934SMark.Phalan@Sun.COM 248*7934SMark.Phalan@Sun.COM /* Pointer to zero-terminated list of pa_types which this module can 249*7934SMark.Phalan@Sun.COM * provide services for. */ 250*7934SMark.Phalan@Sun.COM krb5_preauthtype *pa_type_list; 251*7934SMark.Phalan@Sun.COM 252*7934SMark.Phalan@Sun.COM /* Pointer to zero-terminated list of enc_types which this module claims 253*7934SMark.Phalan@Sun.COM * to add support for. */ 254*7934SMark.Phalan@Sun.COM krb5_enctype *enctype_list; 255*7934SMark.Phalan@Sun.COM 256*7934SMark.Phalan@Sun.COM /* Per-plugin initialization/cleanup. The init function is called 257*7934SMark.Phalan@Sun.COM * by libkrb5 when the plugin is loaded, and the fini function is 258*7934SMark.Phalan@Sun.COM * called before the plugin is unloaded. Both are optional and 259*7934SMark.Phalan@Sun.COM * may be called multiple times in case the plugin is used in 260*7934SMark.Phalan@Sun.COM * multiple contexts. The returned context lives the lifetime of 261*7934SMark.Phalan@Sun.COM * the krb5_context */ 262*7934SMark.Phalan@Sun.COM preauth_client_plugin_init_proc init; 263*7934SMark.Phalan@Sun.COM preauth_client_plugin_fini_proc fini; 264*7934SMark.Phalan@Sun.COM 265*7934SMark.Phalan@Sun.COM /* A callback which returns flags indicating if the module is a "real" or 266*7934SMark.Phalan@Sun.COM * an "info" mechanism, and so on. This function is called for each entry 267*7934SMark.Phalan@Sun.COM * in the client_pa_type_list. */ 268*7934SMark.Phalan@Sun.COM preauth_client_get_flags_proc flags; 269*7934SMark.Phalan@Sun.COM 270*7934SMark.Phalan@Sun.COM /* Per-request initialization/cleanup. The request_init function is 271*7934SMark.Phalan@Sun.COM * called when beginning to process a get_init_creds request and the 272*7934SMark.Phalan@Sun.COM * request_fini function is called when processing of the request is 273*7934SMark.Phalan@Sun.COM * complete. This is optional. It may be called multiple times in 274*7934SMark.Phalan@Sun.COM * the lifetime of a krb5_context. */ 275*7934SMark.Phalan@Sun.COM preauth_client_request_init_proc request_init; 276*7934SMark.Phalan@Sun.COM preauth_client_request_fini_proc request_fini; 277*7934SMark.Phalan@Sun.COM 278*7934SMark.Phalan@Sun.COM /* Client function which processes server-supplied data in pa_data, 279*7934SMark.Phalan@Sun.COM * returns created data in out_pa_data, storing any of its own state in 280*7934SMark.Phalan@Sun.COM * client_context if data for the associated preauthentication type is 281*7934SMark.Phalan@Sun.COM * needed. It is also called after the AS-REP is received if the AS-REP 282*7934SMark.Phalan@Sun.COM * includes preauthentication data of the associated type. 283*7934SMark.Phalan@Sun.COM * NOTE! the encoded_previous_request will be NULL the first time this 284*7934SMark.Phalan@Sun.COM * function is called, because it is expected to only ever contain the data 285*7934SMark.Phalan@Sun.COM * obtained from a previous call to this function. */ 286*7934SMark.Phalan@Sun.COM preauth_client_process_proc process; 287*7934SMark.Phalan@Sun.COM 288*7934SMark.Phalan@Sun.COM /* Client function which can attempt to use e-data in the error response to 289*7934SMark.Phalan@Sun.COM * try to recover from the given error. If this function is not NULL, and 290*7934SMark.Phalan@Sun.COM * it stores data in out_pa_data which is different data from the contents 291*7934SMark.Phalan@Sun.COM * of in_pa_data, then the client library will retransmit the request. */ 292*7934SMark.Phalan@Sun.COM preauth_client_tryagain_proc tryagain; 293*7934SMark.Phalan@Sun.COM 294*7934SMark.Phalan@Sun.COM /* 295*7934SMark.Phalan@Sun.COM * Client function which receives krb5_get_init_creds_opt information. 296*7934SMark.Phalan@Sun.COM * The attr and value information supplied should be copied locally by 297*7934SMark.Phalan@Sun.COM * the module if it wishes to reference it after returning from this call. 298*7934SMark.Phalan@Sun.COM */ 299*7934SMark.Phalan@Sun.COM preauth_client_supply_gic_opts_proc gic_opts; 300*7934SMark.Phalan@Sun.COM 301*7934SMark.Phalan@Sun.COM } krb5plugin_preauth_client_ftable_v1; 302*7934SMark.Phalan@Sun.COM 303*7934SMark.Phalan@Sun.COM 304*7934SMark.Phalan@Sun.COM /*************************************************************************** 305*7934SMark.Phalan@Sun.COM * 306*7934SMark.Phalan@Sun.COM * Server-side preauthentication plugin interface definition. 307*7934SMark.Phalan@Sun.COM * 308*7934SMark.Phalan@Sun.COM ***************************************************************************/ 309*7934SMark.Phalan@Sun.COM 310*7934SMark.Phalan@Sun.COM /* 311*7934SMark.Phalan@Sun.COM * A server module's callback functions are allowed to request specific types 312*7934SMark.Phalan@Sun.COM * of information about the given client or server record or request, even 313*7934SMark.Phalan@Sun.COM * though the database records themselves are opaque to the module. 314*7934SMark.Phalan@Sun.COM */ 315*7934SMark.Phalan@Sun.COM enum krb5plugin_preauth_entry_request_type { 316*7934SMark.Phalan@Sun.COM /* The returned krb5_data item holds a DER-encoded X.509 certificate. */ 317*7934SMark.Phalan@Sun.COM krb5plugin_preauth_entry_request_certificate = 1, 318*7934SMark.Phalan@Sun.COM /* The returned krb5_data_item holds a krb5_deltat. */ 319*7934SMark.Phalan@Sun.COM krb5plugin_preauth_entry_max_time_skew = 2, 320*7934SMark.Phalan@Sun.COM /* The returned krb5_data_item holds an array of krb5_keyblock structures, 321*7934SMark.Phalan@Sun.COM * terminated by an entry with key type = 0. 322*7934SMark.Phalan@Sun.COM * Each keyblock should have its contents freed in turn, and then the data 323*7934SMark.Phalan@Sun.COM * item itself should be freed. */ 324*7934SMark.Phalan@Sun.COM krb5plugin_preauth_keys = 3, 325*7934SMark.Phalan@Sun.COM /* The returned krb5_data_item holds the request structure, re-encoded 326*7934SMark.Phalan@Sun.COM * using DER. Unless the client implementation is the same as the server 327*7934SMark.Phalan@Sun.COM * implementation, there's a good chance that the result will not match 328*7934SMark.Phalan@Sun.COM * what the client sent, so don't go creating any fatal errors if it 329*7934SMark.Phalan@Sun.COM * doesn't match up. */ 330*7934SMark.Phalan@Sun.COM krb5plugin_preauth_request_body = 4 331*7934SMark.Phalan@Sun.COM }; 332*7934SMark.Phalan@Sun.COM 333*7934SMark.Phalan@Sun.COM typedef krb5_error_code 334*7934SMark.Phalan@Sun.COM (*preauth_get_entry_data_proc)(krb5_context, 335*7934SMark.Phalan@Sun.COM krb5_kdc_req *, 336*7934SMark.Phalan@Sun.COM struct _krb5_db_entry_new *, 337*7934SMark.Phalan@Sun.COM krb5_int32 request_type, 338*7934SMark.Phalan@Sun.COM krb5_data **); 339*7934SMark.Phalan@Sun.COM 340*7934SMark.Phalan@Sun.COM /* Preauth plugin initialization function */ 341*7934SMark.Phalan@Sun.COM typedef krb5_error_code 342*7934SMark.Phalan@Sun.COM (*preauth_server_init_proc)(krb5_context context, 343*7934SMark.Phalan@Sun.COM void **plugin_context, 344*7934SMark.Phalan@Sun.COM const char** realmnames); 345*7934SMark.Phalan@Sun.COM 346*7934SMark.Phalan@Sun.COM /* Preauth plugin cleanup function */ 347*7934SMark.Phalan@Sun.COM typedef void 348*7934SMark.Phalan@Sun.COM (*preauth_server_fini_proc)(krb5_context context, void *plugin_context); 349*7934SMark.Phalan@Sun.COM 350*7934SMark.Phalan@Sun.COM /* Return the flags which the KDC should use for this module. This is a 351*7934SMark.Phalan@Sun.COM * callback instead of a static value because the module may or may not 352*7934SMark.Phalan@Sun.COM * wish to count itself as a hardware preauthentication module (in other 353*7934SMark.Phalan@Sun.COM * words, the flags may be affected by the configuration, for example if a 354*7934SMark.Phalan@Sun.COM * site administrator can force a particular preauthentication type to be 355*7934SMark.Phalan@Sun.COM * supported using only hardware). This function is called for each entry 356*7934SMark.Phalan@Sun.COM * entry in the server_pa_type_list. */ 357*7934SMark.Phalan@Sun.COM typedef int 358*7934SMark.Phalan@Sun.COM (*preauth_server_flags_proc)(krb5_context context, krb5_preauthtype patype); 359*7934SMark.Phalan@Sun.COM 360*7934SMark.Phalan@Sun.COM /* Get preauthentication data to send to the client as part of the "you 361*7934SMark.Phalan@Sun.COM * need to use preauthentication" error. The module doesn't need to 362*7934SMark.Phalan@Sun.COM * actually provide data if the protocol doesn't require it, but it should 363*7934SMark.Phalan@Sun.COM * return either zero or non-zero to control whether its padata type is 364*7934SMark.Phalan@Sun.COM * included in the list which is sent back to the client. Is not allowed 365*7934SMark.Phalan@Sun.COM * to create a context because we have no guarantee that the client will 366*7934SMark.Phalan@Sun.COM * ever call again (or that it will hit this server if it does), in which 367*7934SMark.Phalan@Sun.COM * case a context might otherwise hang around forever. */ 368*7934SMark.Phalan@Sun.COM typedef krb5_error_code 369*7934SMark.Phalan@Sun.COM (*preauth_server_edata_proc)(krb5_context, 370*7934SMark.Phalan@Sun.COM krb5_kdc_req *request, 371*7934SMark.Phalan@Sun.COM struct _krb5_db_entry_new *client, 372*7934SMark.Phalan@Sun.COM struct _krb5_db_entry_new *server, 373*7934SMark.Phalan@Sun.COM preauth_get_entry_data_proc, 374*7934SMark.Phalan@Sun.COM void *pa_module_context, 375*7934SMark.Phalan@Sun.COM krb5_pa_data *data); 376*7934SMark.Phalan@Sun.COM 377*7934SMark.Phalan@Sun.COM /* Verify preauthentication data sent by the client, setting the 378*7934SMark.Phalan@Sun.COM * TKT_FLG_PRE_AUTH or TKT_FLG_HW_AUTH flag in the enc_tkt_reply's "flags" 379*7934SMark.Phalan@Sun.COM * field as appropriate, and returning nonzero on failure. Can create 380*7934SMark.Phalan@Sun.COM * context data for consumption by the return_proc or freepa_proc below. */ 381*7934SMark.Phalan@Sun.COM typedef krb5_error_code 382*7934SMark.Phalan@Sun.COM (*preauth_server_verify_proc)(krb5_context context, 383*7934SMark.Phalan@Sun.COM struct _krb5_db_entry_new *client, 384*7934SMark.Phalan@Sun.COM krb5_data *req_pkt, 385*7934SMark.Phalan@Sun.COM krb5_kdc_req *request, 386*7934SMark.Phalan@Sun.COM krb5_enc_tkt_part *enc_tkt_reply, 387*7934SMark.Phalan@Sun.COM krb5_pa_data *data, 388*7934SMark.Phalan@Sun.COM preauth_get_entry_data_proc, 389*7934SMark.Phalan@Sun.COM void *pa_module_context, 390*7934SMark.Phalan@Sun.COM void **pa_request_context, 391*7934SMark.Phalan@Sun.COM krb5_data **e_data, 392*7934SMark.Phalan@Sun.COM krb5_authdata ***authz_data); 393*7934SMark.Phalan@Sun.COM 394*7934SMark.Phalan@Sun.COM /* Generate preauthentication response data to send to the client as part 395*7934SMark.Phalan@Sun.COM * of the AS-REP. If it needs to override the key which is used to encrypt 396*7934SMark.Phalan@Sun.COM * the response, it can do so. The module is expected (but not required, 397*7934SMark.Phalan@Sun.COM * if a preauth_server_free_reqcontext_proc is also provided) to free any 398*7934SMark.Phalan@Sun.COM * context data it saved in "pa_request_context". */ 399*7934SMark.Phalan@Sun.COM typedef krb5_error_code 400*7934SMark.Phalan@Sun.COM (*preauth_server_return_proc)(krb5_context context, 401*7934SMark.Phalan@Sun.COM krb5_pa_data * padata, 402*7934SMark.Phalan@Sun.COM struct _krb5_db_entry_new *client, 403*7934SMark.Phalan@Sun.COM krb5_data *req_pkt, 404*7934SMark.Phalan@Sun.COM krb5_kdc_req *request, 405*7934SMark.Phalan@Sun.COM krb5_kdc_rep *reply, 406*7934SMark.Phalan@Sun.COM struct _krb5_key_data *client_keys, 407*7934SMark.Phalan@Sun.COM krb5_keyblock *encrypting_key, 408*7934SMark.Phalan@Sun.COM krb5_pa_data **send_pa, 409*7934SMark.Phalan@Sun.COM preauth_get_entry_data_proc, 410*7934SMark.Phalan@Sun.COM void *pa_module_context, 411*7934SMark.Phalan@Sun.COM void **pa_request_context); 412*7934SMark.Phalan@Sun.COM 413*7934SMark.Phalan@Sun.COM /* Free up the server-side per-request context, in cases where 414*7934SMark.Phalan@Sun.COM * server_return_proc() didn't or for whatever reason was not called. 415*7934SMark.Phalan@Sun.COM * Can be NULL. */ 416*7934SMark.Phalan@Sun.COM typedef krb5_error_code 417*7934SMark.Phalan@Sun.COM (*preauth_server_free_reqcontext_proc)(krb5_context, 418*7934SMark.Phalan@Sun.COM void *pa_module_context, 419*7934SMark.Phalan@Sun.COM void **request_pa_context); 420*7934SMark.Phalan@Sun.COM 421*7934SMark.Phalan@Sun.COM /* 422*7934SMark.Phalan@Sun.COM * The function table / structure which a preauth server module must export as 423*7934SMark.Phalan@Sun.COM * "preauthentication_server_0". NOTE: replace "0" with "1" for the type and 424*7934SMark.Phalan@Sun.COM * variable names if this gets picked up by upstream. If the interfaces work 425*7934SMark.Phalan@Sun.COM * correctly, future versions of the table will add either more callbacks or 426*7934SMark.Phalan@Sun.COM * more arguments to callbacks, and in both cases we'll be able to wrap the v0 427*7934SMark.Phalan@Sun.COM * functions. 428*7934SMark.Phalan@Sun.COM */ 429*7934SMark.Phalan@Sun.COM typedef struct krb5plugin_preauth_server_ftable_v1 { 430*7934SMark.Phalan@Sun.COM /* Not-usually-visible name. */ 431*7934SMark.Phalan@Sun.COM char *name; 432*7934SMark.Phalan@Sun.COM 433*7934SMark.Phalan@Sun.COM /* Pointer to zero-terminated list of pa_types which this module can 434*7934SMark.Phalan@Sun.COM * provide services for. */ 435*7934SMark.Phalan@Sun.COM krb5_preauthtype *pa_type_list; 436*7934SMark.Phalan@Sun.COM 437*7934SMark.Phalan@Sun.COM /* Per-plugin initialization/cleanup. The init function is called by the 438*7934SMark.Phalan@Sun.COM * KDC when the plugin is loaded, and the fini function is called before 439*7934SMark.Phalan@Sun.COM * the plugin is unloaded. Both are optional. */ 440*7934SMark.Phalan@Sun.COM preauth_server_init_proc init_proc; 441*7934SMark.Phalan@Sun.COM preauth_server_fini_proc fini_proc; 442*7934SMark.Phalan@Sun.COM 443*7934SMark.Phalan@Sun.COM /* Return the flags which the KDC should use for this module. This is a 444*7934SMark.Phalan@Sun.COM * callback instead of a static value because the module may or may not 445*7934SMark.Phalan@Sun.COM * wish to count itself as a hardware preauthentication module (in other 446*7934SMark.Phalan@Sun.COM * words, the flags may be affected by the configuration, for example if a 447*7934SMark.Phalan@Sun.COM * site administrator can force a particular preauthentication type to be 448*7934SMark.Phalan@Sun.COM * supported using only hardware). This function is called for each entry 449*7934SMark.Phalan@Sun.COM * entry in the server_pa_type_list. */ 450*7934SMark.Phalan@Sun.COM preauth_server_flags_proc flags_proc; 451*7934SMark.Phalan@Sun.COM 452*7934SMark.Phalan@Sun.COM /* Get preauthentication data to send to the client as part of the "you 453*7934SMark.Phalan@Sun.COM * need to use preauthentication" error. The module doesn't need to 454*7934SMark.Phalan@Sun.COM * actually provide data if the protocol doesn't require it, but it should 455*7934SMark.Phalan@Sun.COM * return either zero or non-zero to control whether its padata type is 456*7934SMark.Phalan@Sun.COM * included in the list which is sent back to the client. Is not allowed 457*7934SMark.Phalan@Sun.COM * to create a context because we have no guarantee that the client will 458*7934SMark.Phalan@Sun.COM * ever call again (or that it will hit this server if it does), in which 459*7934SMark.Phalan@Sun.COM * case a context might otherwise hang around forever. */ 460*7934SMark.Phalan@Sun.COM preauth_server_edata_proc edata_proc; 461*7934SMark.Phalan@Sun.COM 462*7934SMark.Phalan@Sun.COM /* Verify preauthentication data sent by the client, setting the 463*7934SMark.Phalan@Sun.COM * TKT_FLG_PRE_AUTH or TKT_FLG_HW_AUTH flag in the enc_tkt_reply's "flags" 464*7934SMark.Phalan@Sun.COM * field as appropriate, and returning nonzero on failure. Can create 465*7934SMark.Phalan@Sun.COM * context data for consumption by the return_proc or freepa_proc below. */ 466*7934SMark.Phalan@Sun.COM preauth_server_verify_proc verify_proc; 467*7934SMark.Phalan@Sun.COM 468*7934SMark.Phalan@Sun.COM /* Generate preauthentication response data to send to the client as part 469*7934SMark.Phalan@Sun.COM * of the AS-REP. If it needs to override the key which is used to encrypt 470*7934SMark.Phalan@Sun.COM * the response, it can do so. The module is expected (but not required, 471*7934SMark.Phalan@Sun.COM * if a freepa_proc is also provided) to free any context data it saved in 472*7934SMark.Phalan@Sun.COM * "request_pa_context". */ 473*7934SMark.Phalan@Sun.COM preauth_server_return_proc return_proc; 474*7934SMark.Phalan@Sun.COM 475*7934SMark.Phalan@Sun.COM /* Free up the server-side per-request context, in cases where 476*7934SMark.Phalan@Sun.COM * server_return_proc() didn't or for whatever reason was not called. 477*7934SMark.Phalan@Sun.COM * Can be NULL. */ 478*7934SMark.Phalan@Sun.COM preauth_server_free_reqcontext_proc freepa_reqcontext_proc; 479*7934SMark.Phalan@Sun.COM 480*7934SMark.Phalan@Sun.COM } krb5plugin_preauth_server_ftable_v1; 481*7934SMark.Phalan@Sun.COM 482*7934SMark.Phalan@Sun.COM 483*7934SMark.Phalan@Sun.COM /* 484*7934SMark.Phalan@Sun.COM * This function allows a preauth plugin to obtain preauth 485*7934SMark.Phalan@Sun.COM * options. The preauth_data returned from this function 486*7934SMark.Phalan@Sun.COM * should be freed by calling krb5_get_init_creds_opt_free_pa(). 487*7934SMark.Phalan@Sun.COM * 488*7934SMark.Phalan@Sun.COM * The 'opt' pointer supplied to this function must have been 489*7934SMark.Phalan@Sun.COM * obtained using krb5_get_init_creds_opt_alloc() 490*7934SMark.Phalan@Sun.COM */ 491*7934SMark.Phalan@Sun.COM krb5_error_code KRB5_CALLCONV 492*7934SMark.Phalan@Sun.COM krb5_get_init_creds_opt_get_pa 493*7934SMark.Phalan@Sun.COM (krb5_context context, 494*7934SMark.Phalan@Sun.COM krb5_get_init_creds_opt *opt, 495*7934SMark.Phalan@Sun.COM int *num_preauth_data, 496*7934SMark.Phalan@Sun.COM krb5_gic_opt_pa_data **preauth_data); 497*7934SMark.Phalan@Sun.COM 498*7934SMark.Phalan@Sun.COM /* 499*7934SMark.Phalan@Sun.COM * This function frees the preauth_data that was returned by 500*7934SMark.Phalan@Sun.COM * krb5_get_init_creds_opt_get_pa(). 501*7934SMark.Phalan@Sun.COM */ 502*7934SMark.Phalan@Sun.COM void KRB5_CALLCONV 503*7934SMark.Phalan@Sun.COM krb5_get_init_creds_opt_free_pa 504*7934SMark.Phalan@Sun.COM (krb5_context context, 505*7934SMark.Phalan@Sun.COM int num_preauth_data, 506*7934SMark.Phalan@Sun.COM krb5_gic_opt_pa_data *preauth_data); 507*7934SMark.Phalan@Sun.COM 508*7934SMark.Phalan@Sun.COM #endif /* KRB5_PREAUTH_PLUGIN_H_INCLUDED */ 509