def __init__(self, **attribs): avatar.ConchUser.__init__(self) self.attribs = attribs self.channelLookup.update({"session": session.SSHSession}) server_class = conf.get('server-class') if(server_class and server_class != 'default'): server_class = reflect.namedAny(server_class) self.subsystemLookup.update({"sftp": server_class}) else: self.subsystemLookup.update({"sftp": filetransfer.FileTransferServer})
def makeService(cls, config): """ Create the txsftp service. """ if(conf.get('suppress-deprecation-warnings')): warnings.filterwarnings('ignore', r'.*', DeprecationWarning) get_key = lambda path: Key.fromString(data=open(path).read()) ssh_public_key = get_key(conf.get('ssh-public-key')) ssh_private_key = get_key(conf.get('ssh-private-key')) factory = SSHFactory() factory.privateKeys = {'ssh-rsa': ssh_private_key} factory.publicKeys = {'ssh-rsa': ssh_public_key} db = dbapi.connect(conf.get('db-url')) factory.portal = Portal(auth.VirtualizedSSHRealm(db)) factory.portal.registerChecker(auth.UsernamePasswordChecker(db)) factory.portal.registerChecker(auth.SSHKeyChecker(db)) return internet.TCPServer(conf.get('sftp-port'), factory)
def makeService(cls, config): """ Create the txsftp service. """ if (conf.get('suppress-deprecation-warnings')): warnings.filterwarnings('ignore', r'.*', DeprecationWarning) get_key = lambda path: Key.fromString(data=open(path).read()) ssh_public_key = get_key(conf.get('ssh-public-key')) ssh_private_key = get_key(conf.get('ssh-private-key')) factory = SSHFactory() factory.privateKeys = {'ssh-rsa': ssh_private_key} factory.publicKeys = {'ssh-rsa': ssh_public_key} db = dbapi.connect(conf.get('db-url')) factory.portal = Portal(auth.VirtualizedSSHRealm(db)) factory.portal.registerChecker(auth.UsernamePasswordChecker(db)) factory.portal.registerChecker(auth.SSHKeyChecker(db)) return internet.TCPServer(conf.get('sftp-port'), factory)