From 7f0271a5c034f3aa5d9ba647691cbc0cc9cc0c1b Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 6 Aug 2020 19:19:20 +0100 Subject: [PATCH] Add a comment about SSLv23_METHOD --- changelog.d/8043.misc | 1 + synapse/crypto/context_factory.py | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 changelog.d/8043.misc diff --git a/changelog.d/8043.misc b/changelog.d/8043.misc new file mode 100644 index 000000000000..683d55366616 --- /dev/null +++ b/changelog.d/8043.misc @@ -0,0 +1 @@ +Add a comment to `ServerContextFactory` about the use of `SSLv23_METHOD`. diff --git a/synapse/crypto/context_factory.py b/synapse/crypto/context_factory.py index a5a2a7815d61..777c0f00b18d 100644 --- a/synapse/crypto/context_factory.py +++ b/synapse/crypto/context_factory.py @@ -48,6 +48,14 @@ class ServerContextFactory(ContextFactory): connections.""" def __init__(self, config): + # TODO: once pyOpenSSL exposes TLS_METHOD and SSL_CTX_set_min_proto_version, + # switch to those (see https://github.com/pyca/cryptography/issues/5379). + # + # note that, despite the confusing name, SSLv23_METHOD does *not* enforce SSLv2 + # or v3, but is a synonym for TLS_METHOD, which allows the client and server + # to negotiate an appropriate version of TLS constrained by the version options + # set with context.set_options. + # self._context = SSL.Context(SSL.SSLv23_METHOD) self.configure_context(self._context, config)