Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r5oQE-00FBi9-Vf for pgsql-general@arkaria.postgresql.org; Wed, 22 Nov 2023 14:41:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1r5oPF-0099z2-AD for pgsql-general@arkaria.postgresql.org; Wed, 22 Nov 2023 14:40:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r5oPE-0099xu-Uv for pgsql-general@lists.postgresql.org; Wed, 22 Nov 2023 14:40:44 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r5oPC-006ozX-CA for pgsql-general@lists.postgresql.org; Wed, 22 Nov 2023 14:40:43 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 3AMEeeS41671957; Wed, 22 Nov 2023 09:40:40 -0500 From: Tom Lane To: Laurenz Albe cc: "Johnson, Bruce E - (bjohnson)" , "pgsql-general@lists.postgresql.org" Subject: Re: Connection fails on one system in a address range allowed to connect In-reply-to: <3dc1190d1060e406be112ed5da581cf514af7a32.camel@cybertec.at> References: <55C98A3B-4D99-4F39-8A2D-31D25E456F2B@arizona.edu> <3dc1190d1060e406be112ed5da581cf514af7a32.camel@cybertec.at> Comments: In-reply-to Laurenz Albe message dated "Wed, 22 Nov 2023 10:39:03 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1671955.1700664040.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 22 Nov 2023 09:40:40 -0500 Message-ID: <1671956.1700664040@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Laurenz Albe writes: > On Tue, 2023-11-21 at 23:27 +0000, Johnson, Bruce E - (bjohnson) wrote: >> DBI connect('dbname=3Dwebdata;host=3Ddhbpostgres.pharmacy.arizona.edu;p= ort=3D5432','trav',...) failed: FATAL: password authentication failed for= user "trav" >> FATAL: no pg_hba.conf entry for host "150.135.124.50", user "trav", da= tabase "webdata", no encryption at ./pg_test.pl line 8. >> = >> The pg_hba.conf on the server includes this which should encompass all = systems in this VLAN >> # external 'OldMTM' site range >> hostssl all all 150.135.124.0/25 password > "no encryption" does not match a "hostssl" entry. Yeah. What is probably happening here is that (with the default sslmode) libpq is trying an SSL connection, that's failing for some reason, and then it tries a non-SSL connection which definitely fails for lack of a matching pg_hba.conf entry; and then for some other reason you are only shown the message concerning the last attempt. Theory B is that your libpq wasn't compiled with SSL support so it skips right to the non-SSL attempt. Laurenz's suggestion of adding sslmode=3Drequire is a good debugging step either way, since it will either tell you for sure that you are missing SSL support or show you the failure from the single SSL-enabled attempt. Alternatively, turn on log_connections and see what the server log captures. (You might need to do that anyway if the client-side message isn't sufficiently informative.) regards, tom lane