Bug 1008 - GSSAPI authentication fails with Round Robin DNS hosts
Summary: GSSAPI authentication fails with Round Robin DNS hosts
Status: NEW
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: Kerberos support (show other bugs)
Version: -current
Hardware: All All
: P2 normal
Assignee: OpenSSH Bugzilla mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-31 22:52 AEST by Andreas Haupt
Modified: 2017-10-28 01:13 AEDT (History)
11 users (show)

See Also:


Attachments
Add option to do GSSAPI canonicalization in the client, rather than the library (4.31 KB, patch)
2006-08-19 22:26 AEST, Simon Wilkinson
no flags Details | Diff
(simplified patch - no config option) (1.04 KB, patch)
2006-10-24 02:17 AEST, Jan Iven
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Haupt 2005-03-31 22:52:59 AEST
When connecting to hosts that are accessed via Round Robin DNS (e.g
pub.<my.domain> resolves to the ip addresses of pub[1-5].<my.domain>) GSSAPI
authentication failes often.

That's because the server's address lookup is done twice. First when actually
connecting to the server, the second time when determining the host's principal
name. If the ssh client gets two different answers here, the authentication failes.

On the sshd server the following error message appears in debug mode in this case:

debug1:  Miscellaneous failure (see text)
Decrypt integrity check failed

debug1: Got no client credentials

On the client I can see that I got a ticket for a different host than the one
I'm actually connected to. That's the reason for the error message.
Comment 1 Darren Tucker 2005-03-31 23:02:57 AEST
Is that related to bug #928?
Comment 2 Andreas Haupt 2005-04-01 00:08:39 AEST
(NOTE: this might be a repost as the mail reply ended up with a postix error
message: Diagnostic-Code: X-Postfix; unknown user: "bitbucker")

(In reply to comment #1)
> Is that related to bug #928?

I don't think so. If I understand the patch for bug #928 correctly, it
solves a problem when hosts have more than one ip address / host name. It's
furthermore situated on the server side.

My problem is situated on the client side. The ssh client should obtain the
kerberos ticket for exactly that host it has connected to. With the current
lookup behaviour this is not possible. Round robin dns offers more than one
ip address. These addresses belong to hosts that are completely independent
from each other, except that they share the same ssh keys (ssh_host_rsa_key
et al).

Example:

[fuchur] ~ % host pub.ifh.de
pub.ifh.de is an alias for pub.iss.ifh.de.
pub.iss.ifh.de has address 141.34.15.194
pub.iss.ifh.de has address 141.34.1.150
[fuchur] ~ % host pub.ifh.de
pub.ifh.de is an alias for pub.iss.ifh.de.
pub.iss.ifh.de has address 141.34.1.150
pub.iss.ifh.de has address 141.34.15.194
[fuchur] ~ %

Greetings
Andreas
Comment 3 David Leonard 2005-06-08 22:16:57 AEST
a workaround at http://blog.macnews.de/unspecific/stories/4581/
Comment 4 Simon Wilkinson 2005-07-07 01:19:23 AEST
Yes, the client should only do the hostname lookup once (or, in an ideal world,
GSSAPI should use the hostname as entered by the user, not what DNS resolves it
to!).

I'll look into this.
Comment 5 Simon Wilkinson 2006-08-19 08:28:06 AEST
There isn't an easy fix for this, at least with today's GSSAPI libraries. Most of these 
use the DNS to canonicalize the hostname passed into them - so there's no way of stopping
them from resolving it a different way from OpenSSH.

Perversely, the only way to fix this is to pass the canonicalized name into the GSSAPI library,
rather than the one supplied by the user. Generally, this is a bad idea, but it's the only
way to fix this problem. I've got a patch which does this dependent on a configuration variable,
if it would be likely to be considered for inclusion.
Comment 6 Simon Wilkinson 2006-08-19 22:26:57 AEST
Created attachment 1177 [details]
Add option to do GSSAPI canonicalization in the client, rather than the library

Here's the patch.

This creates a new configuration directive 'GSSAPITrustDNS', which if set, will cause the ssh client to canonicalize the hostname before passing it to the GSSAPI libraries. As the client caches canonicalization results, this means that the libraries are always called with the hostname that the client is connected to.

Whilst GSSAPI libraries perform canonicalization internally, this is the only way of avoiding the GSSAPI picking a different hostname than the ssh client. In the long term, GSSAPI implementations should not be performing canonicalization, and should be using the hostname passed by the user to request service tickets - but this seems a long way off.
Comment 7 Jan Iven 2006-10-24 02:17:48 AEST
Created attachment 1202 [details]
(simplified patch - no config option)

Given that the GSSAPI library will (unconditionally) use DNS anyway, perhaps we don't need yet another client-side config option? Btw, the old SSH1 Kerberos4/5 authentications used canonical hostnames as well for service tickets.
Comment 8 Jan Iven 2007-03-23 21:31:32 AEDT
FYI, we (or our users) are now encouraging distributions (which typically have older OpenSSH releases anyway) to consider adding this patch.

SuSE: https://bugzilla.novell.com/show_bug.cgi?id=257034
Debian: http://www.mail-archive.com/debian-ssh@lists.debian.org/msg02727.html
RedHat: IssueTracker#107219  

please feel free to add more.
Comment 9 Simon Wilkinson 2007-09-15 20:59:25 AEST
I've noted this on the mailing list too, but just for the record, 
the simplified patch is incorrect. GSSAPI != Kerberos, and even
within the Kerberos space, some vendors ship with
canonicalisation disabled.

If we are going to ship a workaround for this issue (and we 
should), it has to be configurable, and default to 'off', so
users get the current behaviour unless they specifically
request that we trust the DNS.

I'll look into porting my patch across to the OpenBSD codebase.
Comment 10 Christoph Anton Mitterer 2013-01-15 13:50:07 AEDT
Is this considered to be "fixed" now? Cause the ticket is still open...
Comment 11 DarioP 2013-05-22 20:15:49 AEST
(In reply to comment #10)
> Is this considered to be "fixed" now? Cause the ticket is still
> open...

Unfortunately is not. The patch is not included in the mainstream version which is supplied by most of the linux distribution.

For instance with openssh 6.2p2-1 supplied by Arch Linux '#man ssh_config' doesn't know anything about the directive 'GSSAPITrustDNS' and I'm not able to resolve DNSs.

This is really crazy: a patch has been there since 7 years ago, but still not fixed!
Comment 12 kgizdov 2016-07-16 02:38:33 AEST
I just wanted to chime in here to say that this is still not fixed. I am having serious issue with not being able to use kerberos. Why has the patch not been merged since 2006?
Comment 13 Darren Tucker 2016-07-18 10:19:54 AEST
well it was never ported to openbsd upstream (see comment #9) and in its current form won't compile because the get_canonical_hostname() it uses doesn't exist any more.
Comment 14 Mike Frysinger 2016-08-04 10:23:38 AEST
(In reply to Darren Tucker from comment #13)

the original patch written in 2006 was against openbsd cvs, and it included a config option to turn it on/off (with the default being off).  it largely applied cleanly up through 7.2 until the get_canonical_hostname refactor.

since that func only lives in auth.c now, how do you want it to work ?  basically have to revert the get_canonical_hostname -> auth_get_canonical_hostname change to make it work.
Comment 15 Colin Watson 2016-08-08 09:56:00 AEST
I think it would make a degree of sense to move remote_hostname back to canohost.c and give it external linkage.  The commit message for that refactoring said that it was removing all the caching from canohost.c, but only (auth_)get_canonical_hostname has that, not the underlying remote_hostname function.

Given that, it's easy to make the GSSAPI bits use remote_hostname rather than get_canonical_hostname, although I think it's best to also make kex->gss_host be allocated rather than relying on sharing memory with something else.  I've done this in the latest Debian patch set.
Comment 16 kgizdov 2016-08-18 01:46:38 AEST
Apparently, some good Samaritan already made patches compatible with the current version of OpenSSH. There is a package on the Arch User Repo (openssh-gssapi 7.1p2-1) that implements them. Here are the patches themselves:

https://aur.archlinux.org/cgit/aur.git/tree/gssapi-p0.patch?h=openssh-gssapi
https://aur.archlinux.org/cgit/aur.git/tree/gssapi-p1.patch?h=openssh-gssapi
https://aur.archlinux.org/cgit/aur.git/tree/gssapi-p2.patch?h=openssh-gssapi

I hope this helps.
Comment 17 Darren Tucker 2016-08-19 13:30:54 AEST
(In reply to kgizdov from comment #16)
 > I hope this helps.

Not really.  Those have a lot of other changes (mostly the GSSAPI key exchange support) and it still uses get_canonical_hostname() which is currently not available in the client.

According to Damien reasoning behind moving get_canonical_hostname was to remove anything that maintained state from canohost.c to make more useable in library code.  We'll have a look at making it available in the client somehow.
Comment 18 Jhon Merced 2017-10-28 01:13:19 AEDT
Hey guys, what's the status here? 12 years later, still NEW ;) Had problems with this recently when working on one of our sites. https://www.mrkortingscode.nl