Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cE2VP-0006Ud-AP for pgsql-admin@arkaria.postgresql.org; Mon, 05 Dec 2016 23:17:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cE2VO-0001FK-Of for pgsql-admin@arkaria.postgresql.org; Mon, 05 Dec 2016 23:17:06 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cE2Ti-0007k0-5m for pgsql-admin@postgresql.org; Mon, 05 Dec 2016 23:15:22 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cE2Td-0008C3-6e for pgsql-admin@postgresql.org; Mon, 05 Dec 2016 23:15:19 +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 uB5NFC4J003121; Mon, 5 Dec 2016 18:15:12 -0500 From: Tom Lane To: "dennisr@visi.com" cc: pgsql-admin@postgresql.org, Scott Whitney Subject: Re: Are dns CNAME's allowed or useable in pg_hba.conf hostname specification In-reply-to: <369ED3B4-CAF3-4BBB-904F-E86999249D8E@visi.com> References: <576363D5-19B5-4B34-A3C1-4D8BF63D3C78@visi.com> <712E05C9-E2D7-49CD-834E-26BA911C8D8A@visi.com> <369ED3B4-CAF3-4BBB-904F-E86999249D8E@visi.com> Comments: In-reply-to "dennisr@visi.com" message dated "Mon, 05 Dec 2016 17:05:59 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <3119.1480979712.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 05 Dec 2016 18:15:12 -0500 Message-ID: <3120.1480979712@sss.pgh.pa.us> X-Pg-Spam-Score: -4.9 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org "dennisr@visi.com" writes: > Thanks for the quick reply. Here=E2=80=99s some details on how we have t= hings configured. > We are using RHEL 7.3, the DNS names below have been changed to protect = the innocent or not so innocent depending on your point of view. > If I do a nslookup on the database host against the following CNAME some-= cname-host.example.com I get: > $> nslookup some-cname-host.example.com > Server: 10.97.40.215 > Address: 10.97.40.215#53 > some-cname-host.example.com canonical name =3D canonical-host-na= me.example.com. > Name: canonical-host-name.example.com > Address: 10.65.160.213 =20 > When I do the reverse lookup on the IP address return above I get the fol= lowing: > $> nslookup 10.65.160.213 > Server: 10.97.40.215 > Address: 10.97.40.215#53 > 213.160.65.10.in-addr.arpa name =3D canonical-host-name.example.com. Given that, what you would have to put in pg_hba.conf is canonical-host-name.example.com (and that needs to forward-resolve to 10.65.160.213, and possibly other addresses as well). This cross-check is meant to prevent getting into a PG server by means of a faked reverse-DNS entry. (If you're wondering why we don't simply accept anything that some-cname-host.example.com forward-maps to, it's for performance reasons: that would require resolving every DNS name in pg_hba.conf to see if it matches, which could be pretty awful with long pg_hba.conf files.) regards, tom lane --=20 Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin