pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Postgres Enhancement Request
5+ messages / 3 participants
[nested] [flat]

* Postgres Enhancement Request
@ 2019-03-20 10:10 Zwettler Markus (OIZ) <Markus.Zwettler@zuerich.ch>
  2019-03-20 10:44 ` Re: Postgres Enhancement Request Thomas Kellerer <spam_eater@gmx.net>
  0 siblings, 1 reply; 5+ messages in thread

From: Zwettler Markus (OIZ) @ 2019-03-20 10:10 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

CREATEROLE allows users to create new roles also having the CREATEDB privilege (at least in version 9.6).

We want special users to be able to CREATEROLE without being able to CREATEDB (eg. when usermanagement is done by the application itself).

Please prevent users with CREATEROLE to create roles having CREATEDB (analogous SUPERUSER and REPLICATION).

Thanks



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Postgres Enhancement Request
  2019-03-20 10:10 Postgres Enhancement Request Zwettler Markus (OIZ) <Markus.Zwettler@zuerich.ch>
@ 2019-03-20 10:44 ` Thomas Kellerer <spam_eater@gmx.net>
  2019-03-20 13:59   ` Re: Postgres Enhancement Request Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 5+ messages in thread

From: Thomas Kellerer @ 2019-03-20 10:44 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Zwettler Markus (OIZ) schrieb am 20.03.2019 um 11:10:
> CREATEROLE allows users to create new roles also having the CREATEDB privilege (at least in version 9.6).
> 
> We want special users to be able to CREATEROLE without being able to CREATEDB (eg. when usermanagement is done by the application itself).
> 
> Please prevent users with CREATEROLE to create roles having CREATEDB (analogous SUPERUSER and REPLICATION).

I agree that would be a welcome enhancement. 

As a workaround, you can create a function owned by a superuser (or any other user with the "createrole" privilege) using "security definer" that provides a simple "create user" capability and makes sure that the created user does not have the createdb privilege. 

The user/role that should be able to create new roles doesn't need the createrole privilege at all then. 
All it needs is the execute privilege on the function.

Thomas






^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Postgres Enhancement Request
  2019-03-20 10:10 Postgres Enhancement Request Zwettler Markus (OIZ) <Markus.Zwettler@zuerich.ch>
  2019-03-20 10:44 ` Re: Postgres Enhancement Request Thomas Kellerer <spam_eater@gmx.net>
@ 2019-03-20 13:59   ` Tom Lane <tgl@sss.pgh.pa.us>
  2019-03-20 14:13     ` Re: Postgres Enhancement Request Thomas Kellerer <spam_eater@gmx.net>
  0 siblings, 1 reply; 5+ messages in thread

From: Tom Lane @ 2019-03-20 13:59 UTC (permalink / raw)
  To: Thomas Kellerer <spam_eater@gmx.net>; +Cc: pgsql-general@lists.postgresql.org; Zwettler Markus (OIZ) <Markus.Zwettler@zuerich.ch>

Thomas Kellerer <spam_eater@gmx.net> writes:
> Zwettler Markus (OIZ) schrieb am 20.03.2019 um 11:10:
>> Please prevent users with CREATEROLE to create roles having CREATEDB (analogous SUPERUSER and REPLICATION).

> I agree that would be a welcome enhancement. 

No, it wouldn't.  The point of CREATEROLE is to allow user creation
and deletion to be done by a role that's less than full superuser.
If we changed it like that, then you'd be right back at needing
superuser for very routine role creations.  That's *not* an
improvement, even if it somehow fit better into the OP's desired
security model (which he hasn't explained).

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Postgres Enhancement Request
  2019-03-20 10:10 Postgres Enhancement Request Zwettler Markus (OIZ) <Markus.Zwettler@zuerich.ch>
  2019-03-20 10:44 ` Re: Postgres Enhancement Request Thomas Kellerer <spam_eater@gmx.net>
  2019-03-20 13:59   ` Re: Postgres Enhancement Request Tom Lane <tgl@sss.pgh.pa.us>
@ 2019-03-20 14:13     ` Thomas Kellerer <spam_eater@gmx.net>
  2019-03-20 14:29       ` Re: Postgres Enhancement Request Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 5+ messages in thread

From: Thomas Kellerer @ 2019-03-20 14:13 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Tom Lane schrieb am 20.03.2019 um 14:59:
>>> Please prevent users with CREATEROLE to create roles having CREATEDB (analogous SUPERUSER and REPLICATION).
> 
>> I agree that would be a welcome enhancement. 
> 
> No, it wouldn't.  The point of CREATEROLE is to allow user creation
> and deletion to be done by a role that's less than full superuser.
> If we changed it like that, then you'd be right back at needing
> superuser for very routine role creations.  That's *not* an
> improvement, even if it somehow fit better into the OP's desired
> security model (which he hasn't explained).

I didn't take this to be a request to remove the createdb privilege in general, but a request to have finer grained control what kind of privileges the role with createrole can grant to newly created roles (or what it can do in general).

Maybe if "createrole" was a regular privilege (like "create table"), then something like this would be possible:

    create role user_admin;
    grant create role to user_admin;

Thomas




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Postgres Enhancement Request
  2019-03-20 10:10 Postgres Enhancement Request Zwettler Markus (OIZ) <Markus.Zwettler@zuerich.ch>
  2019-03-20 10:44 ` Re: Postgres Enhancement Request Thomas Kellerer <spam_eater@gmx.net>
  2019-03-20 13:59   ` Re: Postgres Enhancement Request Tom Lane <tgl@sss.pgh.pa.us>
  2019-03-20 14:13     ` Re: Postgres Enhancement Request Thomas Kellerer <spam_eater@gmx.net>
@ 2019-03-20 14:29       ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2019-03-20 14:29 UTC (permalink / raw)
  To: Thomas Kellerer <spam_eater@gmx.net>; +Cc: pgsql-general@lists.postgresql.org

Thomas Kellerer <spam_eater@gmx.net> writes:
> Tom Lane schrieb am 20.03.2019 um 14:59:
>> No, it wouldn't.  The point of CREATEROLE is to allow user creation
>> and deletion to be done by a role that's less than full superuser.
>> If we changed it like that, then you'd be right back at needing
>> superuser for very routine role creations.  That's *not* an
>> improvement, even if it somehow fit better into the OP's desired
>> security model (which he hasn't explained).

> I didn't take this to be a request to remove the createdb privilege in general, but a request to have finer grained control what kind of privileges the role with createrole can grant to newly created roles (or what it can do in general).

Hmm.  Thinking about it a bit more carefully, it does seem bogus that
a role that has CREATEROLE but not CREATEDB can make a role that has
the latter privilege.  It would be more sensible to have a uniform
rule that "you can't grant a privilege you don't have yourself",
which would mean that the OP's problem could perhaps be solved by
making a role that has CREATEROLE but not CREATEDB.

You could imagine going further and applying the full SQL privilege
model to these things, which would make it possible to have a role
that has CREATEDB (so can make DBs itself) but can't pass that
privilege on to others for lack of grant options on CREATEDB.
But that would be a very much bigger chunk of work, and I'm not sure
I see the payback.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2019-03-20 14:29 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-03-20 10:10 Postgres Enhancement Request Zwettler Markus (OIZ) <Markus.Zwettler@zuerich.ch>
2019-03-20 10:44 ` Thomas Kellerer <spam_eater@gmx.net>
2019-03-20 13:59   ` Tom Lane <tgl@sss.pgh.pa.us>
2019-03-20 14:13     ` Thomas Kellerer <spam_eater@gmx.net>
2019-03-20 14:29       ` Tom Lane <tgl@sss.pgh.pa.us>

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