* [pve-devel] [PATCH http-server] fix #4859: properly configure TLSv1.3 only mode
@ 2023-07-18 12:51 Fabian Grünbichler
2023-07-19 9:16 ` Fabian Grünbichler
0 siblings, 1 reply; 2+ messages in thread
From: Fabian Grünbichler @ 2023-07-18 12:51 UTC (permalink / raw)
To: pve-devel
set_min/max_proto_version is recommended upstream nowadays, and it seems to be
required for some reason if *only* TLS v1.3 is supposed to be enabled.
querying via get_options gives us the union of
- system-wide openssl defaults
- our internal SSL defaults
- flags configured by the user via /etc/default/pveproxy
note that by default only 1.2 and 1.3 are enabled in the first place, so
disabling either leaves a single version being set as both min and max.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
/etc/default/pveproxy settings and their effect tested with sslscan
src/PVE/APIServer/AnyEvent.pm | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm
index 1fd7a74..e5a852b 100644
--- a/src/PVE/APIServer/AnyEvent.pm
+++ b/src/PVE/APIServer/AnyEvent.pm
@@ -2012,6 +2012,23 @@ sub new {
warn "Failed to set TLS 1.3 ciphersuites '$ciphersuites'\n"
if !Net::SSLeay::CTX_set_ciphersuites($self->{tls_ctx}->{ctx}, $ciphersuites);
}
+
+ my $opts = Net::SSLeay::CTX_get_options($self->{tls_ctx}->{ctx});
+ my $min_version = Net::SSLeay::TLS1_1_VERSION();
+ my $max_version = Net::SSLeay::TLS1_3_VERSION();
+ if ($opts & Net::SSLeay::OP_NO_TLSv1_1) {
+ $min_version = Net::SSLeay::TLS1_2_VERSION();
+ }
+ if ($opts & Net::SSLeay::OP_NO_TLSv1_2) {
+ $min_version = Net::SSLeay::TLS1_3_VERSION();
+ }
+ if ($opts & Net::SSLeay::OP_NO_TLSv1_3) {
+ die "misconfigured TLS settings - cannot disable all supported TLS versions!\n"
+ if $min_version == Net::SSLeay::TLS1_3_VERSION();
+ $max_version = Net::SSLeay::TLS1_2_VERSION();
+ }
+ Net::SSLeay::CTX_set_min_proto_version($self->{tls_ctx}->{ctx}, $min_version);
+ Net::SSLeay::CTX_set_max_proto_version($self->{tls_ctx}->{ctx}, $max_version);
}
if ($self->{spiceproxy}) {
--
2.39.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [pve-devel] [PATCH http-server] fix #4859: properly configure TLSv1.3 only mode
2023-07-18 12:51 [pve-devel] [PATCH http-server] fix #4859: properly configure TLSv1.3 only mode Fabian Grünbichler
@ 2023-07-19 9:16 ` Fabian Grünbichler
0 siblings, 0 replies; 2+ messages in thread
From: Fabian Grünbichler @ 2023-07-19 9:16 UTC (permalink / raw)
To: Proxmox VE development discussion
this version is actually breaking spiceproxy, please use v2 (just sent) instead!
On July 18, 2023 2:51 pm, Fabian Grünbichler wrote:
> set_min/max_proto_version is recommended upstream nowadays, and it seems to be
> required for some reason if *only* TLS v1.3 is supposed to be enabled.
>
> querying via get_options gives us the union of
> - system-wide openssl defaults
> - our internal SSL defaults
> - flags configured by the user via /etc/default/pveproxy
>
> note that by default only 1.2 and 1.3 are enabled in the first place, so
> disabling either leaves a single version being set as both min and max.
>
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> ---
> /etc/default/pveproxy settings and their effect tested with sslscan
>
> src/PVE/APIServer/AnyEvent.pm | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm
> index 1fd7a74..e5a852b 100644
> --- a/src/PVE/APIServer/AnyEvent.pm
> +++ b/src/PVE/APIServer/AnyEvent.pm
> @@ -2012,6 +2012,23 @@ sub new {
> warn "Failed to set TLS 1.3 ciphersuites '$ciphersuites'\n"
> if !Net::SSLeay::CTX_set_ciphersuites($self->{tls_ctx}->{ctx}, $ciphersuites);
> }
> +
> + my $opts = Net::SSLeay::CTX_get_options($self->{tls_ctx}->{ctx});
> + my $min_version = Net::SSLeay::TLS1_1_VERSION();
> + my $max_version = Net::SSLeay::TLS1_3_VERSION();
> + if ($opts & Net::SSLeay::OP_NO_TLSv1_1) {
> + $min_version = Net::SSLeay::TLS1_2_VERSION();
> + }
> + if ($opts & Net::SSLeay::OP_NO_TLSv1_2) {
> + $min_version = Net::SSLeay::TLS1_3_VERSION();
> + }
> + if ($opts & Net::SSLeay::OP_NO_TLSv1_3) {
> + die "misconfigured TLS settings - cannot disable all supported TLS versions!\n"
> + if $min_version == Net::SSLeay::TLS1_3_VERSION();
> + $max_version = Net::SSLeay::TLS1_2_VERSION();
> + }
> + Net::SSLeay::CTX_set_min_proto_version($self->{tls_ctx}->{ctx}, $min_version);
> + Net::SSLeay::CTX_set_max_proto_version($self->{tls_ctx}->{ctx}, $max_version);
> }
>
> if ($self->{spiceproxy}) {
> --
> 2.39.2
>
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-19 9:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-18 12:51 [pve-devel] [PATCH http-server] fix #4859: properly configure TLSv1.3 only mode Fabian Grünbichler
2023-07-19 9:16 ` Fabian Grünbichler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox