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 1lS1fD-0007Nl-4Z for pgsql-committers@arkaria.postgresql.org; Thu, 01 Apr 2021 18:03:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lS1fB-00089B-J7 for pgsql-committers@arkaria.postgresql.org; Thu, 01 Apr 2021 18:03:25 +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 1lS1fB-000894-Df for pgsql-committers@lists.postgresql.org; Thu, 01 Apr 2021 18:03:25 +0000 Received: from relay9-d.mail.gandi.net ([217.70.183.199]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lS1f4-0004Gl-4W for pgsql-committers@lists.postgresql.org; Thu, 01 Apr 2021 18:03:23 +0000 X-Originating-IP: 99.10.92.30 Received: from [192.168.10.146] (99-10-92-30.lightspeed.rlghnc.sbcglobal.net [99.10.92.30]) (Authenticated sender: adsend@dunslane.net) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 42CCEFF803 for ; Thu, 1 Apr 2021 18:03:13 +0000 (UTC) Subject: Re: pgsql: Allow matching the DN of a client certificate for authentication From: Andrew Dunstan To: pgsql-committers@lists.postgresql.org References: Message-ID: <1778fbb3-8754-f336-1ffa-413fdbc61fdf@dunslane.net> Date: Thu, 1 Apr 2021 14:03:11 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/29/21 3:50 PM, Andrew Dunstan wrote: > Allow matching the DN of a client certificate for authentication > > Currently we only recognize the Common Name (CN) of a certificate's > subject to be matched against the user name. Thus certificates with > subjects '/OU=eng/CN=fred' and '/OU=sales/CN=fred' will have the same > connection rights. This patch provides an option to match the whole > Distinguished Name (DN) instead of just the CN. On any hba line using > client certificate identity, there is an option 'clientname' which can > have values of 'DN' or 'CN'. The default is 'CN', the current procedure. > > The DN is matched against the RFC2253 formatted DN, which looks like > 'CN=fred,OU=eng'. > > This facility of probably best used in conjunction with an ident map. > > Discussion: https://postgr.es/m/92e70110-9273-d93c-5913-0bccb6562740@dunslane.net > > Reviewed-By: Michael Paquier, Daniel Gustafsson, Jacob Champion Belated credit where it's due: this work was originally based on a patch from Kosmas Valianos of AppGate. cheers andrew