@@ -346,6 +346,47 @@ static const char *mag_use_sess(cmd_parms *parms, void *mconfig, int on)
346346 return NULL ;
347347}
348348
349+ static const char * mag_sess_key (cmd_parms * parms , void * mconfig , const char * w )
350+ {
351+ struct mag_config * cfg = (struct mag_config * )mconfig ;
352+ struct databuf keys ;
353+ unsigned char * val ;
354+ apr_status_t rc ;
355+ const char * k ;
356+ int l ;
357+
358+ if (strncmp (w , "key:" , 4 ) != 0 ) {
359+ ap_log_error (APLOG_MARK , APLOG_ERR |APLOG_NOERRNO , 0 , parms -> server ,
360+ "Invalid key format, expected prefix 'key:'" );
361+ return NULL ;
362+ }
363+ k = w + 4 ;
364+
365+ l = apr_base64_decode_len (k );
366+ val = apr_palloc (parms -> temp_pool , l );
367+ if (!val ) {
368+ ap_log_error (APLOG_MARK , APLOG_ERR |APLOG_NOERRNO , 0 , parms -> server ,
369+ "Failed to get memory to decode key" );
370+ return NULL ;
371+ }
372+
373+ keys .length = (int )apr_base64_decode_binary (val , k );
374+ keys .value = (unsigned char * )val ;
375+
376+ if (keys .length != 32 ) {
377+ ap_log_error (APLOG_MARK , APLOG_ERR |APLOG_NOERRNO , 0 , parms -> server ,
378+ "Invalid key lenght, expected 32 got %d" , keys .length );
379+ return NULL ;
380+ }
381+
382+ rc = SEAL_KEY_CREATE (cfg -> pool , & cfg -> mag_skey , & keys );
383+ if (rc != OK ) {
384+ ap_log_error (APLOG_MARK , APLOG_ERR |APLOG_NOERRNO , 0 , parms -> server ,
385+ "Failed to import sealing key!" );
386+ }
387+ return NULL ;
388+ }
389+
349390static const char * mag_cred_store (cmd_parms * parms , void * mconfig ,
350391 const char * w )
351392{
@@ -401,6 +442,8 @@ static const command_rec mag_commands[] = {
401442 "Authentication is bound to the TCP connection" ),
402443 AP_INIT_FLAG ("GssapiUseSessions" , mag_use_sess , NULL , OR_AUTHCFG ,
403444 "Authentication uses mod_sessions to hold status" ),
445+ AP_INIT_RAW_ARGS ("GssapiSessionKey" , mag_sess_key , NULL , OR_AUTHCFG ,
446+ "Key Used to seal session data." ),
404447 AP_INIT_ITERATE ("GssapiCredStore" , mag_cred_store , NULL , OR_AUTHCFG ,
405448 "Credential Store" ),
406449 { NULL }
0 commit comments