X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-vnc-server.git/blobdiff_plain/714abc13b25a88c7eec15efda49f9a4b93d32b0c..2857f03239df7a4d19f38041208115156eff8f69:/invirt-vnc-authtoken diff --git a/invirt-vnc-authtoken b/invirt-vnc-authtoken index c542d5e..a173f46 100755 --- a/invirt-vnc-authtoken +++ b/invirt-vnc-authtoken @@ -8,12 +8,19 @@ import sha import time import base64 from invirt.vnc import getTokenKey +from invirt.config import structs as config def getAuthToken(username, machine, lifetime=5*60): data = {} data['user'] = username data['machine'] = machine data['expires'] = time.time() + lifetime + data['connect_host'] = config.web.hostname + try: + data['connect_port'] = 10003 + [h.hostname for h in + config.hosts].index(os.uname()[1]) + except: + data['connect_port'] = 5900 pickled_data = cPickle.dumps(data) m = hmac.new(getTokenKey(), digestmod=sha) m.update(pickled_data)