179 lines
6.1 KiB
Diff
179 lines
6.1 KiB
Diff
diff -up openssh-5.6p1/auth-krb5.c.kuserok openssh-5.6p1/auth-krb5.c
|
|
--- openssh-5.6p1/auth-krb5.c.kuserok 2010-09-15 15:39:48.000000000 +0200
|
|
+++ openssh-5.6p1/auth-krb5.c 2010-09-15 15:39:48.000000000 +0200
|
|
@@ -146,9 +146,21 @@ auth_krb5_password(Authctxt *authctxt, c
|
|
if (problem)
|
|
goto out;
|
|
|
|
- if (!krb5_kuserok(authctxt->krb5_ctx, authctxt->krb5_user, client)) {
|
|
- problem = -1;
|
|
- goto out;
|
|
+ if (options.use_kuserok) {
|
|
+ if (!krb5_kuserok(authctxt->krb5_ctx, authctxt->krb5_user, client)) {
|
|
+ problem = -1;
|
|
+ goto out;
|
|
+ }
|
|
+ } else {
|
|
+ char kuser[65];
|
|
+ if (krb5_aname_to_localname(authctxt->krb5_ctx, authctxt->krb5_user, sizeof(kuser), kuser)) {
|
|
+ problem = -1;
|
|
+ goto out;
|
|
+ }
|
|
+ if (strcmp(kuser, client)) {
|
|
+ problem = -1;
|
|
+ goto out;
|
|
+ }
|
|
}
|
|
|
|
problem = ssh_krb5_cc_gen(authctxt->krb5_ctx, &authctxt->krb5_fwd_ccache);
|
|
diff -up openssh-5.6p1/gss-serv-krb5.c.kuserok openssh-5.6p1/gss-serv-krb5.c
|
|
--- openssh-5.6p1/gss-serv-krb5.c.kuserok 2010-09-15 15:39:48.000000000 +0200
|
|
+++ openssh-5.6p1/gss-serv-krb5.c 2010-09-15 15:49:43.000000000 +0200
|
|
@@ -97,13 +97,25 @@ ssh_gssapi_krb5_userok(ssh_gssapi_client
|
|
krb5_get_err_text(krb_context, retval));
|
|
return 0;
|
|
}
|
|
- if (krb5_kuserok(krb_context, princ, name)) {
|
|
- retval = 1;
|
|
- logit("Authorized to %s, krb5 principal %s (krb5_kuserok)",
|
|
- name, (char *)client->displayname.value);
|
|
- } else
|
|
- retval = 0;
|
|
-
|
|
+ if (options.use_kuserok) {
|
|
+ if (krb5_kuserok(krb_context, princ, name)) {
|
|
+ retval = 1;
|
|
+ logit("Authorized to %s, krb5 principal %s (krb5_kuserok)",
|
|
+ name, (char *)client->displayname.value);
|
|
+ } else
|
|
+ retval = 0;
|
|
+ } else {
|
|
+ char kuser[65];
|
|
+ if (krb5_aname_to_localname(krb_context, princ, sizeof(kuser), kuser))
|
|
+ retval = 0;
|
|
+ else if (strcmp(kuser, client))
|
|
+ retval = 0;
|
|
+ else {
|
|
+ retval = 1;
|
|
+ logit("Authorized to %s, krb5 principal %s (krb5)",
|
|
+ name, (char *)client->displayname.value);
|
|
+ }
|
|
+ }
|
|
krb5_free_principal(krb_context, princ);
|
|
return retval;
|
|
}
|
|
diff -up openssh-5.6p1/servconf.c.kuserok openssh-5.6p1/servconf.c
|
|
--- openssh-5.6p1/servconf.c.kuserok 2010-09-15 15:39:48.000000000 +0200
|
|
+++ openssh-5.6p1/servconf.c 2010-09-15 15:39:48.000000000 +0200
|
|
@@ -138,6 +138,7 @@ initialize_server_options(ServerOptions
|
|
options->revoked_keys_file = NULL;
|
|
options->trusted_user_ca_keys = NULL;
|
|
options->authorized_principals_file = NULL;
|
|
+ options->use_kuserok = -1;
|
|
}
|
|
|
|
void
|
|
@@ -286,6 +287,8 @@ fill_default_server_options(ServerOption
|
|
if (use_privsep == -1)
|
|
use_privsep = 1;
|
|
|
|
+ if (options->use_kuserok == -1)
|
|
+ options->use_kuserok = 1;
|
|
#ifndef HAVE_MMAP
|
|
if (use_privsep && options->compression == 1) {
|
|
error("This platform does not support both privilege "
|
|
@@ -307,7 +310,7 @@ typedef enum {
|
|
sPermitRootLogin, sLogFacility, sLogLevel,
|
|
sRhostsRSAAuthentication, sRSAAuthentication,
|
|
sKerberosAuthentication, sKerberosOrLocalPasswd, sKerberosTicketCleanup,
|
|
- sKerberosGetAFSToken,
|
|
+ sKerberosGetAFSToken, sKerberosUseKuserok,
|
|
sKerberosTgtPassing, sChallengeResponseAuthentication,
|
|
sPasswordAuthentication, sKbdInteractiveAuthentication,
|
|
sListenAddress, sAddressFamily,
|
|
@@ -377,11 +380,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 },
|
|
@@ -1341,6 +1346,10 @@ process_server_config_line(ServerOptions
|
|
*activep = value;
|
|
break;
|
|
|
|
+ case sKerberosUseKuserok:
|
|
+ intptr = &options->use_kuserok;
|
|
+ goto parse_flag;
|
|
+
|
|
case sPermitOpen:
|
|
arg = strdelim(&cp);
|
|
if (!arg || *arg == '\0')
|
|
@@ -1525,6 +1534,7 @@ copy_set_server_options(ServerOptions *d
|
|
M_CP_INTOPT(x11_use_localhost);
|
|
M_CP_INTOPT(max_sessions);
|
|
M_CP_INTOPT(max_authtries);
|
|
+ M_CP_INTOPT(use_kuserok);
|
|
|
|
M_CP_STROPT(banner);
|
|
if (preauth)
|
|
@@ -1745,6 +1755,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 -up openssh-5.6p1/servconf.h.kuserok openssh-5.6p1/servconf.h
|
|
--- openssh-5.6p1/servconf.h.kuserok 2010-09-15 15:39:48.000000000 +0200
|
|
+++ openssh-5.6p1/servconf.h 2010-09-15 15:39:48.000000000 +0200
|
|
@@ -157,6 +157,7 @@ typedef struct {
|
|
|
|
int num_permitted_opens;
|
|
|
|
+ int use_kuserok;
|
|
char *chroot_directory;
|
|
char *revoked_keys_file;
|
|
char *trusted_user_ca_keys;
|
|
diff -up openssh-5.6p1/sshd_config.5.kuserok openssh-5.6p1/sshd_config.5
|
|
--- openssh-5.6p1/sshd_config.5.kuserok 2010-09-15 15:39:48.000000000 +0200
|
|
+++ openssh-5.6p1/sshd_config.5 2010-09-15 15:39:48.000000000 +0200
|
|
@@ -564,6 +564,10 @@ Specifies whether to automatically destr
|
|
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 KeyRegenerationInterval
|
|
In protocol version 1, the ephemeral server key is automatically regenerated
|
|
after this many seconds (if it has been used).
|
|
@@ -694,6 +698,7 @@ Available keywords are
|
|
.Cm HostbasedUsesNameFromPacketOnly ,
|
|
.Cm KbdInteractiveAuthentication ,
|
|
.Cm KerberosAuthentication ,
|
|
+.Cm KerberosUseKuserok ,
|
|
.Cm MaxAuthTries ,
|
|
.Cm MaxSessions ,
|
|
.Cm PubkeyAuthentication ,
|
|
diff -up openssh-5.6p1/sshd_config.kuserok openssh-5.6p1/sshd_config
|
|
--- openssh-5.6p1/sshd_config.kuserok 2010-09-15 15:39:48.000000000 +0200
|
|
+++ openssh-5.6p1/sshd_config 2010-09-15 15:39:48.000000000 +0200
|
|
@@ -72,6 +72,7 @@ ChallengeResponseAuthentication no
|
|
#KerberosOrLocalPasswd yes
|
|
#KerberosTicketCleanup yes
|
|
#KerberosGetAFSToken no
|
|
+#KerberosUseKuserok yes
|
|
|
|
# GSSAPI options
|
|
#GSSAPIAuthentication no
|