Commit 2ee60a87 by Bach Dániel

remove hard-coded key, max_age

parent b11d7197
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# http://musta.sh/2012-03-04/twisted-tcp-proxy.html # http://musta.sh/2012-03-04/twisted-tcp-proxy.html
import sys import sys
from os import environ
from twisted.internet import defer from twisted.internet import defer
from twisted.internet import protocol from twisted.internet import protocol
...@@ -16,6 +17,9 @@ from websockets import WebSocketsResource, lookupProtocolForFactory ...@@ -16,6 +17,9 @@ from websockets import WebSocketsResource, lookupProtocolForFactory
from django.core import signing from django.core import signing
PROXY_SECRET = environ.get('PROXY_SECRET')
KEY_MAX_AGE = environ.get('KEY_MAX_AGE', 300)
class ProxyClientProtocol(protocol.Protocol): class ProxyClientProtocol(protocol.Protocol):
def connectionMade(self): def connectionMade(self):
...@@ -61,7 +65,7 @@ class VNCWebSocketHandler(Protocol): ...@@ -61,7 +65,7 @@ class VNCWebSocketHandler(Protocol):
def makeConnection(self, transport): def makeConnection(self, transport):
try: try:
value = signing.loads(transport.request.args['d'][0], value = signing.loads(transport.request.args['d'][0],
key='asdasd', max_age=300) key=PROXY_SECRET, max_age=KEY_MAX_AGE)
Please register or sign in to reply
Please register or sign in to reply
port = value['port'] port = value['port']
host = value['host'] host = value['host']
except: except:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment