Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-misc/openssh/files: openssh-5.9_p1-sshd-gssapi-multihomed.patch sshd.rc6.3
Date: Wed, 07 Sep 2011 01:38:57
Message-Id: 20110907013846.E3BB120051@flycatcher.gentoo.org
1 vapier 11/09/07 01:38:46
2
3 Added: openssh-5.9_p1-sshd-gssapi-multihomed.patch
4 sshd.rc6.3
5 Log:
6 Version bump. Drop --oknodo in init.d #377771 by Michael Mair-Keimberger. Add GSSAPI/Kerberos fix #378361 by Kevan Carstensen.
7
8 (Portage version: 2.2.0_alpha51/cvs/Linux x86_64)
9
10 Revision Changes Path
11 1.1 net-misc/openssh/files/openssh-5.9_p1-sshd-gssapi-multihomed.patch
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/openssh/files/openssh-5.9_p1-sshd-gssapi-multihomed.patch?rev=1.1&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/openssh/files/openssh-5.9_p1-sshd-gssapi-multihomed.patch?rev=1.1&content-type=text/plain
15
16 Index: openssh-5.9_p1-sshd-gssapi-multihomed.patch
17 ===================================================================
18 Index: gss-serv.c
19 ===================================================================
20 RCS file: /cvs/src/usr.bin/ssh/gss-serv.c,v
21 retrieving revision 1.22
22 diff -u -p -r1.22 gss-serv.c
23 --- gss-serv.c 8 May 2008 12:02:23 -0000 1.22
24 +++ gss-serv.c 11 Jan 2010 05:38:29 -0000
25 @@ -41,9 +41,12 @@
26 #include "channels.h"
27 #include "session.h"
28 #include "misc.h"
29 +#include "servconf.h"
30
31 #include "ssh-gss.h"
32
33 +extern ServerOptions options;
34 +
35 static ssh_gssapi_client gssapi_client =
36 { GSS_C_EMPTY_BUFFER, GSS_C_EMPTY_BUFFER,
37 GSS_C_NO_CREDENTIAL, NULL, {NULL, NULL, NULL}};
38 @@ -77,25 +80,32 @@ ssh_gssapi_acquire_cred(Gssctxt *ctx)
39 char lname[MAXHOSTNAMELEN];
40 gss_OID_set oidset;
41
42 - gss_create_empty_oid_set(&status, &oidset);
43 - gss_add_oid_set_member(&status, ctx->oid, &oidset);
44 -
45 - if (gethostname(lname, MAXHOSTNAMELEN)) {
46 - gss_release_oid_set(&status, &oidset);
47 - return (-1);
48 - }
49 + if (options.gss_strict_acceptor) {
50 + gss_create_empty_oid_set(&status, &oidset);
51 + gss_add_oid_set_member(&status, ctx->oid, &oidset);
52 +
53 + if (gethostname(lname, MAXHOSTNAMELEN)) {
54 + gss_release_oid_set(&status, &oidset);
55 + return (-1);
56 + }
57 +
58 + if (GSS_ERROR(ssh_gssapi_import_name(ctx, lname))) {
59 + gss_release_oid_set(&status, &oidset);
60 + return (ctx->major);
61 + }
62 +
63 + if ((ctx->major = gss_acquire_cred(&ctx->minor,
64 + ctx->name, 0, oidset, GSS_C_ACCEPT, &ctx->creds,
65 + NULL, NULL)))
66 + ssh_gssapi_error(ctx);
67
68 - if (GSS_ERROR(ssh_gssapi_import_name(ctx, lname))) {
69 gss_release_oid_set(&status, &oidset);
70 return (ctx->major);
71 + } else {
72 + ctx->name = GSS_C_NO_NAME;
73 + ctx->creds = GSS_C_NO_CREDENTIAL;
74 }
75 -
76 - if ((ctx->major = gss_acquire_cred(&ctx->minor,
77 - ctx->name, 0, oidset, GSS_C_ACCEPT, &ctx->creds, NULL, NULL)))
78 - ssh_gssapi_error(ctx);
79 -
80 - gss_release_oid_set(&status, &oidset);
81 - return (ctx->major);
82 + return GSS_S_COMPLETE;
83 }
84
85 /* Privileged */
86 Index: servconf.c
87 ===================================================================
88 RCS file: /cvs/src/usr.bin/ssh/servconf.c,v
89 retrieving revision 1.201
90 diff -u -p -r1.201 servconf.c
91 --- servconf.c 10 Jan 2010 03:51:17 -0000 1.201
92 +++ servconf.c 11 Jan 2010 05:34:56 -0000
93 @@ -86,6 +86,7 @@ initialize_server_options(ServerOptions
94 options->kerberos_get_afs_token = -1;
95 options->gss_authentication=-1;
96 options->gss_cleanup_creds = -1;
97 + options->gss_strict_acceptor = -1;
98 options->password_authentication = -1;
99 options->kbd_interactive_authentication = -1;
100 options->challenge_response_authentication = -1;
101 @@ -200,6 +201,8 @@ fill_default_server_options(ServerOption
102 options->gss_authentication = 0;
103 if (options->gss_cleanup_creds == -1)
104 options->gss_cleanup_creds = 1;
105 + if (options->gss_strict_acceptor == -1)
106 + options->gss_strict_acceptor = 0;
107 if (options->password_authentication == -1)
108 options->password_authentication = 1;
109 if (options->kbd_interactive_authentication == -1)
110 @@ -277,7 +280,8 @@ typedef enum {
111 sBanner, sUseDNS, sHostbasedAuthentication,
112 sHostbasedUsesNameFromPacketOnly, sClientAliveInterval,
113 sClientAliveCountMax, sAuthorizedKeysFile,
114 - sGssAuthentication, sGssCleanupCreds, sAcceptEnv, sPermitTunnel,
115 + sGssAuthentication, sGssCleanupCreds, sGssStrictAcceptor,
116 + sAcceptEnv, sPermitTunnel,
117 sMatch, sPermitOpen, sForceCommand, sChrootDirectory,
118 sUsePrivilegeSeparation, sAllowAgentForwarding,
119 sZeroKnowledgePasswordAuthentication, sHostCertificate,
120 @@ -327,9 +331,11 @@ static struct {
121 #ifdef GSSAPI
122 { "gssapiauthentication", sGssAuthentication, SSHCFG_ALL },
123 { "gssapicleanupcredentials", sGssCleanupCreds, SSHCFG_GLOBAL },
124 + { "gssapistrictacceptorcheck", sGssStrictAcceptor, SSHCFG_GLOBAL },
125 #else
126 { "gssapiauthentication", sUnsupported, SSHCFG_ALL },
127 { "gssapicleanupcredentials", sUnsupported, SSHCFG_GLOBAL },
128 + { "gssapistrictacceptorcheck", sUnsupported, SSHCFG_GLOBAL },
129 #endif
130 { "passwordauthentication", sPasswordAuthentication, SSHCFG_ALL },
131 { "kbdinteractiveauthentication", sKbdInteractiveAuthentication, SSHCFG_ALL },
132 @@ -850,6 +856,10 @@ process_server_config_line(ServerOptions
133
134 case sGssCleanupCreds:
135 intptr = &options->gss_cleanup_creds;
136 + goto parse_flag;
137 +
138 + case sGssStrictAcceptor:
139 + intptr = &options->gss_strict_acceptor;
140 goto parse_flag;
141
142 case sPasswordAuthentication:
143 Index: servconf.h
144 ===================================================================
145 RCS file: /cvs/src/usr.bin/ssh/servconf.h,v
146 retrieving revision 1.89
147 diff -u -p -r1.89 servconf.h
148 --- servconf.h 9 Jan 2010 23:04:13 -0000 1.89
149 +++ servconf.h 11 Jan 2010 05:32:28 -0000
150 @@ -92,6 +92,7 @@ typedef struct {
151 * authenticated with Kerberos. */
152 int gss_authentication; /* If true, permit GSSAPI authentication */
153 int gss_cleanup_creds; /* If true, destroy cred cache on logout */
154 + int gss_strict_acceptor; /* If true, restrict the GSSAPI acceptor name */
155 int password_authentication; /* If true, permit password
156 * authentication. */
157 int kbd_interactive_authentication; /* If true, permit */
158 Index: sshd_config
159 ===================================================================
160 RCS file: /cvs/src/usr.bin/ssh/sshd_config,v
161 retrieving revision 1.81
162 diff -u -p -r1.81 sshd_config
163 --- sshd_config 8 Oct 2009 14:03:41 -0000 1.81
164 +++ sshd_config 11 Jan 2010 05:32:28 -0000
165 @@ -69,6 +69,7 @@
166 # GSSAPI options
167 #GSSAPIAuthentication no
168 #GSSAPICleanupCredentials yes
169 +#GSSAPIStrictAcceptorCheck yes
170
171 # Set this to 'yes' to enable PAM authentication, account processing,
172 # and session processing. If this is enabled, PAM authentication will
173 Index: sshd_config.5
174 ===================================================================
175 RCS file: /cvs/src/usr.bin/ssh/sshd_config.5,v
176 retrieving revision 1.116
177 diff -u -p -r1.116 sshd_config.5
178 --- sshd_config.5 9 Jan 2010 23:04:13 -0000 1.116
179 +++ sshd_config.5 11 Jan 2010 05:37:20 -0000
180 @@ -386,6 +386,21 @@ on logout.
181 The default is
182 .Dq yes .
183 Note that this option applies to protocol version 2 only.
184 +.It Cm GSSAPIStrictAcceptorCheck
185 +Determines whether to be strict about the identity of the GSSAPI acceptor
186 +a client authenticates against.
187 +If set to
188 +.Dq yes
189 +then the client must authenticate against the
190 +.Pa host
191 +service on the current hostname.
192 +If set to
193 +.Dq no
194 +then the client may authenticate against any service key stored in the
195 +machine's default store.
196 +This facility is provided to assist with operation on multi homed machines.
197 +The default is
198 +.Dq yes .
199 .It Cm HostbasedAuthentication
200 Specifies whether rhosts or /etc/hosts.equiv authentication together
201 with successful public key client host authentication is allowed
202
203
204
205 1.1 net-misc/openssh/files/sshd.rc6.3
206
207 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/openssh/files/sshd.rc6.3?rev=1.1&view=markup
208 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-misc/openssh/files/sshd.rc6.3?rev=1.1&content-type=text/plain
209
210 Index: sshd.rc6.3
211 ===================================================================
212 #!/sbin/runscript
213 # Copyright 1999-2011 Gentoo Foundation
214 # Distributed under the terms of the GNU General Public License v2
215 # $Header: /var/cvsroot/gentoo-x86/net-misc/openssh/files/sshd.rc6.3,v 1.1 2011/09/07 01:38:46 vapier Exp $
216
217 opts="${opts} reload checkconfig gen_keys"
218
219 depend() {
220 use logger dns
221 need net
222 }
223
224 SSHD_CONFDIR=${SSHD_CONFDIR:-/etc/ssh}
225 SSHD_PIDFILE=${SSHD_PIDFILE:-/var/run/${SVCNAME}.pid}
226 SSHD_BINARY=${SSHD_BINARY:-/usr/sbin/sshd}
227
228 checkconfig() {
229 if [ ! -d /var/empty ] ; then
230 mkdir -p /var/empty || return 1
231 fi
232
233 if [ ! -e "${SSHD_CONFDIR}"/sshd_config ] ; then
234 eerror "You need an ${SSHD_CONFDIR}/sshd_config file to run sshd"
235 eerror "There is a sample file in /usr/share/doc/openssh"
236 return 1
237 fi
238
239 gen_keys || return 1
240
241 [ "${SSHD_PIDFILE}" != "/var/run/sshd.pid" ] \
242 && SSHD_OPTS="${SSHD_OPTS} -o PidFile=${SSHD_PIDFILE}"
243 [ "${SSHD_CONFDIR}" != "/etc/ssh" ] \
244 && SSHD_OPTS="${SSHD_OPTS} -f ${SSHD_CONFDIR}/sshd_config"
245
246 "${SSHD_BINARY}" -t ${SSHD_OPTS} || return 1
247 }
248
249 gen_key() {
250 local type=$1 key ks
251 [ $# -eq 1 ] && ks="${type}_"
252 key="${SSHD_CONFDIR}/ssh_host_${ks}key"
253 if [ ! -e "${key}" ] ; then
254 ebegin "Generating ${type} host key"
255 ssh-keygen -t ${type} -f "${key}" -N ''
256 eend $? || return $?
257 fi
258 }
259
260 gen_keys() {
261 if egrep -q '^[[:space:]]*Protocol[[:space:]]+.*1' "${SSHD_CONFDIR}"/sshd_config ; then
262 gen_key rsa1 "" || return 1
263 fi
264 gen_key dsa && gen_key rsa && gen_key ecdsa
265 return $?
266 }
267
268 start() {
269 checkconfig || return 1
270
271 ebegin "Starting ${SVCNAME}"
272 start-stop-daemon --start --exec "${SSHD_BINARY}" \
273 --pidfile "${SSHD_PIDFILE}" \
274 -- ${SSHD_OPTS}
275 eend $?
276 }
277
278 stop() {
279 if [ "${RC_CMD}" = "restart" ] ; then
280 checkconfig || return 1
281 fi
282
283 ebegin "Stopping ${SVCNAME}"
284 start-stop-daemon --stop --exec "${SSHD_BINARY}" \
285 --pidfile "${SSHD_PIDFILE}" --quiet
286 eend $?
287 }
288
289 reload() {
290 checkconfig || return 1
291 ebegin "Reloading ${SVCNAME}"
292 start-stop-daemon --stop --signal HUP \
293 --exec "${SSHD_BINARY}" --pidfile "${SSHD_PIDFILE}"
294 eend $?
295 }