]> git.pld-linux.org Git - packages/openssh.git/blame - openssh-kuserok.patch
suggest xauth in server package as well
[packages/openssh.git] / openssh-kuserok.patch
CommitLineData
92dc7c43
JR
1diff -up openssh-5.8p1/auth-krb5.c.kuserok openssh-5.8p1/auth-krb5.c
2--- openssh-5.8p1/auth-krb5.c.kuserok 2009-12-21 00:49:22.000000000 +0100
3+++ openssh-5.8p1/auth-krb5.c 2011-02-14 09:15:12.000000000 +0100
4@@ -54,6 +54,20 @@
5
6 extern ServerOptions options;
7
8+int
9+ssh_krb5_kuserok(krb5_context krb5_ctx, krb5_principal krb5_user, const char *client)
10+{
11+ if (options.use_kuserok)
12+ return krb5_kuserok(krb5_ctx, krb5_user, client);
13+ else {
14+ char kuser[65];
15+
16+ if (krb5_aname_to_localname(krb5_ctx, krb5_user, sizeof(kuser), kuser))
17+ return 0;
18+ return strcmp(kuser, client) == 0;
19+ }
20+}
21+
22 static int
23 krb5_init(void *context)
24 {
25@@ -146,7 +160,7 @@ auth_krb5_password(Authctxt *authctxt, c
26 if (problem)
27 goto out;
28
29- if (!krb5_kuserok(authctxt->krb5_ctx, authctxt->krb5_user, client)) {
30+ if (!ssh_krb5_kuserok(authctxt->krb5_ctx, authctxt->krb5_user, client)) {
31 problem = -1;
32 goto out;
33 }
34diff -up openssh-5.8p1/gss-serv-krb5.c.kuserok openssh-5.8p1/gss-serv-krb5.c
35--- openssh-5.8p1/gss-serv-krb5.c.kuserok 2006-09-01 07:38:36.000000000 +0200
36+++ openssh-5.8p1/gss-serv-krb5.c 2011-02-14 09:15:12.000000000 +0100
37@@ -57,6 +57,7 @@ extern ServerOptions options;
38 #endif
39
40 static krb5_context krb_context = NULL;
41+extern int ssh_krb5_kuserok(krb5_context, krb5_principal, const char *);
42
43 /* Initialise the krb5 library, for the stuff that GSSAPI won't do */
44
45@@ -97,7 +98,7 @@ ssh_gssapi_krb5_userok(ssh_gssapi_client
46 krb5_get_err_text(krb_context, retval));
47 return 0;
48 }
49- if (krb5_kuserok(krb_context, princ, name)) {
50+ if (ssh_krb5_kuserok(krb_context, princ, name)) {
51 retval = 1;
52 logit("Authorized to %s, krb5 principal %s (krb5_kuserok)",
53 name, (char *)client->displayname.value);
54diff -up openssh-5.8p1/servconf.c.kuserok openssh-5.8p1/servconf.c
55--- openssh-5.8p1/servconf.c.kuserok 2011-02-14 09:15:12.000000000 +0100
56+++ openssh-5.8p1/servconf.c 2011-02-14 09:20:22.000000000 +0100
afde20c1
AM
57@@ -133,6 +133,7 @@
58 options->num_accept_env = 0;
59 options->permit_tun = -1;
60 options->num_permitted_opens = -1;
92dc7c43 61+ options->use_kuserok = -1;
afde20c1
AM
62 options->adm_forced_command = NULL;
63 options->chroot_directory = NULL;
64 options->zero_knowledge_password_authentication = -1;
92dc7c43
JR
65@@ -291,6 +292,8 @@ fill_default_server_options(ServerOption
66 if (use_privsep == -1)
67 use_privsep = 1;
68
69+ if (options->use_kuserok == -1)
70+ options->use_kuserok = 1;
71 #ifndef HAVE_MMAP
72 if (use_privsep && options->compression == 1) {
73 error("This platform does not support both privilege "
74@@ -312,7 +315,7 @@ typedef enum {
75 sPermitRootLogin, sLogFacility, sLogLevel,
76 sRhostsRSAAuthentication, sRSAAuthentication,
77 sKerberosAuthentication, sKerberosOrLocalPasswd, sKerberosTicketCleanup,
78- sKerberosGetAFSToken,
79+ sKerberosGetAFSToken, sKerberosUseKuserok,
80 sKerberosTgtPassing, sChallengeResponseAuthentication,
81 sPasswordAuthentication, sKbdInteractiveAuthentication,
82 sListenAddress, sAddressFamily,
83@@ -381,11 +384,13 @@ static struct {
84 #else
85 { "kerberosgetafstoken", sUnsupported, SSHCFG_GLOBAL },
86 #endif
87+ { "kerberosusekuserok", sKerberosUseKuserok, SSHCFG_ALL },
88 #else
89 { "kerberosauthentication", sUnsupported, SSHCFG_ALL },
90 { "kerberosorlocalpasswd", sUnsupported, SSHCFG_GLOBAL },
91 { "kerberosticketcleanup", sUnsupported, SSHCFG_GLOBAL },
92 { "kerberosgetafstoken", sUnsupported, SSHCFG_GLOBAL },
93+ { "kerberosusekuserok", sUnsupported, SSHCFG_ALL },
94 #endif
95 { "kerberostgtpassing", sUnsupported, SSHCFG_GLOBAL },
96 { "afstokenpassing", sUnsupported, SSHCFG_GLOBAL },
97@@ -1341,6 +1346,10 @@ process_server_config_line(ServerOptions
98 *activep = value;
99 break;
100
101+ case sKerberosUseKuserok:
102+ intptr = &options->use_kuserok;
103+ goto parse_flag;
104+
105 case sPermitOpen:
106 arg = strdelim(&cp);
107 if (!arg || *arg == '\0')
108@@ -1544,6 +1553,7 @@ copy_set_server_options(ServerOptions *d
109 M_CP_INTOPT(max_authtries);
110 M_CP_INTOPT(ip_qos_interactive);
111 M_CP_INTOPT(ip_qos_bulk);
112+ M_CP_INTOPT(use_kuserok);
113
114 M_CP_STROPT(banner);
115 if (preauth)
116@@ -1764,6 +1774,7 @@ dump_config(ServerOptions *o)
117 dump_cfg_fmtint(sUseDNS, o->use_dns);
118 dump_cfg_fmtint(sAllowTcpForwarding, o->allow_tcp_forwarding);
119 dump_cfg_fmtint(sUsePrivilegeSeparation, use_privsep);
120+ dump_cfg_fmtint(sKerberosUseKuserok, o->use_kuserok);
121
122 /* string arguments */
123 dump_cfg_string(sPidFile, o->pid_file);
124diff -up openssh-5.8p1/servconf.h.kuserok openssh-5.8p1/servconf.h
125--- openssh-5.8p1/servconf.h.kuserok 2011-02-14 09:15:12.000000000 +0100
126+++ openssh-5.8p1/servconf.h 2011-02-14 09:15:12.000000000 +0100
127@@ -157,6 +157,7 @@ typedef struct {
128
129 int num_permitted_opens;
130
131+ int use_kuserok;
132 char *chroot_directory;
133 char *revoked_keys_file;
134 char *trusted_user_ca_keys;
135diff -up openssh-5.8p1/sshd_config.5.kuserok openssh-5.8p1/sshd_config.5
136--- openssh-5.8p1/sshd_config.5.kuserok 2011-02-14 09:15:12.000000000 +0100
137+++ openssh-5.8p1/sshd_config.5 2011-02-14 09:17:11.000000000 +0100
138@@ -574,6 +574,10 @@ Specifies whether to automatically destr
139 file on logout.
140 The default is
141 .Dq yes .
142+.It Cm KerberosUseKuserok
143+Specifies whether to look at .k5login file for user's aliases.
144+The default is
145+.Dq yes .
146 .It Cm KexAlgorithms
147 Specifies the available KEX (Key Exchange) algorithms.
148 Multiple algorithms must be comma-separated.
149@@ -715,6 +719,7 @@ Available keywords are
150 .Cm HostbasedUsesNameFromPacketOnly ,
151 .Cm KbdInteractiveAuthentication ,
152 .Cm KerberosAuthentication ,
153+.Cm KerberosUseKuserok ,
154 .Cm MaxAuthTries ,
155 .Cm MaxSessions ,
156 .Cm PubkeyAuthentication ,
157diff -up openssh-5.8p1/sshd_config.kuserok openssh-5.8p1/sshd_config
158--- openssh-5.8p1/sshd_config.kuserok 2011-02-14 09:15:12.000000000 +0100
159+++ openssh-5.8p1/sshd_config 2011-02-14 09:15:12.000000000 +0100
160@@ -73,6 +73,7 @@ ChallengeResponseAuthentication no
161 #KerberosOrLocalPasswd yes
162 #KerberosTicketCleanup yes
163 #KerberosGetAFSToken no
164+#KerberosUseKuserok yes
165
166 # GSSAPI options
167 #GSSAPIAuthentication no
This page took 0.0476 seconds and 4 git commands to generate.