Changeset 288 for trunk/packages/sipb-xen-vnc-server
- Timestamp:
- Mar 28, 2008, 8:29:04 PM (17 years ago)
- Location:
- trunk/packages/sipb-xen-vnc-server
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-vnc-server/code/vncexternalauth.py
r125 r288 46 46 47 47 def dataReceived(self,data): 48 #self.socks.log(self,"R"+data) 48 49 self.socks.write(data) 49 50 50 51 def write(self,data): 51 #self.socks.log(self, data)52 #self.socks.log(self,'W'+data) 52 53 self.transport.write(data) 53 54 … … 66 67 def validateToken(self, token): 67 68 global TOKEN_KEY 69 self.auth_error = "Invalid token" 68 70 try: 69 71 token = base64.urlsafe_b64decode(token) … … 71 73 m = hmac.new(TOKEN_KEY, digestmod=sha) 72 74 m.update(token['data']) 73 self.auth_error = "Invalid token"74 75 if (m.digest() == token['digest']): 75 76 data = cPickle.loads(token['data']) … … 82 83 else: 83 84 self.auth_error = "Token has expired; please try logging in again" 84 except :85 self.auth = None 85 except (TypeError, cPickle.UnpicklingError): 86 self.auth = None 86 87 print sys.exc_info() 87 88 … … 100 101 (header, data) = line.split(": ", 1) 101 102 headers[header] = data 102 except :103 except ValueError: 103 104 pass 104 105 … … 115 116 if ("Auth-token" in headers): 116 117 token = headers["Auth-token"] 117 try: 118 self.validateToken(token) 119 finally: 120 if self.auth is not None: 121 port = getPort(vmname, self.auth_data) 122 if port is not None: # FIXME 123 if port is not 0: 124 d = self.connectClass(self.server, port, VNCAuthOutgoing, self) 125 d.addErrback(lambda result, self=self: self.makeReply(404, result.getErrorMessage())) 126 else: 127 self.makeReply(404, "Unable to find VNC for VM "+vmname) 118 self.validateToken(token) 119 if self.auth is not None: 120 port = getPort(vmname, self.auth_data) 121 if port is not None: # FIXME 122 if port != 0: 123 d = self.connectClass(self.server, port, VNCAuthOutgoing, self) 124 d.addErrback(lambda result, self=self: self.makeReply(404, result.getErrorMessage())) 128 125 else: 129 self.makeReply(40 1, "Unauthorized to connect toVM "+vmname)126 self.makeReply(404, "Unable to find VNC for VM "+vmname) 130 127 else: 131 if self.auth_error: 132 self.makeReply(401, self.auth_error) 133 else: 134 self.makeReply(401, "Invalid token") 128 self.makeReply(401, "Unauthorized to connect to VM "+vmname) 129 else: 130 if self.auth_error: 131 self.makeReply(401, self.auth_error) 132 else: 133 self.makeReply(401, "Invalid token") 135 134 else: 136 135 self.makeReply(401, "Login first") -
trunk/packages/sipb-xen-vnc-server/code/vncproxy.py
- Property svn:executable set to *
r115 r288 1 1 #! /usr/bin/python 2 from twisted.internet import reactor 2 from twisted.internet import reactor, ssl 3 3 import vncexternalauth 4 4 5 sslContext = ssl.DefaultOpenSSLContextFactory( 6 'vncproxykey.pem', 7 'vncproxy.crt', 8 ) 9 5 10 if '__main__' == __name__: 6 reactor.listenTCP(10003,vncexternalauth.VNCAuthFactory("./vncauth.log", "localhost")) 11 reactor.listenSSL(10003,vncexternalauth.VNCAuthFactory("./vncauth.log", "localhost"), contextFactory=sslContext) 12 #reactor.listenTCP(10003,vncexternalauth.VNCAuthFactory("./vncauth.log", "localhost")) 7 13 reactor.run() -
trunk/packages/sipb-xen-vnc-server/debian/control
r286 r288 6 6 Standards-Version: 3.7.2 7 7 8 Package: sipb-xen- dhcp8 Package: sipb-xen-vnc-server 9 9 Architecture: all 10 10 Depends: ${misc:Depends}, daemon, python-twisted-core, xen-utils-3.1-1 -
trunk/packages/sipb-xen-vnc-server/debian/sipb-xen-vnc-server.init
r286 r288 46 46 # 2 if daemon could not be started 47 47 daemon --running -n $NAME && return 1 48 daemon -r - D "$(dirname $DAEMON)"-O daemon.info -E daemon.err -n $NAME -U $DAEMON $DAEMON_ARGS || return 248 daemon -r -U -O daemon.info -E daemon.err -n $NAME -U $DAEMON $DAEMON_ARGS || return 2 49 49 } 50 50
Note: See TracChangeset
for help on using the changeset viewer.