2011-05-22 21:49:15 +00:00
|
|
|
diff -up openssh-5.8p2/auth-krb5.c.kuserok openssh-5.8p2/auth-krb5.c
|
|
|
|
--- openssh-5.8p2/auth-krb5.c.kuserok 2011-05-19 16:55:57.176106243 +0200
|
|
|
|
+++ openssh-5.8p2/auth-krb5.c 2011-05-19 16:56:02.009109884 +0200
|
2010-11-15 09:35:33 +00:00
|
|
|
@@ -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)
|
|
|
|
{
|
|
|
|
@@ -146,7 +160,7 @@ auth_krb5_password(Authctxt *authctxt, c
|
2010-06-08 10:06:35 +00:00
|
|
|
if (problem)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
- if (!krb5_kuserok(authctxt->krb5_ctx, authctxt->krb5_user, client)) {
|
2010-11-15 09:35:33 +00:00
|
|
|
+ if (!ssh_krb5_kuserok(authctxt->krb5_ctx, authctxt->krb5_user, client)) {
|
|
|
|
problem = -1;
|
|
|
|
goto out;
|
2010-06-08 10:06:35 +00:00
|
|
|
}
|
2011-05-22 21:49:15 +00:00
|
|
|
diff -up openssh-5.8p2/gss-serv-krb5.c.kuserok openssh-5.8p2/gss-serv-krb5.c
|
|
|
|
--- openssh-5.8p2/gss-serv-krb5.c.kuserok 2011-05-19 16:56:01.000000000 +0200
|
|
|
|
+++ openssh-5.8p2/gss-serv-krb5.c 2011-05-20 05:48:50.681167894 +0200
|
|
|
|
@@ -68,6 +68,7 @@ static int ssh_gssapi_krb5_cmdok(krb5_pr
|
|
|
|
int);
|
2010-11-15 09:35:33 +00:00
|
|
|
|
|
|
|
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 */
|
|
|
|
|
2011-05-22 21:49:15 +00:00
|
|
|
@@ -115,7 +116,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, luser) && k5login_exists) {
|
|
|
|
+ if (ssh_krb5_kuserok(krb_context, princ, luser) && k5login_exists) {
|
2010-11-15 09:35:33 +00:00
|
|
|
retval = 1;
|
|
|
|
logit("Authorized to %s, krb5 principal %s (krb5_kuserok)",
|
2011-05-22 21:49:15 +00:00
|
|
|
luser, (char *)client->displayname.value);
|
|
|
|
diff -up openssh-5.8p2/servconf.c.kuserok openssh-5.8p2/servconf.c
|
|
|
|
--- openssh-5.8p2/servconf.c.kuserok 2011-05-19 16:55:59.549112264 +0200
|
|
|
|
+++ openssh-5.8p2/servconf.c 2011-05-19 16:56:02.332106613 +0200
|
|
|
|
@@ -145,6 +145,7 @@ initialize_server_options(ServerOptions
|
2010-08-03 00:41:49 +00:00
|
|
|
options->authorized_principals_file = NULL;
|
2011-02-14 14:32:49 +00:00
|
|
|
options->ip_qos_interactive = -1;
|
|
|
|
options->ip_qos_bulk = -1;
|
2010-06-08 10:06:35 +00:00
|
|
|
+ options->use_kuserok = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2011-05-22 21:49:15 +00:00
|
|
|
@@ -300,6 +301,8 @@ fill_default_server_options(ServerOption
|
2010-06-08 10:06:35 +00:00
|
|
|
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 "
|
2011-05-22 21:49:15 +00:00
|
|
|
@@ -321,7 +324,7 @@ typedef enum {
|
2010-06-08 10:06:35 +00:00
|
|
|
sPermitRootLogin, sLogFacility, sLogLevel,
|
|
|
|
sRhostsRSAAuthentication, sRSAAuthentication,
|
|
|
|
sKerberosAuthentication, sKerberosOrLocalPasswd, sKerberosTicketCleanup,
|
|
|
|
- sKerberosGetAFSToken,
|
|
|
|
+ sKerberosGetAFSToken, sKerberosUseKuserok,
|
|
|
|
sKerberosTgtPassing, sChallengeResponseAuthentication,
|
|
|
|
sPasswordAuthentication, sKbdInteractiveAuthentication,
|
|
|
|
sListenAddress, sAddressFamily,
|
2011-05-22 21:49:15 +00:00
|
|
|
@@ -392,11 +395,13 @@ static struct {
|
2010-06-08 10:06:35 +00:00
|
|
|
#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 },
|
2011-05-22 21:49:15 +00:00
|
|
|
@@ -1374,6 +1379,10 @@ process_server_config_line(ServerOptions
|
2010-06-08 10:06:35 +00:00
|
|
|
*activep = value;
|
|
|
|
break;
|
|
|
|
|
|
|
|
+ case sKerberosUseKuserok:
|
|
|
|
+ intptr = &options->use_kuserok;
|
|
|
|
+ goto parse_flag;
|
|
|
|
+
|
|
|
|
case sPermitOpen:
|
|
|
|
arg = strdelim(&cp);
|
|
|
|
if (!arg || *arg == '\0')
|
2011-05-22 21:49:15 +00:00
|
|
|
@@ -1577,6 +1586,7 @@ copy_set_server_options(ServerOptions *d
|
2010-06-08 10:06:35 +00:00
|
|
|
M_CP_INTOPT(max_authtries);
|
2011-02-14 14:32:49 +00:00
|
|
|
M_CP_INTOPT(ip_qos_interactive);
|
|
|
|
M_CP_INTOPT(ip_qos_bulk);
|
2010-06-08 10:06:35 +00:00
|
|
|
+ M_CP_INTOPT(use_kuserok);
|
|
|
|
|
|
|
|
M_CP_STROPT(banner);
|
|
|
|
if (preauth)
|
2011-05-22 21:49:15 +00:00
|
|
|
@@ -1800,6 +1810,7 @@ dump_config(ServerOptions *o)
|
2010-06-08 10:06:35 +00:00
|
|
|
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);
|
2011-05-22 21:49:15 +00:00
|
|
|
diff -up openssh-5.8p2/servconf.h.kuserok openssh-5.8p2/servconf.h
|
|
|
|
--- openssh-5.8p2/servconf.h.kuserok 2011-05-19 16:55:59.676167388 +0200
|
|
|
|
+++ openssh-5.8p2/servconf.h 2011-05-19 16:56:02.449168732 +0200
|
|
|
|
@@ -160,6 +160,7 @@ typedef struct {
|
2010-06-08 10:06:35 +00:00
|
|
|
|
|
|
|
int num_permitted_opens;
|
|
|
|
|
|
|
|
+ int use_kuserok;
|
|
|
|
char *chroot_directory;
|
|
|
|
char *revoked_keys_file;
|
|
|
|
char *trusted_user_ca_keys;
|
2011-05-22 21:49:15 +00:00
|
|
|
diff -up openssh-5.8p2/sshd_config.5.kuserok openssh-5.8p2/sshd_config.5
|
|
|
|
--- openssh-5.8p2/sshd_config.5.kuserok 2011-05-19 16:56:00.265169181 +0200
|
|
|
|
+++ openssh-5.8p2/sshd_config.5 2011-05-19 16:56:02.588114955 +0200
|
|
|
|
@@ -602,6 +602,10 @@ Specifies whether to automatically destr
|
2010-06-08 10:06:35 +00:00
|
|
|
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 .
|
2011-02-14 14:32:49 +00:00
|
|
|
.It Cm KexAlgorithms
|
|
|
|
Specifies the available KEX (Key Exchange) algorithms.
|
|
|
|
Multiple algorithms must be comma-separated.
|
2011-05-22 21:49:15 +00:00
|
|
|
@@ -743,6 +747,7 @@ Available keywords are
|
2010-08-03 00:41:49 +00:00
|
|
|
.Cm HostbasedUsesNameFromPacketOnly ,
|
2010-06-08 10:06:35 +00:00
|
|
|
.Cm KbdInteractiveAuthentication ,
|
|
|
|
.Cm KerberosAuthentication ,
|
|
|
|
+.Cm KerberosUseKuserok ,
|
|
|
|
.Cm MaxAuthTries ,
|
|
|
|
.Cm MaxSessions ,
|
2010-07-07 13:48:36 +00:00
|
|
|
.Cm PubkeyAuthentication ,
|
2011-05-22 21:49:15 +00:00
|
|
|
diff -up openssh-5.8p2/sshd_config.kuserok openssh-5.8p2/sshd_config
|
|
|
|
--- openssh-5.8p2/sshd_config.kuserok 2011-05-19 16:56:00.886106293 +0200
|
|
|
|
+++ openssh-5.8p2/sshd_config 2011-05-19 16:56:02.716105342 +0200
|
2011-02-14 14:32:49 +00:00
|
|
|
@@ -73,6 +73,7 @@ ChallengeResponseAuthentication no
|
2010-06-08 10:06:35 +00:00
|
|
|
#KerberosOrLocalPasswd yes
|
|
|
|
#KerberosTicketCleanup yes
|
|
|
|
#KerberosGetAFSToken no
|
|
|
|
+#KerberosUseKuserok yes
|
|
|
|
|
|
|
|
# GSSAPI options
|
|
|
|
#GSSAPIAuthentication no
|