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 1ipV55-0004EL-WB for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Jan 2020 10:30:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ipV54-0001Hf-N7 for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Jan 2020 10:30:22 +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 1ipV54-0001E8-Dq for pgsql-hackers@lists.postgresql.org; Thu, 09 Jan 2020 10:30:22 +0000 Received: from feynman.df7cb.de ([195.49.152.168]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ipV4x-0007ri-P5 for pgsql-hackers@lists.postgresql.org; Thu, 09 Jan 2020 10:30:21 +0000 Received: from msg.df7cb.de (unknown [IPv6:2003:5b:203b:100:7627:eaff:fe52:8e03]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by feynman.df7cb.de (Postfix) with ESMTPSA id 47tj6t4q9hz3F02; Thu, 9 Jan 2020 11:30:14 +0100 (CET) Date: Thu, 9 Jan 2020 11:30:14 +0100 From: Christoph Berg To: Andrew Dunstan Cc: PostgreSQL Hackers Subject: Re: Allow 'sslkey' and 'sslcert' in postgres_fdw user mappings Message-ID: <20200109103014.GA4192@msg.df7cb.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Re: Andrew Dunstan 2019-11-01 > {"password_required", UserMappingRelationId, false}, > + /* > + * Extra room for the user mapping copies of sslcert and sslkey. These > + * are really libpq options but we repeat them here to allow them to > + * appear in both foreign server context (when we generate libpq > + * options) and user mapping context (from here). Bit of a hack > + * putting this in "non_libpq_options". > + */ > + {"sslcert", UserMappingRelationId, true}, > + {"sslkey", UserMappingRelationId, true}, Nice feature, we were actually looking for exactly this yesterday. I have some concerns about security, though. It's true that the sslcert/sslkey options can only be set/modified by superusers when "password_required" is set. But when password_required is not set, any user and create user mappings that reference arbitrary files on the server filesystem. I believe the options are still used in that case for creating connections, even when that means the remote server isn't set up for cert auth, which needs password_required=false to succeed. In short, I believe these options need explicit superuser checks. Christoph