Skip site navigation (1) Skip section navigation (2)

Re: Should database = all in pg_hba.conf match a replication connection?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Should database = all in pg_hba.conf match a replication connection?
Date: 2010-04-20 23:06:20
Message-ID: 4989.1271804780@sss.pgh.pa.us (view raw)
I spent a fair amount of time just now being confused about why
pg_hba.conf restrictions on replication connections didn't seem to be
getting enforced.  After looking at the code, I realize that my entry
with database = "replication" was indeed getting rejected as not
matching, but then the hba code was falling through and matching an
entry with database = "all".  This is not the behavior I expected after
looking at the docs; the docs seem to imply that SR connections must
match an explicit replication entry in pg_hba.conf in order to succeed.

Should we change this?  It seems to me to be a good thing on security
grounds if replication connections can't be made through a generic
pg_hba entry.  If we don't change it, the docs need some adjustment.

			regards, tom lane

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)postgreSQL(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Should database = all in pg_hba.conf match a replication connection?
Date: 2010-04-20 23:49:24
Message-ID: 4927198544210548164@unknownmsgid (view raw)
On Apr 20, 2010, at 7:06 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I spent a fair amount of time just now being confused about why
> pg_hba.conf restrictions on replication connections didn't seem to be
> getting enforced.  After looking at the code, I realize that my entry
> with database = "replication" was indeed getting rejected as not
> matching, but then the hba code was falling through and matching an
> entry with database = "all".  This is not the behavior I expected
> after
> looking at the docs; the docs seem to imply that SR connections must
> match an explicit replication entry in pg_hba.conf in order to
> succeed.
>
> Should we change this?  It seems to me to be a good thing on security
> grounds if replication connections can't be made through a generic
> pg_hba entry.

+1.

...Robert

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-hackers(at)postgreSQL(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Should database = all in pg_hba.conf match a replication connection?
Date: 2010-04-21 01:52:51
Message-ID: o2r3f0b79eb1004201852l69b2bfb5t3df8d961600ba1da@mail.gmail.com (view raw)
On Wed, Apr 21, 2010 at 8:49 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Apr 20, 2010, at 7:06 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> I spent a fair amount of time just now being confused about why
>> pg_hba.conf restrictions on replication connections didn't seem to be
>> getting enforced.  After looking at the code, I realize that my entry
>> with database = "replication" was indeed getting rejected as not
>> matching, but then the hba code was falling through and matching an
>> entry with database = "all".  This is not the behavior I expected
>> after
>> looking at the docs; the docs seem to imply that SR connections must
>> match an explicit replication entry in pg_hba.conf in order to
>> succeed.
>>
>> Should we change this?  It seems to me to be a good thing on security
>> grounds if replication connections can't be made through a generic
>> pg_hba entry.
>
> +1.

+1 too.

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgreSQL(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Should database = all in pg_hba.conf match a replication connection?
Date: 2010-04-21 03:33:19
Message-ID: 13850.1271820799@sss.pgh.pa.us (view raw)
Fujii Masao <masao(dot)fujii(at)gmail(dot)com> writes:
> On Wed, Apr 21, 2010 at 8:49 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> On Apr 20, 2010, at 7:06 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> Should we change this? It seems to me to be a good thing on security
>>> grounds if replication connections can't be made through a generic
>>> pg_hba entry.
>> 
>> +1.

> +1 too.

Done.

			regards, tom lane

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Should database = all in pg_hba.conf match a replication connection?
Date: 2010-04-21 20:11:08
Message-ID: 1271880668.8305.28808.camel@ebony (view raw)
On Tue, 2010-04-20 at 19:06 -0400, Tom Lane wrote:

> Should we change this?  It seems to me to be a good thing on security
> grounds if replication connections can't be made through a generic
> pg_hba entry.

That's a good change.

-- 
 Simon Riggs           www.2ndQuadrant.com



Privacy Policy | About PostgreSQL
Copyright © 1996-2013 The PostgreSQL Global Development Group