Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WV0Ne-0007MX-SJ for pgsql-bugs@arkaria.postgresql.org; Tue, 01 Apr 2014 15:13:39 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WV0Ne-0006lR-97 for pgsql-bugs@arkaria.postgresql.org; Tue, 01 Apr 2014 15:13:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WV0Nd-0006lL-Ms for pgsql-bugs@postgresql.org; Tue, 01 Apr 2014 15:13:37 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WV0Na-0005Sq-OE for pgsql-bugs@postgresql.org; Tue, 01 Apr 2014 15:13:37 +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 s31FDUHt017854; Tue, 1 Apr 2014 11:13:30 -0400 From: Tom Lane To: Alvaro Herrera cc: Mike Blackwell , pgsql-bugs@postgresql.org Subject: Re: BUG #9518: temporary login failure - "missing pg_hba entry" In-reply-to: <852.1396320840@sss.pgh.pa.us> References: <20140310145444.1230.51833@wrigleys.postgresql.org> <20140310145859.GK4759@eldon.alvh.no-ip.org> <20140401021720.GC9567@eldon.alvh.no-ip.org> <852.1396320840@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Mon, 31 Mar 2014 22:54:00 -0400" Date: Tue, 01 Apr 2014 11:13:30 -0400 Message-ID: <17853.1396365210@sss.pgh.pa.us> X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org I wrote: > IOW, it looks to me like intermittent failures in the reverse DNS lookup > could disable matching by hostname, and nothing would be said in the > postmaster log. Why is there no complaint if check_hostname's call to > pg_getnameinfo_all (line 600 in HEAD) fails? After sleeping on it, I think probably the reason it is like that is a desire to not clutter the postmaster log if there are some legitimate clients without rDNS entries. That is, suppose pg_hba.conf has host foo.bar.com ... host 192.168.168.1 ... and you've not bothered to create a reverse-DNS entry for 192.168.168.1. We will try (and fail) to look up the rDNS entry while considering the foo.bar.com line. We certainly don't want a failure there to prevent us from reaching the 192.168.168.1 line, and we don't really want to clutter the postmaster log with a bleat about it, either. Hence the lack of any error logging in the existing code. (The later cross-check on whether the forward DNS matches does have an error report, which maybe isn't such a great thing either from this standpoint.) The problem of course is that if the rDNS failure prevents us from matching to *any* line, we exit with no error more helpful than "missing pg_hba entry", which is not very desirable in this case. I guess we could do something like remember the fact that we tried and failed to do an rDNS lookup, and report it as DETAIL in the eventual "missing pg_hba entry" report. Not quite sure if it's worth the trouble --- any thoughts? Another objection to the code as it stands is that if there are multiple pg_hba lines containing hostnames, we'll repeat the failing rDNS lookup at each one. This is at best a huge waste of cycles (multiple network roundtrips, if the DNS server isn't local), and at worst inconsistent if things actually are intermittent and a later lookup attempt succeeds. I think we want to fix it to be sure that there's exactly one rDNS lookup attempt, occurring at the first line with a hostname. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs