Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBxxk-000543-BR for pgsql-admin@arkaria.postgresql.org; Wed, 21 Jun 2023 13:33:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qBxxj-0005ug-7Q for pgsql-admin@arkaria.postgresql.org; Wed, 21 Jun 2023 13:33:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBxxi-0005u8-Sl for pgsql-admin@lists.postgresql.org; Wed, 21 Jun 2023 13:33:30 +0000 Received: from mout-u-107.mailbox.org ([80.241.59.207]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qBxxg-003R9M-1E for pgsql-admin@postgresql.org; Wed, 21 Jun 2023 13:33:29 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-107.mailbox.org (Postfix) with ESMTPS id 4QmPb61MXKz9sT3; Wed, 21 Jun 2023 15:33:22 +0200 (CEST) Date: Wed, 21 Jun 2023 15:33:21 +0200 (CEST) From: Erik Wienhold To: Bhasker Bathini , pgsql-admin@postgresql.org Message-ID: <310498031.1194425.1687354401566@office.mailbox.org> In-Reply-To: References: Subject: Re: Why do i need to install set_user extension if i can directly grant all required privileges to user? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 20/06/2023 13:33 CEST Bhasker Bathini wrote: > > Hi , i was wondering, why do i need to install set_user extension when i can > grant all the privileges to user directly? Are you talking about https://github.com/pgaudit/set_user ? I never used this extension but after skimming over the readme it looks like a replacement for SET ROLE and SET SESSION AUTHORIZATION with logging for audit purposes. > Is there any advantage or any scenario where i can only perform having > set_user grants? Changing roles is already possible in Postgres. You must be a member of the target role or be a superuser in order to change roles. I don't know if the set_user extension behaves identical to SET ROLE etc. because it also supports whitelisting of target roles and superusers. The extension may be relevant to you if the whitelist feature or auditing is a requirement for your project. But I'm not sure if the whitelist feature bypasses the membership requirement imposed by SET ROLE or if you still have to grant memberships to target roles. -- Erik