Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1idHmm-0002Ui-MB for pgsql-general@arkaria.postgresql.org; Fri, 06 Dec 2019 17:53:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1idHml-0003xq-H8 for pgsql-general@arkaria.postgresql.org; Fri, 06 Dec 2019 17:52:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1idHml-0003xj-7G for pgsql-general@lists.postgresql.org; Fri, 06 Dec 2019 17:52:59 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1idHmd-0000gq-A5 for pgsql-general@lists.postgresql.org; Fri, 06 Dec 2019 17:52:58 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id xB6HqiXH017779; Fri, 6 Dec 2019 12:52:44 -0500 From: Tom Lane To: Albrecht =?iso-8859-1?b?RHJl3w==?= cc: pgsql-general@lists.postgresql.org Subject: Re: Q: cert authentication and user remapping fails In-reply-to: References: Comments: In-reply-to Albrecht =?iso-8859-1?b?RHJl3w==?= message dated "Fri, 06 Dec 2019 18:22:18 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <17777.1575654764.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 06 Dec 2019 12:52:44 -0500 Message-ID: <17778.1575654764@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Albrecht =3D?iso-8859-1?b?RHJl3w=3D=3D?=3D write= s: > In my installation, the user certificate CN's contain human-readable nam= es (utf8, with spaces, etc.). I want *all* users connecting with cert aut= hentication to be mapped to a certain database role. I don't think that the user name mapping feature works in the way you are hoping it does. According to https://www.postgresql.org/docs/current/auth-username-maps.html what the map does is to specify allowed combinations of the validated external user name ("Albrecht Dre=C3=9F" in your example) and the database role the user asked to connect as. So given > certaccess /^.*$ testuser it should be possible to do psql -h dbserver -U testuser testdb with a certificate that has CN=3D"Albrecht Dre=C3=9F" (or anything else). But the map won't result in silently connecting you as some other role than the one you asked for. (I haven't actually tried this, but that's how I read the docs.) regards, tom lane