Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Fix worker TLS (#4492)
Browse files Browse the repository at this point in the history
* load cert

* changelog

* fix
  • Loading branch information
hawkowl authored Jan 28, 2019
1 parent 7072fe3 commit 5d976c0
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 48 deletions.
1 change: 1 addition & 0 deletions changelog.d/4492.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Synapse can now automatically provision TLS certificates via ACME (the protocol used by CAs like Let's Encrypt).
12 changes: 6 additions & 6 deletions synapse/app/client_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,23 +164,23 @@ def start(config_options):

database_engine = create_engine(config.database_config)

tls_server_context_factory = context_factory.ServerContextFactory(config)
tls_client_options_factory = context_factory.ClientTLSOptionsFactory(config)

ss = ClientReaderServer(
config.server_name,
db_config=config.database_config,
tls_server_context_factory=tls_server_context_factory,
tls_client_options_factory=tls_client_options_factory,
config=config,
version_string="Synapse/" + get_version_string(synapse),
database_engine=database_engine,
)

ss.setup()
ss.start_listening(config.worker_listeners)

def start():
ss.config.read_certificate_from_disk()
ss.tls_server_context_factory = context_factory.ServerContextFactory(config)
ss.tls_client_options_factory = context_factory.ClientTLSOptionsFactory(
config
)
ss.start_listening(config.worker_listeners)
ss.get_datastore().start_profiling()

reactor.callWhenRunning(start)
Expand Down
12 changes: 6 additions & 6 deletions synapse/app/event_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,23 +185,23 @@ def start(config_options):

database_engine = create_engine(config.database_config)

tls_server_context_factory = context_factory.ServerContextFactory(config)
tls_client_options_factory = context_factory.ClientTLSOptionsFactory(config)

ss = EventCreatorServer(
config.server_name,
db_config=config.database_config,
tls_server_context_factory=tls_server_context_factory,
tls_client_options_factory=tls_client_options_factory,
config=config,
version_string="Synapse/" + get_version_string(synapse),
database_engine=database_engine,
)

ss.setup()
ss.start_listening(config.worker_listeners)

def start():
ss.config.read_certificate_from_disk()
ss.tls_server_context_factory = context_factory.ServerContextFactory(config)
ss.tls_client_options_factory = context_factory.ClientTLSOptionsFactory(
config
)
ss.start_listening(config.worker_listeners)
ss.get_datastore().start_profiling()

reactor.callWhenRunning(start)
Expand Down
12 changes: 6 additions & 6 deletions synapse/app/federation_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,23 +151,23 @@ def start(config_options):

database_engine = create_engine(config.database_config)

tls_server_context_factory = context_factory.ServerContextFactory(config)
tls_client_options_factory = context_factory.ClientTLSOptionsFactory(config)

ss = FederationReaderServer(
config.server_name,
db_config=config.database_config,
tls_server_context_factory=tls_server_context_factory,
tls_client_options_factory=tls_client_options_factory,
config=config,
version_string="Synapse/" + get_version_string(synapse),
database_engine=database_engine,
)

ss.setup()
ss.start_listening(config.worker_listeners)

def start():
ss.config.read_certificate_from_disk()
ss.tls_server_context_factory = context_factory.ServerContextFactory(config)
ss.tls_client_options_factory = context_factory.ClientTLSOptionsFactory(
config
)
ss.start_listening(config.worker_listeners)
ss.get_datastore().start_profiling()

reactor.callWhenRunning(start)
Expand Down
18 changes: 9 additions & 9 deletions synapse/app/federation_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,24 +183,24 @@ def start(config_options):
# Force the pushers to start since they will be disabled in the main config
config.send_federation = True

tls_server_context_factory = context_factory.ServerContextFactory(config)
tls_client_options_factory = context_factory.ClientTLSOptionsFactory(config)

ps = FederationSenderServer(
ss = FederationSenderServer(
config.server_name,
db_config=config.database_config,
tls_server_context_factory=tls_server_context_factory,
tls_client_options_factory=tls_client_options_factory,
config=config,
version_string="Synapse/" + get_version_string(synapse),
database_engine=database_engine,
)

ps.setup()
ps.start_listening(config.worker_listeners)
ss.setup()

def start():
ps.get_datastore().start_profiling()
ss.config.read_certificate_from_disk()
ss.tls_server_context_factory = context_factory.ServerContextFactory(config)
ss.tls_client_options_factory = context_factory.ClientTLSOptionsFactory(
config
)
ss.start_listening(config.worker_listeners)
ss.get_datastore().start_profiling()

reactor.callWhenRunning(start)
_base.start_worker_reactor("synapse-federation-sender", config)
Expand Down
12 changes: 6 additions & 6 deletions synapse/app/frontend_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,23 +241,23 @@ def start(config_options):

database_engine = create_engine(config.database_config)

tls_server_context_factory = context_factory.ServerContextFactory(config)
tls_client_options_factory = context_factory.ClientTLSOptionsFactory(config)

ss = FrontendProxyServer(
config.server_name,
db_config=config.database_config,
tls_server_context_factory=tls_server_context_factory,
tls_client_options_factory=tls_client_options_factory,
config=config,
version_string="Synapse/" + get_version_string(synapse),
database_engine=database_engine,
)

ss.setup()
ss.start_listening(config.worker_listeners)

def start():
ss.config.read_certificate_from_disk()
ss.tls_server_context_factory = context_factory.ServerContextFactory(config)
ss.tls_client_options_factory = context_factory.ClientTLSOptionsFactory(
config
)
ss.start_listening(config.worker_listeners)
ss.get_datastore().start_profiling()

reactor.callWhenRunning(start)
Expand Down
12 changes: 6 additions & 6 deletions synapse/app/media_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,23 +151,23 @@ def start(config_options):

database_engine = create_engine(config.database_config)

tls_server_context_factory = context_factory.ServerContextFactory(config)
tls_client_options_factory = context_factory.ClientTLSOptionsFactory(config)

ss = MediaRepositoryServer(
config.server_name,
db_config=config.database_config,
tls_server_context_factory=tls_server_context_factory,
tls_client_options_factory=tls_client_options_factory,
config=config,
version_string="Synapse/" + get_version_string(synapse),
database_engine=database_engine,
)

ss.setup()
ss.start_listening(config.worker_listeners)

def start():
ss.config.read_certificate_from_disk()
ss.tls_server_context_factory = context_factory.ServerContextFactory(config)
ss.tls_client_options_factory = context_factory.ClientTLSOptionsFactory(
config
)
ss.start_listening(config.worker_listeners)
ss.get_datastore().start_profiling()

reactor.callWhenRunning(start)
Expand Down
18 changes: 9 additions & 9 deletions synapse/app/user_dir.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,24 +211,24 @@ def start(config_options):
# Force the pushers to start since they will be disabled in the main config
config.update_user_directory = True

tls_server_context_factory = context_factory.ServerContextFactory(config)
tls_client_options_factory = context_factory.ClientTLSOptionsFactory(config)

ps = UserDirectoryServer(
ss = UserDirectoryServer(
config.server_name,
db_config=config.database_config,
tls_server_context_factory=tls_server_context_factory,
tls_client_options_factory=tls_client_options_factory,
config=config,
version_string="Synapse/" + get_version_string(synapse),
database_engine=database_engine,
)

ps.setup()
ps.start_listening(config.worker_listeners)
ss.setup()

def start():
ps.get_datastore().start_profiling()
ss.config.read_certificate_from_disk()
ss.tls_server_context_factory = context_factory.ServerContextFactory(config)
ss.tls_client_options_factory = context_factory.ClientTLSOptionsFactory(
config
)
ss.start_listening(config.worker_listeners)
ss.get_datastore().start_profiling()

reactor.callWhenRunning(start)

Expand Down

0 comments on commit 5d976c0

Please sign in to comment.