]> git.proxmox.com Git - pve-http-server.git/commitdiff
Add configurable 'honor_cipher_order'
authorStoiko Ivanov <s.ivanov@proxmox.com>
Fri, 15 Feb 2019 11:35:59 +0000 (12:35 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 19 Feb 2019 16:14:14 +0000 (17:14 +0100)
Needed to fix #2069.

Prefering the ciphers set in the server, instead of relying on the offer of the
client is considered good practice in TLS1.[012] (see e.g. [0]).

[0] https://cipherli.st/

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
PVE/APIServer/AnyEvent.pm

index 14e46fa0cdf6e7bb4347c9182616b83a30e094f3..38921364481a0eb31f126504c3b6443ce57bd9fe 100755 (executable)
@@ -1644,8 +1644,13 @@ sub new {
     $self->{end_cond} = AnyEvent->condvar;
 
     if ($self->{ssl}) {
+       my $tls_ctx_flags = &Net::SSLeay::OP_NO_COMPRESSION | &Net::SSLeay::OP_SINGLE_ECDH_USE | &Net::SSLeay::OP_SINGLE_DH_USE;
+       if ( delete $self->{ssl}->{honor_cipher_order} ) {
+           $tls_ctx_flags |= &Net::SSLeay::OP_CIPHER_SERVER_PREFERENCE;
+       }
+
        $self->{tls_ctx} = AnyEvent::TLS->new(%{$self->{ssl}});
-       Net::SSLeay::CTX_set_options($self->{tls_ctx}->{ctx}, &Net::SSLeay::OP_NO_COMPRESSION | &Net::SSLeay::OP_SINGLE_ECDH_USE | &Net::SSLeay::OP_SINGLE_DH_USE);
+       Net::SSLeay::CTX_set_options($self->{tls_ctx}->{ctx}, $tls_ctx_flags);
     }
 
     if ($self->{spiceproxy}) {