Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W4Tpo-00016x-26 for pgsql-admin@arkaria.postgresql.org; Sat, 18 Jan 2014 11:13:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W4Tpm-0004SD-FP for pgsql-admin@arkaria.postgresql.org; Sat, 18 Jan 2014 11:13:02 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W4Tpl-0004S6-8P for pgsql-admin@postgresql.org; Sat, 18 Jan 2014 11:13:01 +0000 Received: from mail-wi0-f179.google.com ([209.85.212.179]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W4Tph-0005X3-FP for pgsql-admin@postgresql.org; Sat, 18 Jan 2014 11:13:00 +0000 Received: by mail-wi0-f179.google.com with SMTP id hr1so1672462wib.0 for ; Sat, 18 Jan 2014 03:12:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=eygFN/bhofqZqe5cKWr/MkUiLtmcX+vA4MNsS2UQYbc=; b=T5sED3Inls2Jmm5fasuqxmpoQQX9WYz1a92+G8Fhhm76J0WK4poAI637Va5d/CaRpA C5HP842Qw5IAbiwtMNICWgejqJmRa1wMfE03CT+RPGATlHBLYeqB/GeEIr000ZUhte/w E+eo3xOJsTagf1Hib8i1DV/401wHxDMcts4J0S7bsbkOw/QCO5A1swiDIPDQFSjwDya6 tuOXwYIaup5a0WmlPG+GRscCmVknALZGfIueXZcdiemGkmWdkXkEFymh29cEkvBakNqw 408SoPrmdfjltW/zKds5jzzzwQkQ6KXOpRJJCCBkSXTgcF5vzEPlNeusfnQbrwZyOsyq BO2Q== X-Gm-Message-State: ALoCoQmQR+Yvm9Coa9IeYu/4XHCNXVgCDPcx3CqErjHxh5q+rINjhodWO0OcHBazka47FKgG392w MIME-Version: 1.0 X-Received: by 10.194.142.231 with SMTP id rz7mr131882wjb.89.1390043575749; Sat, 18 Jan 2014 03:12:55 -0800 (PST) Received: by 10.194.188.10 with HTTP; Sat, 18 Jan 2014 03:12:55 -0800 (PST) In-Reply-To: References: Date: Sat, 18 Jan 2014 12:12:55 +0100 Message-ID: Subject: Re: Postgresql v9.2.4 Kerberos Client Authentication From: Magnus Hagander To: Murthy Nunna Cc: "pgsql-admin@postgresql.org" Content-Type: multipart/alternative; boundary=089e0122e7fa8e2b4c04f03cbd22 X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org --089e0122e7fa8e2b4c04f03cbd22 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On Fri, Jan 17, 2014 at 11:00 PM, Murthy Nunna wrote: > Hello PG Admins, > > > > I am new to postgres and also to the list. I am glad I found this domain > list for help. > > > > I am setting up streaming replication using Virtaul IP. > > > > Server1 is primary which has its own server IP address > > Server2 is standby which has its own server IP address > > > > We created a virtual IP (say pgvip) which is different from server IPs. > This IP will move between server1 and server2 to help provide application > transparency. Application uses =93pgvip=94, so when the standby is conver= ted to > serve as primary, we move the virtual IP from server1 to server2 and simp= ly > bring up the application with no changes. That is the idea. > > > > Everything works fine EXCEPT Kerberos client authentication. We put both > server key (postgres/server1@fnal.gov) and VIP key ( > postgres/pgvip@fnal.gov) in the keytab but it still doesn=92t work. When = I > specify physical hostname in the connect string of the client, Kerberos i= s > able to authenticate. But when =93pgvip=94 is used it fails. > > > > Following is what I have in my postgresql.conf: > > > > krb_server_keyfile =3D '/home/postgres/krb5/keytab' > > krb_srvname =3D 'postgres=92 > > > > I also tried krb_server_hostname in pg_hba file as below. It didn=92t wor= k > either. May be this is supposed to work but it may be wrong syntactically= . > > > > host all mnunna 0.0.0.0/0 krb5 > krb_server_hostname=3D'minos-ecl-pgvip' > > > > Please help. Is what we are trying supported in postgres? If so, please > help me point in the right direction. > > > First of all, note that krb5 has been deprecated for several releases now, and you should probably be using "gss". That will use Kerberos "under the hood", but do so using a standard protocol. Second - Kerberos is notoriously sensitive to DNS setups. Make sure you have both forward and reverse lookups working correctly for the VIP address. I've also generally seen better results if you use the FQDN of the hosts - both when accessing them and of course in they keys. I would remove the server key from the keytab - it's supposed to pick it automatically, but I've seen issues sometimes with some kerberos libraries where it hasn't worked. (The last two points are generic Kerberos points and not directly about PostgreSQL of course) --=20 Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/ --089e0122e7fa8e2b4c04f03cbd22 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable
On F= ri, Jan 17, 2014 at 11:00 PM, Murthy Nunna <mnunna@fnal.gov> w= rote:

Hello PG Admins,

=A0

I am new to postgres and also to the list. I am glad= I found this domain list for help.

=A0

I am setting up streaming replication using Virtaul = IP.

=A0

Server1 is primary which has its own server IP addre= ss

Server2 is standby which has its own server IP addre= ss

=A0

We created a virtual IP (say pgvip) which is differe= nt from server IPs. This IP will move between server1 and server2 to help p= rovide application transparency. Application uses =93pgvip=94, so when the = standby is converted to serve as primary, we move the virtual IP from server1 to server2 and simply bring up the app= lication with no changes. That is the idea.

=A0

Everything works fine EXCEPT Kerberos client authent= ication. We put both server key (postgres/server1@fnal.gov) and VIP key (postgres/pgvip@fnal.gov<= /a>) in the keytab but it still doesn=92t work. When I specify physical hostnam= e in the connect string of the client, Kerberos is able to authenticate. Bu= t when =93pgvip=94 is used it fails.

=A0

Following is what I have in my postgresql.conf:

=A0

krb_server_keyfile =3D '/home/postgres/kr= b5/keytab'

= krb_srvname =3D 'postgres=92

=A0

I also tried krb_server_hostname in pg_hba file as b= elow. It didn=92t work either. May be this is supposed to work but it may b= e wrong syntactically.

=A0

= host=A0=A0 all=A0=A0=A0 =A0=A0=A0=A0=A0mnunna=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0 0.0.0.0/0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 krb5 krb_server_hostname=3D'minos-ecl-pgvip= 9;

=A0

Please help. Is what we are trying supported in post= gres? If so, please help me point in the right direction.



First of all, note that krb5 has been deprecated for several releases now,= and you should probably be using "gss". That will use Kerberos &= quot;under the hood", but do so using a standard protocol.

Second - Kerberos is notoriously sensitive to DNS setup= s. Make sure you have both forward and reverse lookups working correctly fo= r the VIP address. I've also generally seen better results if you use t= he FQDN of the hosts - both when accessing them and of course in they keys.=

I would remove the server key from the keytab - it'= s supposed to pick it automatically, but I've seen issues sometimes wit= h some kerberos libraries where it hasn't worked.

(The last two points are generic Kerberos points and not directl= y about PostgreSQL of course)

--
=A0Magnus Hagander=
=A0Me: http://ww= w.hagander.net/
=A0Work: http:= //www.redpill-linpro.com/
--089e0122e7fa8e2b4c04f03cbd22--