|
|
b58e57 |
diff --git a/auth-krb5.c b/auth-krb5.c
|
|
|
b58e57 |
index 2b02a04..19b9364 100644
|
|
|
b58e57 |
--- a/auth-krb5.c
|
|
|
b58e57 |
+++ b/auth-krb5.c
|
|
|
b58e57 |
@@ -375,6 +375,22 @@ cleanup:
|
|
|
b58e57 |
return -1;
|
|
|
b58e57 |
}
|
|
|
b58e57 |
|
|
|
b58e57 |
+/*
|
|
|
b58e57 |
+ * Reads k5login_directory option from the krb5.conf
|
|
|
b58e57 |
+ */
|
|
|
b58e57 |
+krb5_error_code
|
|
|
b58e57 |
+ssh_krb5_get_k5login_directory(krb5_context ctx, char **k5login_directory) {
|
|
|
b58e57 |
+ profile_t p;
|
|
|
b58e57 |
+ int ret = 0;
|
|
|
b58e57 |
+
|
|
|
b58e57 |
+ ret = krb5_get_profile(ctx, &p);
|
|
|
b58e57 |
+ if (ret)
|
|
|
b58e57 |
+ return ret;
|
|
|
b58e57 |
+
|
|
|
b58e57 |
+ return profile_get_string(p, "libdefaults", "k5login_directory", NULL, NULL,
|
|
|
b58e57 |
+ k5login_directory);
|
|
|
b58e57 |
+}
|
|
|
b58e57 |
+
|
|
|
b58e57 |
krb5_error_code
|
|
|
b58e57 |
ssh_krb5_get_cctemplate(krb5_context ctx, char **ccname) {
|
|
|
b58e57 |
profile_t p;
|
|
|
b58e57 |
diff --git a/auth.h b/auth.h
|
|
|
b58e57 |
index f9d191c..c432d2f 100644
|
|
|
b58e57 |
--- a/auth.h
|
|
|
b58e57 |
+++ b/auth.h
|
|
|
b58e57 |
@@ -222,5 +222,7 @@ int sys_auth_passwd(Authctxt *, const char *);
|
|
|
b58e57 |
#if defined(KRB5) && !defined(HEIMDAL)
|
|
|
b58e57 |
#include <krb5.h>
|
|
|
b58e57 |
krb5_error_code ssh_krb5_cc_gen(krb5_context, krb5_ccache *);
|
|
|
b58e57 |
+krb5_error_code ssh_krb5_get_k5login_directory(krb5_context ctx,
|
|
|
b58e57 |
+ char **k5login_directory);
|
|
|
b58e57 |
#endif
|
|
|
b58e57 |
#endif
|
|
|
b58e57 |
diff --git a/gss-serv-krb5.c b/gss-serv-krb5.c
|
|
|
b58e57 |
index a7c0c5f..df8cc9a 100644
|
|
|
b58e57 |
--- a/gss-serv-krb5.c
|
|
|
b58e57 |
+++ b/gss-serv-krb5.c
|
|
|
b58e57 |
@@ -244,8 +244,27 @@ ssh_gssapi_k5login_exists()
|
|
|
b58e57 |
{
|
|
|
b58e57 |
char file[MAXPATHLEN];
|
|
|
b58e57 |
struct passwd *pw = the_authctxt->pw;
|
|
|
b58e57 |
+ char *k5login_directory = NULL;
|
|
|
b58e57 |
+ int ret = 0;
|
|
|
b58e57 |
+
|
|
|
b58e57 |
+ ret = ssh_krb5_get_k5login_directory(krb_context, &k5login_directory);
|
|
|
b58e57 |
+ debug3("%s: k5login_directory = %s (rv=%d)", __func__, k5login_directory, ret);
|
|
|
b58e57 |
+ if (k5login_directory == NULL || ret != 0) {
|
|
|
b58e57 |
+ /* If not set, the library will look for k5login
|
|
|
b58e57 |
+ * files in the user's home directory, with the filename .k5login.
|
|
|
b58e57 |
+ */
|
|
|
b58e57 |
+ snprintf(file, sizeof(file), "%s/.k5login", pw->pw_dir);
|
|
|
b58e57 |
+ } else {
|
|
|
b58e57 |
+ /* If set, the library will look for a local user's k5login file
|
|
|
b58e57 |
+ * within the named directory, with a filename corresponding to the
|
|
|
b58e57 |
+ * local username.
|
|
|
b58e57 |
+ */
|
|
|
b58e57 |
+ snprintf(file, sizeof(file), "%s%s%s", k5login_directory,
|
|
|
b58e57 |
+ k5login_directory[strlen(k5login_directory)-1] != '/' ? "/" : "",
|
|
|
b58e57 |
+ pw->pw_name);
|
|
|
b58e57 |
+ }
|
|
|
b58e57 |
+ debug("%s: Checking existence of file %s", __func__, file);
|
|
|
b58e57 |
|
|
|
b58e57 |
- snprintf(file, sizeof(file), "%s/.k5login", pw->pw_dir);
|
|
|
b58e57 |
return access(file, F_OK) == 0;
|
|
|
b58e57 |
}
|
|
|
b58e57 |
|
|
|
b58e57 |
diff --git a/sshd.8 b/sshd.8
|
|
|
b58e57 |
index 5c4f15b..135e290 100644
|
|
|
b58e57 |
--- a/sshd.8
|
|
|
b58e57 |
+++ b/sshd.8
|
|
|
b58e57 |
@@ -806,6 +806,10 @@ rlogin/rsh.
|
|
|
b58e57 |
These files enforce GSSAPI/Kerberos authentication access control.
|
|
|
b58e57 |
Further details are described in
|
|
|
b58e57 |
.Xr ksu 1 .
|
|
|
b58e57 |
+The location of the k5login file depends on the configuration option
|
|
|
b58e57 |
+.Cm k5login_directory
|
|
|
b58e57 |
+in the
|
|
|
b58e57 |
+.Xr krb5.conf 5 .
|
|
|
b58e57 |
.Pp
|
|
|
b58e57 |
.It Pa ~/.ssh/
|
|
|
b58e57 |
This directory is the default location for all user-specific configuration
|