diff options
author | Simon Wilkinson <simon@sxw.org.uk> | 2014-02-09 16:09:48 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2016-02-29 12:31:33 +0000 |
commit | 374db1757fc18bd6647539b80977e6907a2cecd4 (patch) | |
tree | 9fd8227bdf3548c6fcce1e72b7edf3ebaf71d050 /auth-krb5.c | |
parent | c52a95cc4754e6630c96fe65ae0c65eb41d2c590 (diff) |
GSSAPI key exchange support
This patch has been rejected upstream: "None of the OpenSSH developers are
in favour of adding this, and this situation has not changed for several
years. This is not a slight on Simon's patch, which is of fine quality, but
just that a) we don't trust GSSAPI implementations that much and b) we don't
like adding new KEX since they are pre-auth attack surface. This one is
particularly scary, since it requires hooks out to typically root-owned
system resources."
However, quite a lot of people rely on this in Debian, and it's better to
have it merged into the main openssh package rather than having separate
-krb5 packages (as we used to have). It seems to have a generally good
security history.
Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1242
Last-Updated: 2016-01-04
Patch-Name: gssapi.patch
Diffstat (limited to 'auth-krb5.c')
-rw-r--r-- | auth-krb5.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/auth-krb5.c b/auth-krb5.c index d1c5a2f32..f019fb1a1 100644 --- a/auth-krb5.c +++ b/auth-krb5.c | |||
@@ -183,8 +183,13 @@ auth_krb5_password(Authctxt *authctxt, const char *password) | |||
183 | 183 | ||
184 | len = strlen(authctxt->krb5_ticket_file) + 6; | 184 | len = strlen(authctxt->krb5_ticket_file) + 6; |
185 | authctxt->krb5_ccname = xmalloc(len); | 185 | authctxt->krb5_ccname = xmalloc(len); |
186 | #ifdef USE_CCAPI | ||
187 | snprintf(authctxt->krb5_ccname, len, "API:%s", | ||
188 | authctxt->krb5_ticket_file); | ||
189 | #else | ||
186 | snprintf(authctxt->krb5_ccname, len, "FILE:%s", | 190 | snprintf(authctxt->krb5_ccname, len, "FILE:%s", |
187 | authctxt->krb5_ticket_file); | 191 | authctxt->krb5_ticket_file); |
192 | #endif | ||
188 | 193 | ||
189 | #ifdef USE_PAM | 194 | #ifdef USE_PAM |
190 | if (options.use_pam) | 195 | if (options.use_pam) |
@@ -241,15 +246,22 @@ krb5_cleanup_proc(Authctxt *authctxt) | |||
241 | #ifndef HEIMDAL | 246 | #ifndef HEIMDAL |
242 | krb5_error_code | 247 | krb5_error_code |
243 | ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { | 248 | ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { |
244 | int tmpfd, ret, oerrno; | 249 | int ret, oerrno; |
245 | char ccname[40]; | 250 | char ccname[40]; |
246 | mode_t old_umask; | 251 | mode_t old_umask; |
252 | #ifdef USE_CCAPI | ||
253 | char cctemplate[] = "API:krb5cc_%d"; | ||
254 | #else | ||
255 | char cctemplate[] = "FILE:/tmp/krb5cc_%d_XXXXXXXXXX"; | ||
256 | int tmpfd; | ||
257 | #endif | ||
247 | 258 | ||
248 | ret = snprintf(ccname, sizeof(ccname), | 259 | ret = snprintf(ccname, sizeof(ccname), |
249 | "FILE:/tmp/krb5cc_%d_XXXXXXXXXX", geteuid()); | 260 | cctemplate, geteuid()); |
250 | if (ret < 0 || (size_t)ret >= sizeof(ccname)) | 261 | if (ret < 0 || (size_t)ret >= sizeof(ccname)) |
251 | return ENOMEM; | 262 | return ENOMEM; |
252 | 263 | ||
264 | #ifndef USE_CCAPI | ||
253 | old_umask = umask(0177); | 265 | old_umask = umask(0177); |
254 | tmpfd = mkstemp(ccname + strlen("FILE:")); | 266 | tmpfd = mkstemp(ccname + strlen("FILE:")); |
255 | oerrno = errno; | 267 | oerrno = errno; |
@@ -266,6 +278,7 @@ ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { | |||
266 | return oerrno; | 278 | return oerrno; |
267 | } | 279 | } |
268 | close(tmpfd); | 280 | close(tmpfd); |
281 | #endif | ||
269 | 282 | ||
270 | return (krb5_cc_resolve(ctx, ccname, ccache)); | 283 | return (krb5_cc_resolve(ctx, ccname, ccache)); |
271 | } | 284 | } |