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 1l5cHv-00028r-Kj for pgsql-hackers@arkaria.postgresql.org; Fri, 29 Jan 2021 22:30:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l5cHu-0000rg-Ht for pgsql-hackers@arkaria.postgresql.org; Fri, 29 Jan 2021 22:30:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l5cHu-0000rZ-Ae for pgsql-hackers@lists.postgresql.org; Fri, 29 Jan 2021 22:30:46 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l5cHs-0000yS-An for pgsql-hackers@postgresql.org; Fri, 29 Jan 2021 22:30:45 +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 10TMUgNU2829031; Fri, 29 Jan 2021 17:30:42 -0500 From: Tom Lane To: Stephen Frost cc: Jacob Champion , "pgsql-hackers@postgresql.org" Subject: Re: Proposal: Save user's original authenticated identity for logging In-reply-to: <20210129220101.GE27507@tamriel.snowman.net> References: <20210129220101.GE27507@tamriel.snowman.net> Comments: In-reply-to Stephen Frost message dated "Fri, 29 Jan 2021 17:01:01 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2829029.1611959442.1@sss.pgh.pa.us> Date: Fri, 29 Jan 2021 17:30:42 -0500 Message-ID: <2829030.1611959442@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Stephen Frost writes: > * Jacob Champion (pchampion@vmware.com) wrote: >> I propose that every auth method should store the string it uses to >> identify a user -- what I'll call an "authenticated identity" -- into >> one central location in Port, after authentication succeeds but before >> any pg_ident authorization occurs. This field can then be exposed in >> log_line_prefix. (It could additionally be exposed through a catalog >> table or SQL function, if that were deemed useful.) This would let a >> DBA more easily audit user activity when using more complicated >> pg_ident setups. > This seems like it would be good to include the CSV format log files > also. What happens if ALTER USER RENAME is done while the session is still alive? More generally, exposing this in log_line_prefix seems like an awfully narrow-minded view of what people will want it for. I'd personally think pg_stat_activity a better place to look, for example. > on every log line... I wonder if we should be focusing on a similar > approach for other pg_ident.conf use-cases instead of having it via > log_line_prefix, as the latter means we'd be logging the same value over > and over again on every log line. Yeah, this seems like about the most expensive way that we could possibly choose to make the info available. regards, tom lane