remove hard-coded key, max_age
Showing
... | ... | @@ -3,6 +3,7 @@ |
# http://musta.sh/2012-03-04/twisted-tcp-proxy.html | ||
import sys | ||
from os import environ | ||
from twisted.internet import defer | ||
from twisted.internet import protocol | ||
... | ... | @@ -16,6 +17,9 @@ from websockets import WebSocketsResource, lookupProtocolForFactory |
from django.core import signing | ||
PROXY_SECRET = environ.get('PROXY_SECRET') | ||
KEY_MAX_AGE = environ.get('KEY_MAX_AGE', 300) | ||
class ProxyClientProtocol(protocol.Protocol): | ||
def connectionMade(self): | ||
... | ... | @@ -61,7 +65,7 @@ class VNCWebSocketHandler(Protocol): |
def makeConnection(self, transport): | ||
try: | ||
value = signing.loads(transport.request.args['d'][0], | ||
key='asdasd', max_age=300) | ||
Please
register
or
sign in
to reply
|
||
key=PROXY_SECRET, max_age=KEY_MAX_AGE) | ||
|
||
port = value['port'] | ||
host = value['host'] | ||
except: | ||
... | ... |