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 1qeIdV-006Q90-Tz for pgsql-bugs@arkaria.postgresql.org; Thu, 07 Sep 2023 17:17:45 +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 1qeIdU-003UI2-Kp for pgsql-bugs@arkaria.postgresql.org; Thu, 07 Sep 2023 17:17:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qeIdU-003UHg-C4 for pgsql-bugs@lists.postgresql.org; Thu, 07 Sep 2023 17:17:44 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qeIdL-003iNp-RI for pgsql-bugs@lists.postgresql.org; Thu, 07 Sep 2023 17:17: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 387HHXJN1722735; Thu, 7 Sep 2023 13:17:33 -0400 From: Tom Lane To: ytourki@ext.scaleway.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18095: Unintended non-SSL connection attempt by psql cli command after a failed password authentication In-reply-to: <18095-1efc746f742f766c@postgresql.org> References: <18095-1efc746f742f766c@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Thu, 07 Sep 2023 16:44:13 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1722733.1694107053.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 07 Sep 2023 13:17:33 -0400 Message-ID: <1722734.1694107053@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > When connecting to a PostgreSQL server (version 14) configured to only > accept SSL connections, if a user provides an incorrect password, the ps= ql > client (version 14) returns two error messages in succession. The first > message correctly indicates a password authentication failure, but the > second suggests an unexpected non-SSL connection attempt. This is libpq's (not psql's) default behavior. If you don't like it, you need to set the sslmode parameter in the connection string to prevent non-SSL connection attempts. See https://www.postgresql.org/docs/current/libpq-ssl.html#LIBPQ-SSL-SSLMODE-S= TATEMENTS regards, tom lane