summaryrefslogtreecommitdiffstats
path: root/gitautodeploy/gitautodeploy.py
diff options
context:
space:
mode:
authorOliver Poignant <oliver@poignant.se>2017-01-07 12:24:10 +0100
committerOliver Poignant <oliver@poignant.se>2017-01-07 12:24:10 +0100
commitef4b78f5ac47b9c51f4afdcc386f15873932aaec (patch)
tree808842a2c19231a303e29660f55bbdb46d0df6f8 /gitautodeploy/gitautodeploy.py
parent6dfc5094495bda3c513ca461da863a25ce04907d (diff)
downloadGit-Auto-Deploy-ef4b78f5ac47b9c51f4afdcc386f15873932aaec.zip
Git-Auto-Deploy-ef4b78f5ac47b9c51f4afdcc386f15873932aaec.tar.gz
Git-Auto-Deploy-ef4b78f5ac47b9c51f4afdcc386f15873932aaec.tar.bz2
Auth key for web socket server access
Diffstat (limited to 'gitautodeploy/gitautodeploy.py')
-rw-r--r--gitautodeploy/gitautodeploy.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/gitautodeploy/gitautodeploy.py b/gitautodeploy/gitautodeploy.py
index e5edc3c..6bf8693 100644
--- a/gitautodeploy/gitautodeploy.py
+++ b/gitautodeploy/gitautodeploy.py
@@ -170,6 +170,7 @@ class GitAutoDeploy(object):
import socket
import os
import logging
+ import base64
from .lock import Lock
# This solves https://github.com/olipo186/Git-Auto-Deploy/issues/118
@@ -239,6 +240,9 @@ class GitAutoDeploy(object):
self._pid = os.getpid()
self.create_pid_file()
+ # Generate auth key to protect the web socket server
+ self._server_status['auth-key'] = base64.b64encode(os.urandom(32))
+
# Clear any existing lock files, with no regard to possible ongoing processes
for repo_config in self._config['repositories']:
@@ -404,7 +408,7 @@ class GitAutoDeploy(object):
from twisted.internet.error import BindError
# Create a WebSocketClientHandler instance
- WebSocketClientHandler = WebSocketClientHandlerFactory(self._config, self._ws_clients, self._event_store)
+ WebSocketClientHandler = WebSocketClientHandlerFactory(self._config, self._ws_clients, self._event_store, self._server_status)
uri = u"ws://%s:%s" % (self._config['wss-host'], self._config['wss-port'])
factory = WebSocketServerFactory(uri)