示例#1
0
def makeService(config):
    t = factory.OpenSSHFactory()
    t.portal = portal.Portal(unix.UnixSSHRealm())
    t.portal.registerChecker(checkers.UNIXPasswordDatabase())
    t.portal.registerChecker(checkers.SSHPublicKeyDatabase())
    if pamauth is not None:
        from twisted.cred.checkers import PluggableAuthenticationModulesChecker
        t.portal.registerChecker(PluggableAuthenticationModulesChecker())
    t.dataRoot = config['data']
    t.moduliRoot = config['moduli'] or config['data']
    port = config['port']
    if config['interface']:
        # Add warning here
        port += ':interface=' + config['interface']
    return strports.service(port, t)
示例#2
0
def makeService(config):
    """
    Construct a service for operating a SSH server.

    @param config: An L{Options} instance specifying server options, including
    where server keys are stored and what authentication methods to use.

    @return: An L{IService} provider which contains the requested SSH server.
    """

    t = factory.OpenSSHFactory()

    r = unix.UnixSSHRealm()
    t.portal = portal.Portal(r, config.get('credCheckers', []))
    t.dataRoot = config['data']
    t.moduliRoot = config['moduli'] or config['data']

    port = config['port']
    if config['interface']:
        # Add warning here
        port += ':interface=' + config['interface']
    return strports.service(port, t)
示例#3
0
文件: tcp.py 项目: thurday/muXTCP
    def sshServer(self):

        from twisted.conch import checkers, unix
        from twisted.conch.openssh_compat import factory
        from twisted.cred import portal
        from twisted.python import usage
        from twisted.application import strports

        t = factory.OpenSSHFactory()
        t.portal = portal.Portal(unix.UnixSSHRealm())
        t.portal.registerChecker(checkers.UNIXPasswordDatabase())
        t.portal.registerChecker(checkers.SSHPublicKeyDatabase())
        if checkers.pamauth:
            t.portal.registerChecker(
                checkers.PluggableAuthenticationModulesChecker())
        t.dataRoot = '/etc/ssh'
        t.moduliRoot = '/etc/ssh'

        t.startFactory()
        self.app = t.buildProtocol("lala")
        self.app.transport = self

        self.app.connectionMade()
示例#4
0
def makeService(config):
    """
    Construct a service for operating a SSH server.

    @param config: An L{Options} instance specifying server options, including
        where server keys are stored and what authentication methods to use.

    @return: A L{twisted.application.service.IService} provider which contains
        the requested SSH server.
    """

    t = factory.OpenSSHFactory()

    r = unix.UnixSSHRealm()
    t.portal = portal.Portal(r, config.get("credCheckers", []))
    t.dataRoot = config["data"]
    t.moduliRoot = config["moduli"] or config["data"]

    port = config["port"]
    if config["interface"]:
        # Add warning here
        port += ":interface=" + config["interface"]
    return strports.service(port, t)