summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2014-09-01 16:30:43 +0100
committerMark Haines <mark.haines@matrix.org>2014-09-01 16:30:43 +0100
commitef6a8e4f323ea0e54e5738566a18f781a793c086 (patch)
tree25219a76a28f1a849d21eec45d5e97fca3e08227
parentMerge branch 'develop' into server2server_tls (diff)
downloadsynapse-ef6a8e4f323ea0e54e5738566a18f781a793c086.tar.xz
Listen using SSL
-rwxr-xr-xsynapse/app/homeserver.py8
-rw-r--r--synapse/config/server.py2
2 files changed, 8 insertions, 2 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py
index 124eee8c8d..20c10bac66 100755
--- a/synapse/app/homeserver.py
+++ b/synapse/app/homeserver.py
@@ -29,6 +29,7 @@ from synapse.api.urls import (
     CLIENT_PREFIX, FEDERATION_PREFIX, WEB_CLIENT_PREFIX, CONTENT_REPO_PREFIX
 )
 from synapse.config.homeserver import HomeServerConfig
+from synapse.crypto import context_factory
 
 from daemonize import Daemonize
 import twisted.manhole.telnet
@@ -206,7 +207,9 @@ class SynapseHomeServer(HomeServer):
         return "%s-%s" % (resource, path_seg)
 
     def start_listening(self, port):
-        reactor.listenTCP(port, Site(self.root_resource))
+        reactor.listenSSL(
+            port, Site(self.root_resource), self.tls_context_factory
+        )
         logger.info("Synapse now listening on port %d", port)
 
 
@@ -230,11 +233,14 @@ def setup():
     else:
         domain_with_port = "%s:%s" % (config.server_name, config.bind_port)
 
+    tls_context_factory = context_factory.ServerContextFactory(config)
+
     hs = SynapseHomeServer(
         config.server_name,
         domain_with_port=domain_with_port,
         upload_dir=os.path.abspath("uploads"),
         db_name=config.database_path,
+        tls_context_factory=tls_context_factory,
     )
 
     hs.register_servlets()
diff --git a/synapse/config/server.py b/synapse/config/server.py
index a3aceb521d..7e8ff6a703 100644
--- a/synapse/config/server.py
+++ b/synapse/config/server.py
@@ -28,7 +28,7 @@ class ServerConfig(Config):
         self.bind_host = args.bind_host
         self.daemonize = args.daemonize
         self.pid_file = self.abspath(args.pid_file)
-        self.webclient = not args.no_webclient
+        self.webclient = args.no_webclient
         self.manhole = args.manhole
 
     @classmethod