Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nFUs8-0001x9-8i for pgsql-bugs@arkaria.postgresql.org; Thu, 03 Feb 2022 05:41:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nFUs7-0003xx-5h for pgsql-bugs@arkaria.postgresql.org; Thu, 03 Feb 2022 05:41:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nFUs6-0003xo-TZ for pgsql-bugs@lists.postgresql.org; Thu, 03 Feb 2022 05:41:30 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nFUs0-0006br-G9 for pgsql-bugs@lists.postgresql.org; Thu, 03 Feb 2022 05:41:30 +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 2135fHR6203743; Thu, 3 Feb 2022 00:41:17 -0500 From: Tom Lane To: Thomas Munro cc: Andres Freund , byavuz81@gmail.com, PostgreSQL mailing lists , Heikki Linnakangas , Michael Paquier Subject: Re: BUG #17391: While using --with-ssl=openssl and PG_TEST_EXTRA='ssl' options, SSL tests fail on OpenBSD 7.0 In-reply-to: <131329.1643851912@sss.pgh.pa.us> References: <17391-304f81bcf724b58b@postgresql.org> <20220202213900.h7paogmcge2rtls6@alap3.anarazel.de> <131329.1643851912@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Wed, 02 Feb 2022 20:31:52 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <203741.1643866877.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Feb 2022 00:41:17 -0500 Message-ID: <203742.1643866877@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I wrote: > I had an OpenBSD 6.8 image laying about, so I tried the ssl test > there, and it falls over in even more places: > ... > A lot of the errors look like they didn't yet have support for > TLS 1.2; this is typical: On further investigation, that's nonsense, because the postmaster logs show that most if not all of the connections that are succeeding are TLSv1.3, eg 2022-02-02 21:31:07.492 EST [96067] [unknown] LOG: 00000: connection auth= orized: user=3Dssltestuser database=3Dtrustdb application_name=3D001_sslte= sts.pl SSL enabled (protocol=3DTLSv1.3, cipher=3DAEAD-AES256-GCM-SHA384, b= its=3D256) However, PG believes that the library only supports up to 1.2, because TLS1_3_VERSION isn't defined. I found this in /usr/include/openssl/tls1.h: #if defined(LIBRESSL_HAS_TLS1_3) || defined(LIBRESSL_INTERNAL) #define TLS1_3_VERSION 0x0304 #endif LIBRESSL_HAS_TLS1_3 is not defined anywhere; in /usr/include/openssl/opensslfeatures.h I find /* = = * Feature flags for LibreSSL... so you can actually tell when things = = * are enabled, rather than not being able to tell when things are = = * enabled (or possibly not yet not implemented, or removed!). = = */ /* #define LIBRESSL_HAS_TLS1_3 */ which is about the best example I've seen lately of crappy code falsifying the adjacent comment. I added #define LIBRESSL_HAS_TLS1_3 1 to pg_config.h to see what would happen. It seems that about the same number of tests fall over, but now the errors are (mostly) not about TLS version. Some look like they might just be mismatched expectations of exactly what error will be issued: # Failed test 'connect with wrong server root cert sslmode=3Drequire: ma= tches' # at t/001_ssltests.pl line 170. # 'psql: error: connection to server at "127.0.0.1", por= t 62542 failed: SSL error: tlsv1 alert unknown ca' # doesn't match '(?^:SSL error: certificate verify failed)' I get the impression though that there's still some mismatch about how to establish which CAs are trusted, and there are still a few "tlsv1 alert protocol version" errors with no obvious reason. I thought for awhile that the library might be forcing a minimum TLS version of 1.3 (despite the headers not even claiming to support it at all), because that would fit right in with OpenBSD's securer-than-thou ethos. I still suspect that something like that might be going on, but I don't have hard evidence. regards, tom lane