gssapi: support for client keytab in gss_acquire_cred (#383)
For compatibility with MIT Kerberos, support automatic acquisition of initiator credentials if a client keytab is available. The default path on non-Windows is /var/heimdal/user/%{euid}/client.keytab, but can be overriden with the KRB5_CLIENT_KTNAME environment variable or the default_client_keytab_name configuration option. If a client keytab does not exist, or exists but does not contain the principal for which initiator credentials are being acquired, the system keytab is tried.
This commit is contained in:
@@ -949,3 +949,19 @@ krb5_kt_have_content(krb5_context context,
|
||||
}
|
||||
return KRB5_KT_NOTFOUND;
|
||||
}
|
||||
|
||||
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
|
||||
_krb5_kt_client_default_name(krb5_context context, char **name)
|
||||
{
|
||||
const char *tmp;
|
||||
|
||||
tmp = secure_getenv("KRB5_CLIENT_KTNAME");
|
||||
if (tmp == NULL)
|
||||
tmp = krb5_config_get_string(context, NULL,
|
||||
"libdefaults",
|
||||
"default_client_keytab_name", NULL);
|
||||
if (tmp == NULL)
|
||||
tmp = CLIENT_KEYTAB_DEFAULT;
|
||||
|
||||
return _krb5_expand_path_tokens(context, tmp, 1, name);
|
||||
}
|
||||
|
@@ -171,6 +171,9 @@ struct _krb5_krb_auth_data;
|
||||
#define KEYTAB_DEFAULT "FILE:" SYSCONFDIR "/krb5.keytab"
|
||||
#define KEYTAB_DEFAULT_MODIFY "FILE:" SYSCONFDIR "/krb5.keytab"
|
||||
|
||||
#ifndef CLIENT_KEYTAB_DEFAULT
|
||||
#define CLIENT_KEYTAB_DEFAULT "FILE:" LOCALSTATEDIR "/user/%{euid}/client.keytab";
|
||||
#endif
|
||||
|
||||
#define MODULI_FILE SYSCONFDIR "/krb5.moduli"
|
||||
|
||||
|
@@ -753,6 +753,7 @@ EXPORTS
|
||||
_krb5_crc_update
|
||||
_krb5_get_krbtgt
|
||||
_krb5_build_authenticator
|
||||
_krb5_kt_client_default_name
|
||||
|
||||
; Shared with libkdc
|
||||
_krb5_AES_SHA1_string_to_default_iterator
|
||||
|
@@ -404,6 +404,7 @@ struct entry libdefaults_entries[] = {
|
||||
{ "date_format", krb5_config_string, NULL, 0 },
|
||||
{ "default_as_etypes", krb5_config_string, NULL, 0 },
|
||||
{ "default_ccache_name", krb5_config_string, NULL, 0 },
|
||||
{ "default_client_keytab_name", krb5_config_string, NULL, 0 },
|
||||
{ "default_cc_name", krb5_config_string, NULL, 0 },
|
||||
{ "default_cc_type", krb5_config_string, NULL, 0 },
|
||||
{ "default_etypes", krb5_config_string, NULL, 0 },
|
||||
|
@@ -745,6 +745,7 @@ HEIMDAL_KRB5_2.0 {
|
||||
_krb5_crc_update;
|
||||
_krb5_get_krbtgt;
|
||||
_krb5_build_authenticator;
|
||||
_krb5_kt_client_default_name;
|
||||
|
||||
# Shared with libkdc
|
||||
_krb5_AES_SHA1_string_to_default_iterator;
|
||||
|
Reference in New Issue
Block a user