[Twisted-Python] SSH server silently failing to open port

Jason Stitt jason at pengale.com
Sun Sep 12 16:53:33 MDT 2004


Hi,

I'm still trying to get my SFTP server up. After looking over 
SFTPGateway in some detail, I think I have an idea of where all the 
pieces fit, but I'm still having the problem I had before with the 
sshsimpleserver example. Even though my factory is being instantiated 
and the log output says it's starting on the port I specified, the port 
is not, in fact, open to any connections.

Because there is no error reported, I'm having a hard time debugging 
this. I know that my factory's __init__ method completes successfully, 
and startFactory is also called. After that... nothing.

Can anyone help me figure out where to start looking, at least?

Thanks,

Jason

Here's my Factory class, minus a few comments and debug print 
statements:

class Factory(factory.SSHFactory):

     def __init__(self):
         self.portal = portal.Portal(Realm())

         def makeConnection(*args, **kw):
             return Connection(*args, **kw)

         self.services = {
             'ssh-userauth': userauth.SSHUserAuthServer,
             'ssh-connection': makeConnection,
         }

         # TODO: replace this with keys loaded from a file
         self.__private_keys = {
             'ssh-rsa': keys.getPublicKeyString(data=publicKey)
         }
         self.__public_keys = {
             'ssh-rsa': keys.getPrivateKeyObject(data=privateKey)
         }

     def buildProtocol(self, address):
         # Note: this function does not use its address parameter. I 
don't know
         # why it's there.
         return factory.SSHFactory.buildProtocol(self, address)

     def getPrivateKeys(self):
         return self.__private_keys.copy()

     def getPublicKeys(self):
         return self.__public_keys.copy()





More information about the Twisted-Python mailing list