Re: Why do i need to install set_user extension if i can directly grant all required privileges to user?

From: Joe Conway <mail(at)joeconway(dot)com>
To: Bhasker Bathini <bbathini(at)gmail(dot)com>, Holger Jakobs <holger(at)jakobs(dot)com>
Cc: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Why do i need to install set_user extension if i can directly grant all required privileges to user?
Date: 2023-06-21 15:13:17
Message-ID: 4fe50104-af62-95dc-abcb-75abd47025a7@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 6/21/23 10:38, Bhasker Bathini wrote:
> Thank you for the quick response.
>
> What if i can grant all the required privileges or even making the user
> a superuser, why do i need set_user ?
>
> Does set_user is just to make sure users with direct privileges wont
> accidently modify critical information/parameters unless they set the
> session to elevated privileged role to perform the operation?
>
> I am not able to find a reason why i need set_user extension?

There are two main use cases for set_user:

1/ Allow an unprivileged admin role to escalate to superuser, but (to
the extent possible) ensure every command issued is logged for audit
purposes. It can also block things like COPY PROGRAM and ALTER SYSTEM
that might allow them to do things you do not wish to allow. Once
escalated, there are ways they could bypass the controls, but the act of
bypassing itself would get logged, so if you monitor and alert you would
catch it.

2/ Allow a single unprivileged role to be used to switch to other
unprivileged roles, without having to grant all of them, and with the
ability to set a random token so that switching back (and thus to
indirectly other roles) requires the token. Think in terms of a web app
that uses a single role to log in but then switches to a actual users
role. Or a proxy or load balancer of sorts.

--
Joe Conway
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Bhasker Bathini 2023-06-21 15:57:15 Re: Why do i need to install set_user extension if i can directly grant all required privileges to user?
Previous Message Jeff Janes 2023-06-21 15:05:15 Re: SSL cert "not initialized" error with logical replication with 13.11