173 lines
5.7 KiB
Diff
173 lines
5.7 KiB
Diff
diff -up openssh-6.6p1/auth-krb5.c.kuserok openssh-6.6p1/auth-krb5.c
|
|
--- openssh-6.6p1/auth-krb5.c.kuserok 2013-10-24 01:53:02.000000000 +0200
|
|
+++ openssh-6.6p1/auth-krb5.c 2014-05-07 10:42:00.883534478 +0200
|
|
@@ -54,6 +54,20 @@
|
|
|
|
extern ServerOptions options;
|
|
|
|
+int
|
|
+ssh_krb5_kuserok(krb5_context krb5_ctx, krb5_principal krb5_user, const char *client)
|
|
+{
|
|
+ if (options.use_kuserok)
|
|
+ return krb5_kuserok(krb5_ctx, krb5_user, client);
|
|
+ else {
|
|
+ char kuser[65];
|
|
+
|
|
+ if (krb5_aname_to_localname(krb5_ctx, krb5_user, sizeof(kuser), kuser))
|
|
+ return 0;
|
|
+ return strcmp(kuser, client) == 0;
|
|
+ }
|
|
+}
|
|
+
|
|
static int
|
|
krb5_init(void *context)
|
|
{
|
|
@@ -157,8 +171,7 @@ auth_krb5_password(Authctxt *authctxt, c
|
|
if (problem)
|
|
goto out;
|
|
|
|
- if (!krb5_kuserok(authctxt->krb5_ctx, authctxt->krb5_user,
|
|
- authctxt->pw->pw_name)) {
|
|
+ if (!ssh_krb5_kuserok(authctxt->krb5_ctx, authctxt->krb5_user, authctxt->pw->pw_name)) {
|
|
problem = -1;
|
|
goto out;
|
|
}
|
|
diff -up openssh-6.6p1/gss-serv-krb5.c.kuserok openssh-6.6p1/gss-serv-krb5.c
|
|
--- openssh-6.6p1/gss-serv-krb5.c.kuserok 2014-05-07 10:35:30.792053846 +0200
|
|
+++ openssh-6.6p1/gss-serv-krb5.c 2014-05-07 10:35:30.801053812 +0200
|
|
@@ -67,6 +67,7 @@ static int ssh_gssapi_krb5_cmdok(krb5_pr
|
|
int);
|
|
|
|
static krb5_context krb_context = NULL;
|
|
+extern int ssh_krb5_kuserok(krb5_context, krb5_principal, const char *);
|
|
|
|
/* Initialise the krb5 library, for the stuff that GSSAPI won't do */
|
|
|
|
@@ -116,7 +117,7 @@ ssh_gssapi_krb5_userok(ssh_gssapi_client
|
|
/* NOTE: .k5login and .k5users must opened as root, not the user,
|
|
* because if they are on a krb5-protected filesystem, user credentials
|
|
* to access these files aren't available yet. */
|
|
- if (krb5_kuserok(krb_context, princ, name) && k5login_exists) {
|
|
+ if (ssh_krb5_kuserok(krb_context, princ, name) && k5login_exists) {
|
|
retval = 1;
|
|
logit("Authorized to %s, krb5 principal %s (krb5_kuserok)",
|
|
name, (char *)client->displayname.value);
|
|
diff --git a/servconf.c b/servconf.c
|
|
index 68fb9ef..904c869 100644
|
|
--- a/servconf.c
|
|
+++ b/servconf.c
|
|
@@ -157,6 +157,7 @@ initialize_server_options(ServerOptions *options)
|
|
options->ip_qos_interactive = -1;
|
|
options->ip_qos_bulk = -1;
|
|
options->version_addendum = NULL;
|
|
+ options->use_kuserok = -1;
|
|
}
|
|
|
|
void
|
|
@@ -312,6 +313,8 @@ fill_default_server_options(ServerOptions *options)
|
|
options->version_addendum = xstrdup("");
|
|
if (options->show_patchlevel == -1)
|
|
options->show_patchlevel = 0;
|
|
+ if (options->use_kuserok == -1)
|
|
+ options->use_kuserok = 1;
|
|
|
|
/* Turn privilege separation on by default */
|
|
if (use_privsep == -1)
|
|
@@ -338,7 +341,7 @@ typedef enum {
|
|
sPermitRootLogin, sLogFacility, sLogLevel,
|
|
sRhostsRSAAuthentication, sRSAAuthentication,
|
|
sKerberosAuthentication, sKerberosOrLocalPasswd, sKerberosTicketCleanup,
|
|
- sKerberosGetAFSToken,
|
|
+ sKerberosGetAFSToken, sKerberosUseKuserok,
|
|
sKerberosTgtPassing, sChallengeResponseAuthentication,
|
|
sPasswordAuthentication, sKbdInteractiveAuthentication,
|
|
sListenAddress, sAddressFamily,
|
|
@@ -410,11 +413,13 @@ static struct {
|
|
#else
|
|
{ "kerberosgetafstoken", sUnsupported, SSHCFG_GLOBAL },
|
|
#endif
|
|
+ { "kerberosusekuserok", sKerberosUseKuserok, SSHCFG_ALL },
|
|
#else
|
|
{ "kerberosauthentication", sUnsupported, SSHCFG_ALL },
|
|
{ "kerberosorlocalpasswd", sUnsupported, SSHCFG_GLOBAL },
|
|
{ "kerberosticketcleanup", sUnsupported, SSHCFG_GLOBAL },
|
|
{ "kerberosgetafstoken", sUnsupported, SSHCFG_GLOBAL },
|
|
+ { "kerberosusekuserok", sUnsupported, SSHCFG_ALL },
|
|
#endif
|
|
{ "kerberostgtpassing", sUnsupported, SSHCFG_GLOBAL },
|
|
{ "afstokenpassing", sUnsupported, SSHCFG_GLOBAL },
|
|
@@ -1526,6 +1531,10 @@ process_server_config_line(ServerOptions *options, char *line,
|
|
*activep = value;
|
|
break;
|
|
|
|
+ case sKerberosUseKuserok:
|
|
+ intptr = &options->use_kuserok;
|
|
+ goto parse_flag;
|
|
+
|
|
case sPermitOpen:
|
|
arg = strdelim(&cp);
|
|
if (!arg || *arg == '\0')
|
|
@@ -1811,6 +1820,7 @@ copy_set_server_options(ServerOptions *dst, ServerOptions *src, int preauth)
|
|
M_CP_INTOPT(max_authtries);
|
|
M_CP_INTOPT(ip_qos_interactive);
|
|
M_CP_INTOPT(ip_qos_bulk);
|
|
+ M_CP_INTOPT(use_kuserok);
|
|
M_CP_INTOPT(rekey_limit);
|
|
M_CP_INTOPT(rekey_interval);
|
|
|
|
@@ -2062,6 +2072,7 @@ dump_config(ServerOptions *o)
|
|
dump_cfg_fmtint(sUseDNS, o->use_dns);
|
|
dump_cfg_fmtint(sAllowTcpForwarding, o->allow_tcp_forwarding);
|
|
dump_cfg_fmtint(sUsePrivilegeSeparation, use_privsep);
|
|
+ dump_cfg_fmtint(sKerberosUseKuserok, o->use_kuserok);
|
|
|
|
/* string arguments */
|
|
dump_cfg_string(sPidFile, o->pid_file);
|
|
diff --git a/servconf.h b/servconf.h
|
|
index 37cfa9b..5117dfa 100644
|
|
--- a/servconf.h
|
|
+++ b/servconf.h
|
|
@@ -173,6 +173,7 @@ typedef struct {
|
|
|
|
int num_permitted_opens;
|
|
|
|
+ int use_kuserok;
|
|
char *chroot_directory;
|
|
char *revoked_keys_file;
|
|
char *trusted_user_ca_keys;
|
|
diff --git a/sshd_config b/sshd_config
|
|
index adfd7b1..e772ed5 100644
|
|
--- a/sshd_config
|
|
+++ b/sshd_config
|
|
@@ -87,6 +87,7 @@ ChallengeResponseAuthentication no
|
|
#KerberosOrLocalPasswd yes
|
|
#KerberosTicketCleanup yes
|
|
#KerberosGetAFSToken no
|
|
+#KerberosUseKuserok yes
|
|
|
|
# GSSAPI options
|
|
GSSAPIAuthentication yes
|
|
diff --git a/sshd_config.5 b/sshd_config.5
|
|
index 1fb002d..e0e5fff 100644
|
|
--- a/sshd_config.5
|
|
+++ b/sshd_config.5
|
|
@@ -697,6 +697,10 @@ Specifies whether to automatically destroy the user's ticket cache
|
|
file on logout.
|
|
The default is
|
|
.Dq yes .
|
|
+.It Cm KerberosUseKuserok
|
|
+Specifies whether to look at .k5login file for user's aliases.
|
|
+The default is
|
|
+.Dq yes .
|
|
.It Cm KexAlgorithms
|
|
Specifies the available KEX (Key Exchange) algorithms.
|
|
Multiple algorithms must be comma-separated.
|
|
@@ -862,6 +866,7 @@ Available keywords are
|
|
.Cm HostbasedUsesNameFromPacketOnly ,
|
|
.Cm KbdInteractiveAuthentication ,
|
|
.Cm KerberosAuthentication ,
|
|
+.Cm KerberosUseKuserok ,
|
|
.Cm MaxAuthTries ,
|
|
.Cm MaxSessions ,
|
|
.Cm PasswordAuthentication ,
|