pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: dennisr@visi.com <dennisr@visi.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-admin@postgresql.org, Scott Whitney <scott@journyx.com>
Subject: Re: Are dns CNAME's allowed or useable in pg_hba.conf hostname specification
Date: Mon, 5 Dec 2016 18:09:22 -0600
Message-ID: <26EFFF38-A2FF-4BCB-A24D-4FD2D9E5E9EB@visi.com> (raw)
In-Reply-To: <3120.1480979712@sss.pgh.pa.us>
References: <576363D5-19B5-4B34-A3C1-4D8BF63D3C78@visi.com>
	<712E05C9-E2D7-49CD-834E-26BA911C8D8A@visi.com>
	<BY1PR11MB0390734F0F24454DE44844CFA7830@BY1PR11MB0390.namprd11.prod.outlook.com>
	<369ED3B4-CAF3-4BBB-904F-E86999249D8E@visi.com>
	<3120.1480979712@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>


> On Dec 5, 2016, at 5:15 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 
> "dennisr@visi.com" <dennisr@visi.com> writes:
>> Thanks for the quick reply.  Here’s some details on how we have things 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 <http://some-cname-host.example.com/; I get:
> 
>> 	$> nslookup  some-cname-host.example.com <http://some-cname-host.example.com/;
>> 	Server:             10.97.40.215
>> 	Address:          10.97.40.215#53
> 
>> 	some-cname-host.example.com         canonical name = canonical-host-name.example.com.
>> 	Name: canonical-host-name.example.com
>> 	Address: 10.65.160.213
> 
>> When I do the reverse lookup on the IP address return above I get the following:
> 
>> 	$> nslookup 10.65.160.213
>> 	Server:             10.97.40.215
>> 	Address:          10.97.40.215#53
> 
>> 	213.160.65.10.in-addr.arpa    name = 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
> 

OK thanks, sadly not the answer I was hoping for though.  

My preference is to use a network address for this stuff but I was over ruled and needed to use a host specific name or address in the config file. I wanted to use a CNAME in place of the A or PTR records so as in the event we ever have to rebuild a new WAL receiver, I would only need to repoint the CNAME in the DNS system and avoid the possibility of updating a few hundred pg_hba.conf’s with a new IP address or hostname (this is a private cloud environment I am working with so I don’t have a lot of control over hostnames of the nodes they give me or even the networks the node is placed in.)

Dennis





-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



view thread (7+ messages)  latest in thread

Message-ID: <26EFFF38-A2FF-4BCB-A24D-4FD2D9E5E9EB@visi.com>
Permalink:  ../26EFFF38-A2FF-4BCB-A24D-4FD2D9E5E9EB@visi.com/
Also on:    postgresql.org/message-id/26EFFF38-A2FF-4BCB-A24D-4FD2D9E5E9EB@visi.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: dennisr@visi.com, tgl@sss.pgh.pa.us, scott@journyx.com
  Subject: Re: Are dns CNAME's allowed or useable in pg_hba.conf hostname specification
  In-Reply-To: <26EFFF38-A2FF-4BCB-A24D-4FD2D9E5E9EB@visi.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox