Commit 861f6c1e authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

Support SSL on server

Obviously, without the key being in the repository.

Unfortunately, twisted seems to be lacking SSL-TCP-IPv6 support :-(.
Using IPv4 for now, but needs to be discussed.
parent e4b08210
......@@ -15,6 +15,8 @@ log_file: master.log
log_file_size: 134217728
; Maximum number of backup log files when rotated
log_file_count: 5
; The SSL certificate
cert = server.key
; The plugins to load follow. Each name is the class to load and instantiate.
......
#!/usr/bin/python2
from twisted.internet import reactor
from twisted.internet.endpoints import TCP6ServerEndpoint
from twisted.internet import reactor, ssl
from twisted.internet.endpoints import SSL4ServerEndpoint
import log_extra
import logging
import logging.handlers
......@@ -31,7 +31,9 @@ for (plugin, config) in master_config.plugins().items():
logging.info('Loaded plugin %s from %s', loaded_plugins[plugin].name(), plugin)
# Some configuration, to load the port from?
port = master_config.getint('port')
endpoint = TCP6ServerEndpoint(reactor, port)
with open(master_config.get('cert')) as key:
cert = ssl.PrivateCertificate.loadPEM(key.read())
endpoint = SSL4ServerEndpoint(reactor, port, cert.options())
logging.info('Listening on port %s', port)
endpoint.listen(ClientFactory(plugins))
logging.info('Init done')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment