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 1ibprK-0001jM-B3 for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Dec 2019 17:51:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ibprJ-0000FB-2a for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Dec 2019 17:51:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ibprI-0000F4-Pd for pgsql-hackers@lists.postgresql.org; Mon, 02 Dec 2019 17:51:40 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ibprC-0002we-2Y for pgsql-hackers@postgresql.org; Mon, 02 Dec 2019 17:51:40 +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 xB2HpQeI004449; Mon, 2 Dec 2019 12:51:26 -0500 From: Tom Lane To: Robert Haas cc: Michael Paquier , Magnus Hagander , Daniel Gustafsson , Peter Eisentraut , pgsql-hackers Subject: Re: Update minimum SSL version In-reply-to: References: <224FD25C-BA10-44FA-95AA-F97C35FB3BB0@yesql.se> <20191129125727.GN2505@paquier.xyz> <13786.1575041447@sss.pgh.pa.us> <20191130024345.GD99291@paquier.xyz> <929.1575304768@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Mon, 02 Dec 2019 12:40:18 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4447.1575309086.1@sss.pgh.pa.us> Date: Mon, 02 Dec 2019 12:51:26 -0500 Message-ID: <4448.1575309086@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas writes: > On Mon, Dec 2, 2019 at 11:39 AM Tom Lane wrote: >> Maybe it'd be worth extending that to show the max supported >> version, with some rats-nest of #ifdefs, but I'm not sure if >> it's worth the trouble. > Especially if we mess up the #ifdefs. :-) Yah. Although, looking at the code in be-secure-openssl.c, it doesn't look that hard to do in an extensible way. Something like (untested) static int ssl_protocol_version_to_openssl(int v, const char *guc_name, int loglevel) { switch (v) { case PG_TLS_ANY: return 0; case PG_TLS1_VERSION: +#define PG_MAX_TLS_VERSION "TLSv1" return TLS1_VERSION; case PG_TLS1_1_VERSION: #ifdef TLS1_1_VERSION +#undef PG_MAX_TLS_VERSION +#define PG_MAX_TLS_VERSION "TLSv1.1" return TLS1_1_VERSION; #else break; #endif case PG_TLS1_2_VERSION: #ifdef TLS1_2_VERSION +#undef PG_MAX_TLS_VERSION +#define PG_MAX_TLS_VERSION "TLSv1.2" return TLS1_2_VERSION; #else break; #endif case PG_TLS1_3_VERSION: #ifdef TLS1_3_VERSION +#undef PG_MAX_TLS_VERSION +#define PG_MAX_TLS_VERSION "TLSv1.3" return TLS1_3_VERSION; #else break; #endif } ereport(loglevel, (errmsg("%s setting %s not supported by this build", guc_name, - GetConfigOption(guc_name, false, false)))); + GetConfigOption(guc_name, false, false)), + errdetail("Maximum supported TLS version is %s.", + PG_MAX_TLS_VERSION))); return -1; } regards, tom lane