From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 7603385272 for ; Fri, 17 Dec 2021 13:58:23 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6B8912B2AF for ; Fri, 17 Dec 2021 13:57:53 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 06EC72B2A2 for ; Fri, 17 Dec 2021 13:57:52 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id D49EB4539A for ; Fri, 17 Dec 2021 13:57:51 +0100 (CET) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pve-devel@lists.proxmox.com Date: Fri, 17 Dec 2021 13:57:29 +0100 Message-Id: <20211217125733.548305-4-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211217125733.548305-1-f.gruenbichler@proxmox.com> References: <20211217125733.548305-1-f.gruenbichler@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.007 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_NUMSUBJECT 0.5 Subject ends in numbers excluding current years SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [anyevent.pm, utils.pm] Subject: [pve-devel] [PATCH http-server 3/3] fix #3789: allow disabling TLS v1.2/v1.3 X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Dec 2021 12:58:23 -0000 SSL 2 and 3 are already disabled by default by us, and TLS 1.1 and below are disabled by default on Debian systems. requires corresponding patch in pve-manager to have an effect. Signed-off-by: Fabian Grünbichler --- src/PVE/APIServer/AnyEvent.pm | 5 +++++ src/PVE/APIServer/Utils.pm | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm index e31cf7d..e0c3eee 100644 --- a/src/PVE/APIServer/AnyEvent.pm +++ b/src/PVE/APIServer/AnyEvent.pm @@ -1904,6 +1904,11 @@ sub new { if (delete $self->{ssl}->{honor_cipher_order}) { $tls_ctx_flags |= &Net::SSLeay::OP_CIPHER_SERVER_PREFERENCE; } + # workaround until anyevent supports disabling TLS 1.3 directly + if (exists($self->{ssl}->{tlsv1_3}) && !$self->{ssl}->{tlsv1_3}) { + $tls_ctx_flags |= &Net::SSLeay::OP_NO_TLSv1_3; + } + $self->{tls_ctx} = AnyEvent::TLS->new(%{$self->{ssl}}); Net::SSLeay::CTX_set_options($self->{tls_ctx}->{ctx}, $tls_ctx_flags); diff --git a/src/PVE/APIServer/Utils.pm b/src/PVE/APIServer/Utils.pm index 2ec2dad..5728d97 100644 --- a/src/PVE/APIServer/Utils.pm +++ b/src/PVE/APIServer/Utils.pm @@ -24,11 +24,20 @@ sub read_proxy_config { $shcmd .= 'echo \"TLS_KEY_FILE:\$TLS_KEY_FILE\";'; $shcmd .= 'echo \"HONOR_CIPHER_ORDER:\$HONOR_CIPHER_ORDER\";'; $shcmd .= 'echo \"COMPRESSION:\$COMPRESSION\";'; + $shcmd .= 'echo \"DISABLE_TLS_1_2:\$DISABLE_TLS_1_2\";'; + $shcmd .= 'echo \"DISABLE_TLS_1_3:\$DISABLE_TLS_1_3\";'; my $data = -f $conffile ? `bash -c "$shcmd"` : ''; my $res = {}; + my $boolean_options = [ + 'HONOR_CIPHER_ORDER', + 'COMPRESSION', + 'DISABLE_TLS_1_2', + 'DISABLE_TLS_1_3', + ]; + while ($data =~ s/^(.*)\n//) { my ($key, $value) = split(/:/, $1, 2); next if !defined($value) || $value eq ''; @@ -56,7 +65,7 @@ sub read_proxy_config { $res->{$key} = $value; } elsif ($key eq 'TLS_KEY_FILE') { $res->{$key} = $value; - } elsif ($key eq 'HONOR_CIPHER_ORDER' || $key eq 'COMPRESSION') { + } elsif (grep { $key eq $_ } @$boolean_options) { die "unknown value '$value' - use 0 or 1\n" if $value !~ m/^(0|1)$/; $res->{$key} = $value; } else { -- 2.30.2