superusers are members of all roles?

Lists: pgsql-hackers
From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: superusers are members of all roles?
Date: 2011-04-06 23:04:42
Message-ID: 4D9CF18A.503@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


I just hit this, which at least violated my sense of least astonishment,
if it's not an outright bug:

After creating a role foo, I added to following lines to my (9.0)
pg_hba.conf:

local all +foo reject
host all +foo 0.0.0.0/0 reject

The surprising (to me) consequence was that every superuser was locked
out of the system. I had not granted them (or anyone) the role, but
nevertheless these lines took effect.

If this is intended, it should at least be documented. But if it is
intended then it's ugly anyway, IMNSHO, and we should change it.

cheers

andrew


From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: superusers are members of all roles?
Date: 2011-04-06 23:54:06
Message-ID: 20110406235406.GC4548@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

* Andrew Dunstan (andrew(at)dunslane(dot)net) wrote:
> The surprising (to me) consequence was that every superuser was
> locked out of the system. I had not granted them (or anyone) the
> role, but nevertheless these lines took effect.

As I recall, the way we allow superusers to set role to other roles is
by considering the superuser to be a member of every role. Now, I agree
that such an approach doesn't make sense for pg_hba consideration.

> If this is intended, it should at least be documented. But if it is
> intended then it's ugly anyway, IMNSHO, and we should change it.

Perhaps the superuser-override should be moved to be at the 'set role'
level instead of setting things up such that the superuser is considered
a member of every role. That would fix this but would require adding a
couple of additional special superuser checks, which isn't something to
do lightly, imv.

Thanks,

Stephen


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: superusers are members of all roles?
Date: 2011-04-07 03:54:45
Message-ID: BANLkTi=StxfiyNxwFPRasGs92P=33ymXqA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Apr 6, 2011 at 7:54 PM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
> * Andrew Dunstan (andrew(at)dunslane(dot)net) wrote:
>> The surprising (to me) consequence was that every superuser was
>> locked out of the system. I had not granted them (or anyone) the
>> role, but nevertheless these lines took effect.
>
> As I recall, the way we allow superusers to set role to other roles is
> by considering the superuser to be a member of every role.  Now, I agree
> that such an approach doesn't make sense for pg_hba consideration.

See bug #5763, and subsequent emails. Short version: Tom argued it
wasn't a bug; Peter and I felt that it was.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: superusers are members of all roles?
Date: 2011-04-07 04:21:58
Message-ID: 4D9D3BE6.7000303@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


> See bug #5763, and subsequent emails. Short version: Tom argued it
> wasn't a bug; Peter and I felt that it was.

Add my vote: it's a bug.

Users who fall afoul of this will spend *hours* trying to debug this
before they stumble on the correct answer. pg_hba.conf is confusing
enough as it is.

The only reason we don't get more bug reports on this is that not very
many users know about using group roles in pg_hba.conf (and few enough
users are using group roles in the first place).

If we're not going to fix this, then we need a big warning in the docs
and the pg_hba.conf file:

"NOTE: Please make sure that at least one rule in pg_hba.conf matches
superuser access before any reject rules"

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: superusers are members of all roles?
Date: 2011-04-07 04:29:17
Message-ID: 27479.1302150557@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Wed, Apr 6, 2011 at 7:54 PM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
>> * Andrew Dunstan (andrew(at)dunslane(dot)net) wrote:
>>> The surprising (to me) consequence was that every superuser was
>>> locked out of the system. I had not granted them (or anyone) the
>>> role, but nevertheless these lines took effect.

>> As I recall, the way we allow superusers to set role to other roles is
>> by considering the superuser to be a member of every role. Now, I agree
>> that such an approach doesn't make sense for pg_hba consideration.

> See bug #5763, and subsequent emails. Short version: Tom argued it
> wasn't a bug; Peter and I felt that it was.

The problem here is that if Andrew had had the opposite case (a
positive-logic hba entry requiring membership in some group to get into
a database), and that had locked out superusers, he'd be on the warpath
about that too. And with a lot more reason.

Therefore, "fixing" this without introducing even-more-surprising
behaviors is going to be a very ticklish business. I remain on the side
of the fence that says it's not a bug.

regards, tom lane


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: superusers are members of all roles?
Date: 2011-04-07 04:45:48
Message-ID: 4D9D417C.7060707@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


> The problem here is that if Andrew had had the opposite case (a
> positive-logic hba entry requiring membership in some group to get into
> a database), and that had locked out superusers, he'd be on the warpath
> about that too. And with a lot more reason.

Actually, I find that behavior surprising -- and undesirable -- too.
Enough so that I'm going to have to modify the pg_hba.conf on a couple
of production databases tommorrow.

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: superusers are members of all roles?
Date: 2011-04-07 04:49:02
Message-ID: 4D9D423E.5080902@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 04/07/2011 12:29 AM, Tom Lane wrote:
> Robert Haas<robertmhaas(at)gmail(dot)com> writes:
>> On Wed, Apr 6, 2011 at 7:54 PM, Stephen Frost<sfrost(at)snowman(dot)net> wrote:
>>> * Andrew Dunstan (andrew(at)dunslane(dot)net) wrote:
>>>> The surprising (to me) consequence was that every superuser was
>>>> locked out of the system. I had not granted them (or anyone) the
>>>> role, but nevertheless these lines took effect.
>>> As I recall, the way we allow superusers to set role to other roles is
>>> by considering the superuser to be a member of every role. Now, I agree
>>> that such an approach doesn't make sense for pg_hba consideration.
>> See bug #5763, and subsequent emails. Short version: Tom argued it
>> wasn't a bug; Peter and I felt that it was.
> The problem here is that if Andrew had had the opposite case (a
> positive-logic hba entry requiring membership in some group to get into
> a database), and that had locked out superusers, he'd be on the warpath
> about that too. And with a lot more reason.

In such a case I could add the superusers to the role explicitly, or
make the rule cover superusers as well. But as the situation is now, any
rule covering a group covers superusers, whether I want it to or not.
I'd rather have a choice in the matter (and it's clear I'm not alone in
that).

The introduction of hot standby has made this pattern more likely to
occur. It happened here because we have a bunch of users that are
allowed to connect to the standby but not to the master, and the rules I
was trying to implement were designed to enforce that exclusion.

cheers

andrew


From: Alastair Turner <bell(at)ctrlf5(dot)co(dot)za>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: superusers are members of all roles?
Date: 2011-04-07 07:48:36
Message-ID: BANLkTikmmW92K7RuXjEgHv5RGaD6h5eSsg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Apr 7, 2011 at 6:49 AM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>
> On 04/07/2011 12:29 AM, Tom Lane wrote:
>>
>> Robert Haas<robertmhaas(at)gmail(dot)com>  writes:
>>>
>>> On Wed, Apr 6, 2011 at 7:54 PM, Stephen Frost<sfrost(at)snowman(dot)net>  wrote:
>>>>
>>>> * Andrew Dunstan (andrew(at)dunslane(dot)net) wrote:
>>>>>
>>>>> The surprising (to me) consequence was that every superuser was
>>>>> locked out of the system. I had not granted them (or anyone) the
>>>>> role, but nevertheless these lines took effect.
>>>>
>>>> As I recall, the way we allow superusers to set role to other roles is
>>>> by considering the superuser to be a member of every role. Now, I agree
>>>> that such an approach doesn't make sense for pg_hba consideration.
>>>
>>> See bug #5763, and subsequent emails.  Short version: Tom argued it
>>> wasn't a bug; Peter and I felt that it was.
>>
>> The problem here is that if Andrew had had the opposite case (a
>> positive-logic hba entry requiring membership in some group to get into
>> a database), and that had locked out superusers, he'd be on the warpath
>> about that too.  And with a lot more reason.
>
> In such a case I could add the superusers to the role explicitly, or make
> the rule cover superusers as well. But as the situation is now, any rule
> covering a group covers superusers, whether I want it to or not. I'd rather
> have a choice in the matter (and it's clear I'm not alone in that).
>
> The introduction of hot standby has made this pattern more likely to occur.
> It happened here because we have a bunch of users that are allowed to
> connect to the standby but not to the master, and the rules I was trying to
> implement were designed to  enforce that exclusion.
>
Is the solution possibly to assign positive entries on the basis of
the superuser being a member of all groups but require negative
entries to explicitly specify that they apply to superuser?

That would provide least surprise for the simplistic concept of
superuser - a user who can do anything any other user can - and allow
for superuser remote access to be restricted if desired.


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Alastair Turner <bell(at)ctrlf5(dot)co(dot)za>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: superusers are members of all roles?
Date: 2011-04-07 10:33:08
Message-ID: 4D9D92E4.8080205@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 04/07/2011 03:48 AM, Alastair Turner wrote:
>>>
>>> The problem here is that if Andrew had had the opposite case (a
>>> positive-logic hba entry requiring membership in some group to get into
>>> a database), and that had locked out superusers, he'd be on the warpath
>>> about that too. And with a lot more reason.
>> In such a case I could add the superusers to the role explicitly, or make
>> the rule cover superusers as well. But as the situation is now, any rule
>> covering a group covers superusers, whether I want it to or not. I'd rather
>> have a choice in the matter (and it's clear I'm not alone in that).
>>
>> The introduction of hot standby has made this pattern more likely to occur.
>> It happened here because we have a bunch of users that are allowed to
>> connect to the standby but not to the master, and the rules I was trying to
>> implement were designed to enforce that exclusion.
>>
> Is the solution possibly to assign positive entries on the basis of
> the superuser being a member of all groups but require negative
> entries to explicitly specify that they apply to superuser?
>
> That would provide least surprise for the simplistic concept of
> superuser - a user who can do anything any other user can - and allow
> for superuser remote access to be restricted if desired.
>

I think that's just about guaranteed to produce massive confusion. +foo
should mean one thing, regardless of the rule type. I seriously doubt
that very many people who work with this daily would agree with Tom's
argument about what that should be.

cheers

andrew


From: Christian Ullrich <chris(at)chrullrich(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: superusers are members of all roles?
Date: 2011-04-07 11:33:48
Message-ID: ink7es$4ub$1@dough.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

* Andrew Dunstan wrote:

> On 04/07/2011 03:48 AM, Alastair Turner wrote:

>> Is the solution possibly to assign positive entries on the basis of
>> the superuser being a member of all groups but require negative
>> entries to explicitly specify that they apply to superuser?

> I think that's just about guaranteed to produce massive confusion. +foo
> should mean one thing, regardless of the rule type. I seriously doubt
> that very many people who work with this daily would agree with Tom's
> argument about what that should be.

What about adding a second group syntax that only evaluates explicit
memberships? That way, everyone could pick which behavior they liked
better, and Alastair's suggestion could be done that way, too:

host all *personae_non_gratae 0.0.0.0/0 reject
host all +foo 0.0.0.0/0 md5

If, as Josh said, few users even know about the old syntax, there should
not be much potential for confusion in adding a new one.

Additionally, most things that can be done with groups in pg_hba.conf
can also be done using CONNECT privilege on databases.

--
Christian


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Christian Ullrich <chris(at)chrullrich(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: superusers are members of all roles?
Date: 2011-04-07 12:01:16
Message-ID: 4D9DA78C.6030604@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 04/07/2011 07:33 AM, Christian Ullrich wrote:
> * Andrew Dunstan wrote:
>
>> On 04/07/2011 03:48 AM, Alastair Turner wrote:
>
>>> Is the solution possibly to assign positive entries on the basis of
>>> the superuser being a member of all groups but require negative
>>> entries to explicitly specify that they apply to superuser?
>
>> I think that's just about guaranteed to produce massive confusion. +foo
>> should mean one thing, regardless of the rule type. I seriously doubt
>> that very many people who work with this daily would agree with Tom's
>> argument about what that should be.
>
> What about adding a second group syntax that only evaluates explicit
> memberships? That way, everyone could pick which behavior they liked
> better, and Alastair's suggestion could be done that way, too:
>
> host all *personae_non_gratae 0.0.0.0/0 reject
> host all +foo 0.0.0.0/0 md5
>
> If, as Josh said, few users even know about the old syntax, there
> should not be much potential for confusion in adding a new one.

I thought about that. What I'd like to know is how many people actually
want and use and expect the current behaviour. If it's more than a
handful (which I seriously doubt) then that's probably the way to go.
Otherwise it seems more trouble than it's worth.

>
> Additionally, most things that can be done with groups in pg_hba.conf
> can also be done using CONNECT privilege on databases.

In my case this won't work at all, since what I need is to allow the
group access on a hot standby but prevent it on the master, and the
CONNECT privs will be the same on both. We also don't have negative
privileges analogous to "reject" lines.

cheers

aqndrew


From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: superusers are members of all roles?
Date: 2011-04-07 14:14:39
Message-ID: 20110407141439.GD4548@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

* Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> The problem here is that if Andrew had had the opposite case (a
> positive-logic hba entry requiring membership in some group to get into
> a database), and that had locked out superusers, he'd be on the warpath
> about that too. And with a lot more reason.

I disagree about this. I don't feel that the 'superuser is a member of
every role' behavior is what's really crucial here, it's that a
superuser can 'set role' to any other role and can grant/revoke
role memberships, and read every table, etc.

The fact that we're doing that by making the superuser be a member of
every role feels more like an implementation detail- one which has now
bitten us because it's affecting things that it really shouldn't. The
'+group' list should be derivable from pg_auth_members and not include
'implicit' roles.

Thanks,

Stephen


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Christian Ullrich <chris(at)chrullrich(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: superusers are members of all roles?
Date: 2011-04-07 15:01:19
Message-ID: 13051.1302188479@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> I thought about that. What I'd like to know is how many people actually
> want and use and expect the current behaviour. If it's more than a
> handful (which I seriously doubt) then that's probably the way to go.
> Otherwise it seems more trouble than it's worth.

Well, the point here is that "is_member_of" is currently considered
to be a kind of privilege test, and of course superusers should
automatically pass every privilege test. If you want it to not act
that way in some circumstances, we need a fairly clear theory as to
which circumstances it should act which way in.

regards, tom lane


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: superusers are members of all roles?
Date: 2011-04-07 15:26:29
Message-ID: 4D9DD7A5.6080904@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 04/07/2011 11:01 AM, Tom Lane wrote:
> Andrew Dunstan<andrew(at)dunslane(dot)net> writes:
>> I thought about that. What I'd like to know is how many people actually
>> want and use and expect the current behaviour. If it's more than a
>> handful (which I seriously doubt) then that's probably the way to go.
>> Otherwise it seems more trouble than it's worth.
> Well, the point here is that "is_member_of" is currently considered
> to be a kind of privilege test, and of course superusers should
> automatically pass every privilege test. If you want it to not act
> that way in some circumstances, we need a fairly clear theory as to
> which circumstances it should act which way in.
>
>

Personally, other things being equal I would expect things to operate
similarly to Unix groups, where root can do just about anything but is
only actually a member of a small number of groups:

[root(at)emma ~]# groups
root bin daemon sys adm disk wheel

I bet most DBAs and SAs would expect the same.

The HBA file is the most obvious context in which this actually matters,
and off hand I can't think of another.

cheers

andrew


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: superusers are members of all roles?
Date: 2011-05-08 03:42:57
Message-ID: 201105080342.p483gvm16165@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andrew Dunstan wrote:
>
>
> On 04/07/2011 11:01 AM, Tom Lane wrote:
> > Andrew Dunstan<andrew(at)dunslane(dot)net> writes:
> >> I thought about that. What I'd like to know is how many people actually
> >> want and use and expect the current behaviour. If it's more than a
> >> handful (which I seriously doubt) then that's probably the way to go.
> >> Otherwise it seems more trouble than it's worth.
> > Well, the point here is that "is_member_of" is currently considered
> > to be a kind of privilege test, and of course superusers should
> > automatically pass every privilege test. If you want it to not act
> > that way in some circumstances, we need a fairly clear theory as to
> > which circumstances it should act which way in.
> >
> >
>
> Personally, other things being equal I would expect things to operate
> similarly to Unix groups, where root can do just about anything but is
> only actually a member of a small number of groups:
>
> [root(at)emma ~]# groups
> root bin daemon sys adm disk wheel
>
> I bet most DBAs and SAs would expect the same.
>
> The HBA file is the most obvious context in which this actually matters,
> and off hand I can't think of another.

Is this a TODO?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: superusers are members of all roles?
Date: 2011-05-09 11:53:50
Message-ID: BANLkTikwCnNLrqhzQkqztaacNbe1pAbgkw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sat, May 7, 2011 at 11:42 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> Is this a TODO?

I think so.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: superusers are members of all roles?
Date: 2011-09-10 03:34:45
Message-ID: 201109100334.p8A3YjN21452@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Robert Haas wrote:
> On Sat, May 7, 2011 at 11:42 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> > Is this a TODO?
>
> I think so.

Added to TODO:

Address problem where superusers are assumed to be members of all groups

http://archives.postgresql.org/pgsql-hackers/2011-04/msg00337.php

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: superusers are members of all roles?
Date: 2011-09-12 01:40:13
Message-ID: 4E6D62FD.4070908@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 09/09/2011 11:34 PM, Bruce Momjian wrote:
> Robert Haas wrote:
>> On Sat, May 7, 2011 at 11:42 PM, Bruce Momjian<bruce(at)momjian(dot)us> wrote:
>>> Is this a TODO?
>> I think so.
> Added to TODO:
>
> Address problem where superusers are assumed to be members of all groups
>
> http://archives.postgresql.org/pgsql-hackers/2011-04/msg00337.php

This turns out to be a one-liner.

Patch attached.

cheers

andrew

Attachment Content-Type Size
nosuperhbagroup.patch text/x-patch 700 bytes

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: superusers are members of all roles?
Date: 2011-09-12 02:32:07
Message-ID: 20110912023207.GQ12765@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

* Andrew Dunstan (andrew(at)dunslane(dot)net) wrote:
> > Address problem where superusers are assumed to be members of all groups
> >
> > http://archives.postgresql.org/pgsql-hackers/2011-04/msg00337.php
>
> This turns out to be a one-liner.

I really don't know that I agree with removing this, to be honest.. I
haven't got time at the moment to really discuss it, but at the very
least, not being able to 'set role' to any user when postgres would be
REALLY annoying..

Thanks,

Stephen


From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Bruce Momjian <bruce(at)momjian(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: superusers are members of all roles?
Date: 2011-09-12 03:27:40
Message-ID: CA+TgmobBa+C3cDx1hJ-YbD+jpYb8WEjvg=yE=s7rz3cYOrhy5w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Sep 11, 2011 at 10:32 PM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
> * Andrew Dunstan (andrew(at)dunslane(dot)net) wrote:
>> >     Address problem where superusers are assumed to be members of all groups
>> >
>> >         http://archives.postgresql.org/pgsql-hackers/2011-04/msg00337.php
>>
>> This turns out to be a one-liner.
>
> I really don't know that I agree with removing this, to be honest..  I
> haven't got time at the moment to really discuss it, but at the very
> least, not being able to 'set role' to any user when postgres would be
> REALLY annoying..

Sure. But I don't believe anyone has proposed changing that. What
we're talking about here is that, for example, setting a reject rule
for a certain group in pg_hba.conf will always match superusers, even
though they're not in that group.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: superusers are members of all roles?
Date: 2011-09-12 03:29:59
Message-ID: 4E6D7CB7.3060200@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 09/11/2011 10:32 PM, Stephen Frost wrote:
> * Andrew Dunstan (andrew(at)dunslane(dot)net) wrote:
>>> Address problem where superusers are assumed to be members of all groups
>>>
>>> http://archives.postgresql.org/pgsql-hackers/2011-04/msg00337.php
>> This turns out to be a one-liner.
> I really don't know that I agree with removing this, to be honest.. I
> haven't got time at the moment to really discuss it, but at the very
> least, not being able to 'set role' to any user when postgres would be
> REALLY annoying..
>
>

It's NOT changing that. All this affects is how +groupname is treated in
pg_hba.conf, i.e. do we treat every superuser there as being a member of
every group.

cheers

andrew


From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: superusers are members of all roles?
Date: 2011-09-12 09:55:42
Message-ID: 20110912095542.GR12765@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

* Andrew Dunstan (andrew(at)dunslane(dot)net) wrote:
> It's NOT changing that. All this affects is how +groupname is
> treated in pg_hba.conf, i.e. do we treat every superuser there as
> being a member of every group.

Ah, sorry for the noise, that's fine (and I'm bit suprised it was a
one-liner, guess I should go look at the patch... ;).

Thanks,

Stephen


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: superusers are members of all roles?
Date: 2011-11-02 19:27:28
Message-ID: 4EB199A0.6070300@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 09/11/2011 09:40 PM, Andrew Dunstan wrote:
>
>
> On 09/09/2011 11:34 PM, Bruce Momjian wrote:
>> Robert Haas wrote:
>>> On Sat, May 7, 2011 at 11:42 PM, Bruce Momjian<bruce(at)momjian(dot)us>
>>> wrote:
>>>> Is this a TODO?
>>> I think so.
>> Added to TODO:
>>
>> Address problem where superusers are assumed to be members of all
>> groups
>>
>>
>> http://archives.postgresql.org/pgsql-hackers/2011-04/msg00337.php
>
> This turns out to be a one-liner.
>
>

Patch with a small docs addition also. Adding to Nov commitfest.

cheers

andrew

Attachment Content-Type Size
nosuperhbagroup.patch text/x-patch 1.6 KB

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: superusers are members of all roles?
Date: 2011-11-03 01:41:44
Message-ID: CA+TgmoaJ5-FqM_ATH7EC-L-bRWmRj5_H7YPQZZjpEcd84Zj2TQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Nov 2, 2011 at 3:27 PM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
> Patch with a small docs addition also. Adding to Nov commitfest.

I have reviewed this and it looks good to me. Marking Ready for Committer.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company