summary refs log tree commit diff
path: root/synapse/http
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2018-09-19 17:59:33 +1000
committerGitHub <noreply@github.com>2018-09-19 17:59:33 +1000
commit3d6b24fb1b6e8d167062e1d5a551c7196b0a7e6c (patch)
treea7a4a97ca6ac93f02fd5d31bb38b9200b72a9589 /synapse/http
parentMerge pull request #3903 from matrix-org/rav/increase_get_missing_events_timeout (diff)
parentchangelog (diff)
downloadsynapse-3d6b24fb1b6e8d167062e1d5a551c7196b0a7e6c.tar.xz
Merge pull request #3907 from matrix-org/rav/set_sni_to_server_name
Set SNI to the server_name, not whatever was in the SRV record
Diffstat (limited to 'synapse/http')
-rw-r--r--synapse/http/endpoint.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/synapse/http/endpoint.py b/synapse/http/endpoint.py
index b0c9369519..91025037a3 100644
--- a/synapse/http/endpoint.py
+++ b/synapse/http/endpoint.py
@@ -108,7 +108,7 @@ def matrix_federation_endpoint(reactor, destination, tls_client_options_factory=
 
     Args:
         reactor: Twisted reactor.
-        destination (bytes): The name of the server to connect to.
+        destination (unicode): The name of the server to connect to.
         tls_client_options_factory
             (synapse.crypto.context_factory.ClientTLSOptionsFactory):
             Factory which generates TLS options for client connections.
@@ -126,10 +126,17 @@ def matrix_federation_endpoint(reactor, destination, tls_client_options_factory=
         transport_endpoint = HostnameEndpoint
         default_port = 8008
     else:
+        # the SNI string should be the same as the Host header, minus the port.
+        # as per https://github.com/matrix-org/synapse/issues/2525#issuecomment-336896777,
+        # the Host header and SNI should therefore be the server_name of the remote
+        # server.
+        tls_options = tls_client_options_factory.get_options(domain)
+
         def transport_endpoint(reactor, host, port, timeout):
             return wrapClientTLS(
-                tls_client_options_factory.get_options(host),
-                HostnameEndpoint(reactor, host, port, timeout=timeout))
+                tls_options,
+                HostnameEndpoint(reactor, host, port, timeout=timeout),
+            )
         default_port = 8448
 
     if port is None: