pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Magnus Hagander <magnus@hagander.net>
Cc: Christopher Head <chris2k01@hotmail.com>
Cc: pgsql-bugs <pgsql-bugs@postgresql.org>
Subject: Re: BUG #5559: Full SSL verification fails when hostaddr provided
Date: Wed, 14 Jul 2010 17:44:03 -0400
Message-ID: <20100714214403.GQ21875@tamriel.snowman.net> (raw)
In-Reply-To: <18347.1279143321@sss.pgh.pa.us>
References: <18252.1279058967@sss.pgh.pa.us>
	<AANLkTikEU91MMvOXTrXkf7TGF8KZPRoBNh7csEeSy6ag@mail.gmail.com>
	<6811.1279123338@sss.pgh.pa.us>
	<7342.1279124972@sss.pgh.pa.us>
	<20100714173942.GM21875@tamriel.snowman.net>
	<9371.1279130114@sss.pgh.pa.us>
	<20100714183240.GO21875@tamriel.snowman.net>
	<10950.1279135209@sss.pgh.pa.us>
	<20100714212805.GP21875@tamriel.snowman.net>
	<18347.1279143321@sss.pgh.pa.us>

* Tom Lane (tgl@sss.pgh.pa.us) wrote:
> Stephen Frost <sfrost@snowman.net> writes:
> >      krb5_sname_to_principal() will use the passed hostname for the second
> >      component.  If type is KRB5_NT_SRV_HST this name will be looked up with
> >      gethostbyname().  If hostname is NULL, the local hostname will be used.
> 
> > If we were passing in NULL before when hostaddr was set and host wasn't,
> > then we were probably ending up with Kerberos trying to use the local
> > hostname, which almost certainly wasn't right.
> 
> Ah.  I agree that that would be unexpected behavior.
> 
> > I expect that the
> > correct answer here would be to do whatever the actual connection logic
> > does- if it connects using host, then use host, if it connects using
> > hostaddr, then use hostaddr.
> 
> Uh, no, because hostaddr is (required to be) a numeric IP.  The odds of
> it being useful in this context seem negligible.

Err, no, it'll work just fine- gethostbyname() will take the dotted-quad
numeric IP and return the hostname and Kerberos will use that to generate
the principal.  Maybe I'm missing something, but hostaddr being an IP is
just like if you passed in host with an IP, which I believe is what psql
does when called like so:

beren:/home/sfrost> psql -h 172.18.148.12 -d gis
Welcome to psql 8.3.7, the PostgreSQL interactive terminal.

and that certainly works just fine.

beren:/home/sfrost> klist
[...]
07/14/10 17:37:50  07/14/10 17:58:25  postgres/beren.tsf.noblis.org@TSF.NOBLIS.ORG

> At this point I'm satisfied that what the code is doing is right.  We
> can't authenticate against Kerberos without knowing the server host
> name, because we can't form a correct principal name.  Whether use of
> hostaddr would avoid an rDNS lookup inside the library is not relevant.

I don't believe anything is going to avoid an rDNS lookup except bombing
out before invoking krb5_sname_to_principal().  Perhaps that's what's
intended, to avoid any DNS lookup, but I don't believe it's because it
wouldn't *work* to give krb5_sname_to_principal() an IP address 
(provided rDNS is, in fact, functional in your environment).

	Thanks,

		Stephen

Attachments:

  signature.asc (application/pgp-signature, 196B) download

view thread (26+ messages)  latest in thread

Message-ID: <20100714214403.GQ21875@tamriel.snowman.net>
Permalink:  ../20100714214403.GQ21875@tamriel.snowman.net/
Also on:    postgresql.org/message-id/20100714214403.GQ21875@tamriel.snowman.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: sfrost@snowman.net, tgl@sss.pgh.pa.us, magnus@hagander.net, chris2k01@hotmail.com
  Subject: Re: BUG #5559: Full SSL verification fails when hostaddr provided
  In-Reply-To: <20100714214403.GQ21875@tamriel.snowman.net>
  References: <18252.1279058967@sss.pgh.pa.us> <AANLkTikEU91MMvOXTrXkf7TGF8KZPRoBNh7csEeSy6ag@mail.gmail.com> <6811.1279123338@sss.pgh.pa.us> <7342.1279124972@sss.pgh.pa.us> <20100714173942.GM21875@tamriel.snowman.net> <9371.1279130114@sss.pgh.pa.us> <20100714183240.GO21875@tamriel.snowman.net> <10950.1279135209@sss.pgh.pa.us> <20100714212805.GP21875@tamriel.snowman.net> <18347.1279143321@sss.pgh.pa.us> <20100714214403.GQ21875@tamriel.snowman.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox