Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iChjR-0003q9-DW for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Sep 2019 10:07:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iChjQ-0007Ao-6S for pgsql-hackers@arkaria.postgresql.org; Tue, 24 Sep 2019 10:07:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iChjP-0007Ah-RU for pgsql-hackers@lists.postgresql.org; Tue, 24 Sep 2019 10:07:39 +0000 Received: from mx.wagner.pp.ru ([78.46.190.96]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1iChjL-0004Qr-74 for pgsql-hackers@lists.postgresql.org; Tue, 24 Sep 2019 10:07:38 +0000 Received: from fafnir.local.vm (unknown [93.174.131.141]) by mx.wagner.pp.ru (Postfix) with ESMTPSA id B7876E0198; Tue, 24 Sep 2019 13:07:32 +0300 (MSK) Date: Tue, 24 Sep 2019 13:07:31 +0300 From: Victor Wagner To: pgsql-hackers@lists.postgresql.org Cc: Michael Paquier Subject: Re: PostgreSQL12 and older versions of OpenSSL Message-ID: <20190924130731.2270332e@fafnir.local.vm> In-Reply-To: <20190924094917.GB1982@paquier.xyz> References: <20190924101859.09383b4f@fafnir.local.vm> <20190924094917.GB1982@paquier.xyz> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/cld1_.eTqsjNIOUMZ9NV2Ok"; protocol="application/pgp-signature" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Sig_/cld1_.eTqsjNIOUMZ9NV2Ok Content-Type: multipart/mixed; boundary="MP_/xsvI4.h_8VeeVLxp5vBuEqu" --MP_/xsvI4.h_8VeeVLxp5vBuEqu Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Tue, 24 Sep 2019 18:49:17 +0900 Michael Paquier wrote: > On Tue, Sep 24, 2019 at 10:18:59AM +0300, Victor Wagner wrote: > > PostgreSQL 12 documentation states, that minimum required version of > > OpenSSL is 0.9.8. However, I was unable to =D1=81ompile current > > PGPRO_12_STABLE with OpenSSL 0.9.8j (from SLES 11sp4). >=20 > I can reproduce that with REL_12_STABLE and the top of > OpenSSL_0_9_8-stable fromx OpenSSL's git. >=20 > > Replacing all=20 > >=20 > > #ifdef TLS1_1_VERSION > >=20 > > with > >=20 > > #if defined(TLS1_1_VERSION) && TLS1_1_VERSION <=3D TLS_MAX_VERSION > >=20 > > and analogue for TLS1_2_VERSION fixes the problem. >=20 > That sounds like a plan. =20 [skip]=20 > > ... > > (line 1290). In this case check for TLS1_1_VERSION <=3D > > TLS_MAX_VERSION seems to be more self-explanatory, than check for > > somewhat unrelated symbol SSL_OP_NO_TLSv1_1 >=20 > That sounds right. Victor, would you like to write a patch? I'm attaching patch which uses solution mentioned above. It seems that chedk for SSL_OP_NO_TLSvX_Y is redundant if=20 we are checking for TLS_MAX_VERSION. --=20 --MP_/xsvI4.h_8VeeVLxp5vBuEqu Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=openssl-0.9.8-tls11.patch diff --git a/src/backend/libpq/be-secure-openssl.c b/src/backend/libpq/be-s= ecure-openssl.c index c97c811..e24d7de 100644 --- a/src/backend/libpq/be-secure-openssl.c +++ b/src/backend/libpq/be-secure-openssl.c @@ -1287,19 +1287,19 @@ ssl_protocol_version_to_openssl(int v, const char *= guc_name, int loglevel) case PG_TLS1_VERSION: return TLS1_VERSION; case PG_TLS1_1_VERSION: -#ifdef TLS1_1_VERSION +#if defined(TLS1_1_VERSION) && TLS1_1_VERSION <=3D TLS_MAX_VERSION return TLS1_1_VERSION; #else break; #endif case PG_TLS1_2_VERSION: -#ifdef TLS1_2_VERSION +#if defined(TLS1_2_VERSION) && TLS1_2_VERSION <=3D TLS_MAX_VERSION return TLS1_2_VERSION; #else break; #endif case PG_TLS1_3_VERSION: -#ifdef TLS1_3_VERSION +#if defined(TLS1_3_VERSION) && TLS1_2_VERSION <=3D TLS_MAX_VERSION return TLS1_3_VERSION; #else break; @@ -1335,11 +1335,11 @@ SSL_CTX_set_min_proto_version(SSL_CTX *ctx, int ver= sion) =20 if (version > TLS1_VERSION) ssl_options |=3D SSL_OP_NO_TLSv1; -#ifdef TLS1_1_VERSION +#if defined(TLS1_1_VERSION) && TLS1_1_VERSION <=3D TLS_MAX_VERSION if (version > TLS1_1_VERSION) ssl_options |=3D SSL_OP_NO_TLSv1_1; #endif -#ifdef TLS1_2_VERSION +#if defined(TLS1_2_VERSION) && TLS1_2_VERSION <=3D TLS_MAX_VERSION if (version > TLS1_2_VERSION) ssl_options |=3D SSL_OP_NO_TLSv1_2; #endif @@ -1356,11 +1356,11 @@ SSL_CTX_set_max_proto_version(SSL_CTX *ctx, int ver= sion) =20 AssertArg(version !=3D 0); =20 -#ifdef TLS1_1_VERSION +#if defined(TLS1_1_VERSION) && TLS1_1_VERSION <=3D TLS_MAX_VERSION if (version < TLS1_1_VERSION) ssl_options |=3D SSL_OP_NO_TLSv1_1; #endif -#ifdef TLS1_2_VERSION +#if defined(TLS1_2_VERSION) && TLS1_2_VERSION <=3D TLS_MAX_VERSION if (version < TLS1_2_VERSION) ssl_options |=3D SSL_OP_NO_TLSv1_2; #endif --MP_/xsvI4.h_8VeeVLxp5vBuEqu-- --Sig_/cld1_.eTqsjNIOUMZ9NV2Ok Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEFG4QQhBB9X2KhYuOLKgdQPSqZewFAl2J6uMACgkQLKgdQPSq ZexxlA//VrNTKzoGO1EQgSVp9SnyB2IJfZ0EP7fDMbRNIdjzDeDTDxx2Iu8HWo2+ EqiDBPFivMrmW7yCa+7RXtgzNFiJ9lkLvi6zltqtHJadLN5g229wbtfEebAWejtV 3vdPz52zCILr+BmPSlfvyfA0q99on4PErCAPtfcWFBcmOIuyW+7jSfNL8GQU5MO/ VQBjlQcJwjZ4qRFUwilIvo/874weeIcf0he/SW2BpApiH9s0/C9l30ncxdMjWYid ILpAJD95ZrmMbcMIDV8HQt5JLbNv8n94UI7f01G7rIwgKXuwijxTuCl4spTFyqwM HurokU4Q/thzIla7YZMFESdcUWSIL7MYYnsUUZcDJEEvs1TUbgQrYOOUwPYH5/ov XOwQEijJKtpxbIx7kWWLX1RI4kj64kPZr+5mMQQ0qG9LLC9p2QV6/38P/d1ps61Z j1yXxpJpGd4friNCI2HUWb9ZeKAFEyZi2/g8aByKXqZLNjVSqdEFzPMqGHUPmvze 0nhKiXpjFq6Ua75ibwENo2jj+K6cYi3VVjTPH9RVPBOzCOYw4lRDg1MjBVSvi8k8 C8njV1Of46OneaJiY4LDAjWHbeZA2NNFrHxeb21qjTlTWFEhUa+Y7PBPC+Pe7veL JInVmgdzofOgfDw4u5Kq7fKXO4g2sV8H06GOZI3H3PevKc49oEk= =VGqP -----END PGP SIGNATURE----- --Sig_/cld1_.eTqsjNIOUMZ9NV2Ok--