mirror of
https://git.proxmox.com/git/pve-http-server
synced 2025-05-02 17:57:54 +00:00
fix #3789: allow disabling TLS v1.2/v1.3
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 <f.gruenbichler@proxmox.com> Tested-by: Stoiko Ivanov <s.ivanov@proxmox.com> Reviewed-by: Stoiko Ivanov <s.ivanov@proxmox.com>
This commit is contained in:
parent
d93700f182
commit
e902248507
@ -1908,6 +1908,11 @@ sub new {
|
|||||||
if (delete $self->{ssl}->{honor_cipher_order}) {
|
if (delete $self->{ssl}->{honor_cipher_order}) {
|
||||||
$tls_ctx_flags |= &Net::SSLeay::OP_CIPHER_SERVER_PREFERENCE;
|
$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}});
|
$self->{tls_ctx} = AnyEvent::TLS->new(%{$self->{ssl}});
|
||||||
Net::SSLeay::CTX_set_options($self->{tls_ctx}->{ctx}, $tls_ctx_flags);
|
Net::SSLeay::CTX_set_options($self->{tls_ctx}->{ctx}, $tls_ctx_flags);
|
||||||
|
@ -24,11 +24,20 @@ sub read_proxy_config {
|
|||||||
$shcmd .= 'echo \"TLS_KEY_FILE:\$TLS_KEY_FILE\";';
|
$shcmd .= 'echo \"TLS_KEY_FILE:\$TLS_KEY_FILE\";';
|
||||||
$shcmd .= 'echo \"HONOR_CIPHER_ORDER:\$HONOR_CIPHER_ORDER\";';
|
$shcmd .= 'echo \"HONOR_CIPHER_ORDER:\$HONOR_CIPHER_ORDER\";';
|
||||||
$shcmd .= 'echo \"COMPRESSION:\$COMPRESSION\";';
|
$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 $data = -f $conffile ? `bash -c "$shcmd"` : '';
|
||||||
|
|
||||||
my $res = {};
|
my $res = {};
|
||||||
|
|
||||||
|
my $boolean_options = [
|
||||||
|
'HONOR_CIPHER_ORDER',
|
||||||
|
'COMPRESSION',
|
||||||
|
'DISABLE_TLS_1_2',
|
||||||
|
'DISABLE_TLS_1_3',
|
||||||
|
];
|
||||||
|
|
||||||
while ($data =~ s/^(.*)\n//) {
|
while ($data =~ s/^(.*)\n//) {
|
||||||
my ($key, $value) = split(/:/, $1, 2);
|
my ($key, $value) = split(/:/, $1, 2);
|
||||||
next if !defined($value) || $value eq '';
|
next if !defined($value) || $value eq '';
|
||||||
@ -56,7 +65,7 @@ sub read_proxy_config {
|
|||||||
$res->{$key} = $value;
|
$res->{$key} = $value;
|
||||||
} elsif ($key eq 'TLS_KEY_FILE') {
|
} elsif ($key eq 'TLS_KEY_FILE') {
|
||||||
$res->{$key} = $value;
|
$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)$/;
|
die "unknown value '$value' - use 0 or 1\n" if $value !~ m/^(0|1)$/;
|
||||||
$res->{$key} = $value;
|
$res->{$key} = $value;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user