From: | <Michael(dot)Dietrich(at)swisscom(dot)com> |
---|---|
To: | <sfrost(at)snowman(dot)net> |
Cc: | <pgsql-admin(at)lists(dot)postgresql(dot)org> |
Subject: | AW: Connect to db denied for superuser inherited by group |
Date: | 2018-03-20 08:29:43 |
Message-ID: | 214530c2d4cb438ca204bd2a3b5b4747@swisscom.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
What I've done
CREATE ROLE superrole WITH NOLOGIN SUPERUSER ..;
CREATE USER nosuperuser WITH LOGIN NOSUPERUSER INHERIT ..;
GRANT superrole TO nosuperuser WITH ADMIN OPTION;
REVOKE CONNECT ON DATABASE nonpublicdb FROM public ;
psql -d postgres -U nosupuser
postgres=# set role superrole;
postgres=# \c nonpublicdb
FATAL: permission denied for database " nonpublicdb "
DETAIL: User does not have CONNECT privilege.
I expect that the connection to the database is allowed since a role with superuser is used. (I don't' expect any difference between using a role (including superuser) or a user (including superuser).)
Postgres Version: PostgreSQL 9.5.2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4), 64-bit
Regards --Michael
-----Ursprüngliche Nachricht-----
Von: Stephen Frost [mailto:sfrost(at)snowman(dot)net]
Gesendet: Freitag, 16. März 2018 14:43
An: Dietrich Michael, INI-ONE-CIS-GSV-MFS <Michael(dot)Dietrich(at)swisscom(dot)com>
Cc: pgsql-admin(at)lists(dot)postgresql(dot)org
Betreff: Re: Connect to db denied for superuser inherited by group
Greetings,
* Michael(dot)Dietrich(at)swisscom(dot)com (Michael(dot)Dietrich(at)swisscom(dot)com) wrote:
> Unexpected behavior when trying to connect to a database. Facts:
> 1) The privilege to connect to the database was revoked from public.
> 2) User without superuser privileges uses a role with superuser rights
> (usage confirmed with SHOW current_role.)
Please provide more details about what this step #2 actually means.
> 3) Unecpected Message: FATAL: permission denied for database "db" DETAIL: User does not have CONNECT privilege.
Details about exactly what you're doing to connect here would be helpful.
> After granting one of the listed privileges it is working as expected.
> 1) granting superuser to user
> 2) granting connect to db for user
> 3) granting connect to db to group
> 3) granting connect to db to public
>
> What am I missing? --Michael
CONNECT privileges are needed to be able to connect to the database, so it's not surprising that you needed to GRANT them to the user after REVOKE'ing them from PUBLIC. What's not clear is what you're actually trying to do and what you're expecting to work that apparently isn't.
Thanks!
Stephen
From | Date | Subject | |
---|---|---|---|
Next Message | Samed YILDIRIM | 2018-03-20 11:13:32 | Re: Standard tools for multimaster cluster |
Previous Message | Achilleas Mantzios | 2018-03-20 06:50:43 | Re: Compile error while building postgresql 10.3 |