From 508fa68d7a2a7d7ef68a39df33b4c57e2260dfe6 Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Mon, 28 Aug 2017 21:01:49 -0300 Subject: [bug] check for conflicting ports + systemd fixes -- Related: #8867 --- pkg/server/soledad-server.service | 4 +++- src/leap/soledad/server/server.tac | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/server/soledad-server.service b/pkg/server/soledad-server.service index bf92dd18..73cc5920 100644 --- a/pkg/server/soledad-server.service +++ b/pkg/server/soledad-server.service @@ -3,8 +3,9 @@ Description=Soledad Server [Service] Environment=PATH=/sbin:/bin:/usr/sbin:/usr/bin -Environment=TAC=usr/lib/python2.7/dist-packages/leap/soledad/server/server.tac +Environment=TAC=/usr/lib/python2.7/dist-packages/leap/soledad/server/server.tac Environment=HTTPS_PORT=2424 +Environment=LOCAL_SERVICES_PORT=2525 Environment=CERT_PATH=/etc/soledad/soledad-server.pem Environment=PRIVKEY_PATH=/etc/soledad/soledad-server.key Environment=HOME=/var/lib/soledad/ @@ -16,6 +17,7 @@ ExecStart=/usr/bin/twistd \ --pidfile= \ --syslog \ --prefix=soledad-server \ + --python \ ${TAC} WorkingDirectory=/var/lib/soledad/ diff --git a/src/leap/soledad/server/server.tac b/src/leap/soledad/server/server.tac index 1bc3dc69..b443e632 100644 --- a/src/leap/soledad/server/server.tac +++ b/src/leap/soledad/server/server.tac @@ -1,14 +1,17 @@ +import sys import os from twisted.application import service, strports from twisted.web import server +from twisted.python import log from leap.soledad.server import entrypoint application = service.Application('soledad-server') # local entrypoint -local_description = 'tcp:2323:interface=127.0.0.1' +local_port = os.getenv('LOCAL_SERVICES_PORT', 2323) +local_description = 'tcp:%s:interface=127.0.0.1' % local_port local_site = server.Site(entrypoint.LocalServicesEntrypoint()) local_server = strports.service(local_description, local_site) @@ -16,6 +19,9 @@ local_server.setServiceParent(application) # public entrypoint port = os.getenv('HTTPS_PORT', None) +if port == local_port: + log.err("LOCAL_SERVICES_PORT and HTTPS_PORT can't be the same!") + sys.exit(20) if port: privateKey = os.getenv('PRIVKEY_PATH', '/etc/soledad/soledad-server.key') certKey = os.getenv('CERT_PATH', '/etc/soledad/soledad-server.pem') -- cgit v1.2.3