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 1l6F2c-0006DU-7s for pgsql-hackers@arkaria.postgresql.org; Sun, 31 Jan 2021 15:53:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l6F2b-0006Pb-5r for pgsql-hackers@arkaria.postgresql.org; Sun, 31 Jan 2021 15:53:33 +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 1l6F2a-0006PU-VW for pgsql-hackers@lists.postgresql.org; Sun, 31 Jan 2021 15:53:32 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l6F2Y-0002tb-Q4 for pgsql-hackers@postgresql.org; Sun, 31 Jan 2021 15:53:32 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 10VFrQkl3085247; Sun, 31 Jan 2021 10:53:26 -0500 From: Tom Lane To: Greg Stark cc: Jacob Champion , "sfrost@snowman.net" , "pgsql-hackers@postgresql.org" Subject: Re: Proposal: Save user's original authenticated identity for logging In-reply-to: References: <20210129220101.GE27507@tamriel.snowman.net> <2829030.1611959442@sss.pgh.pa.us> <2832058.1611963634@sss.pgh.pa.us> Comments: In-reply-to Greg Stark message dated "Sun, 31 Jan 2021 10:17:33 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3085245.1612108406.1@sss.pgh.pa.us> Date: Sun, 31 Jan 2021 10:53:26 -0500 Message-ID: <3085246.1612108406@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Greg Stark writes: > I wonder if there isn't room to handle this the other way around. To > configure Postgres to not need a CREATE ROLE for every role but > delegate the user management to the external authentication service. > So Postgres would consider the actual role to be the one kerberos said > it was even if that role didn't exist in pg_role. Presumably you would > want to delegate to a corresponding authorization system as well so if > the role was absent from pg_role (or more likely fit some pattern) > Postgres would ignore pg_role and consult the authorization system > configured like AD or whatever people use with Kerberos these days. This doesn't sound particularly workable: how would you manage inside-the-database permissions? Kerberos isn't going to know what "view foo" is, let alone know whether you should be allowed to read or write it. So ISTM there has to be a role to hold those permissions. Certainly, you could allow multiple external identities to share a role ... but that works today. regards, tom lane