pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mladen Gogala <gogala.mladen@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Seeking practice recommendation: is there ever a use case to have two or more superusers?
Date: Fri, 18 Nov 2022 19:30:34 -0500
Message-ID: <c4d18a0c-4f3e-6437-16b6-f5e4345ab9f4@gmail.com> (raw)
In-Reply-To: <20221118200835.sgva7b6wgg4w7py7@hjp.at>
References: <290EF7B8-D150-4AE1-8FFE-A38912CD1A8B@yugabyte.com>
	<20221118200835.sgva7b6wgg4w7py7@hjp.at>

On 11/18/22 15:08, Peter J. Holzer wrote:
> On 2022-11-17 11:36:15 -0800, Bryn Llewellyn wrote:
>> The detail below leads to a simply stated question:
>>
>> Given that the bootstrap superuser must exist, is there ever a reason to create
>> another role with "superuser"?
>>
>> My intuition tells me that the answer is a resounding "No!".
> Is there ever a reason? Yes. Does that reason apply to you? I don't know.
> Maybe, maybe not.
>
>
>> — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
>> I wondered, at first, if it might be a good practice to create a
>> second superuser, say "super" with "login", to alter the bootstrap
>> superuser with "nologin", and then to use "super" on an "ordinary"
>> daily basis for tasks that might need this. The thought was that this
>> practice might protect the artifacts that the bootstrap superuser owns
>> from damage. But this thought dissolved into thin air, before it was
>> fully formed, on the realization that the unstoppable "super" could
>> anyway do arbitrary damage to the bootstrap superuser's artifacts.
> You could create additional superusers and restrict those to certain
> databases and/or IP ranges. That probably won't stop an attacker (I can
> think of at least one way to get around that and it's probably even
> easier than I think) but it might prevent accidental damage.
>
>
>> The implication is clear: you should allow a cluster to have just a single
>> superuser, the inevitable bootstrap superuser, and you should think very
>> carefully indeed before ever starting a session as this role because of the
>> risks that doing so brings. Rather, you should realize that there are hardly
>> any tasks that cannot be carried out by an appropriately configured role with
>> "nosuperuser".
> One important task that can AFAIK only be performed by superusers is the
> creation of functions in untrusted languages like plpython3u and
> plperlu.
>
> If your application uses functions in those languages you need a
> superuser to install or upgrade it.
>
>          hp
>
Yes, there is such a reason. On several servers that I have to work 
with, the user "postgres" is not a log-in user. In other words, I can't 
log in as "postgres", I can only log in as my own user and su to the 
user "postgres". All users must be authenticated by the LDAP system and 
the user "postgres" is not in the LDAP. Since I am lazy, I granted 
superuser privilege to my own user so that I don't have to switch to the 
user "postgres" every time I want to do something that affects 
everybody, like using "ALTER SYSTEM". I am also a member of the "dba" 
group on the Oracle servers, so that I can do "sqlplus / as sysdba" 
without switching to the user "oracle". It's the same thing. If I was to 
respond by a single word, the word would be "convenience". Or maybe 
"covfefe"?

-- 
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com

view thread (20+ messages)  latest in thread

Message-ID: <c4d18a0c-4f3e-6437-16b6-f5e4345ab9f4@gmail.com>
Permalink:  ../c4d18a0c-4f3e-6437-16b6-f5e4345ab9f4@gmail.com/
Also on:    postgresql.org/message-id/c4d18a0c-4f3e-6437-16b6-f5e4345ab9f4@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: gogala.mladen@gmail.com
  Subject: Re: Seeking practice recommendation: is there ever a use case to have two or more superusers?
  In-Reply-To: <c4d18a0c-4f3e-6437-16b6-f5e4345ab9f4@gmail.com>
  References: <290EF7B8-D150-4AE1-8FFE-A38912CD1A8B@yugabyte.com> <20221118200835.sgva7b6wgg4w7py7@hjp.at> <c4d18a0c-4f3e-6437-16b6-f5e4345ab9f4@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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