Пример #1
0
 def testBadUsername(self):
     db = checkers.PluggableAuthenticationModulesChecker()
     conv = self._makeConv({1: 'password', 2: 'entry', 3: ''})
     creds = credentials.PluggableAuthenticationModules('baduser', conv)
     d = db.requestAvatarId(creds)
     self.assertFailure(d, error.UnauthorizedLogin)
     return d
Пример #2
0
 def testRequestAvatarId(self):
     db = checkers.PluggableAuthenticationModulesChecker()
     conv = self._makeConv({1: 'password', 2: 'entry', 3: ''})
     creds = credentials.PluggableAuthenticationModules('testuser', conv)
     d = db.requestAvatarId(creds)
     d.addCallback(self.assertEqual, 'testuser')
     return d
Пример #3
0
    def __init__(self, *a, **kw):
        usage.Options.__init__(self, *a, **kw)

        # call the default addCheckers (for backwards compatibility) that will
        # be used if no --auth option is provided - note that conch's
        # UNIXPasswordDatabase is used, instead of twisted.plugins.cred_unix's
        # checker
        super(Options, self).addChecker(conch_checkers.UNIXPasswordDatabase())
        super(Options, self).addChecker(conch_checkers.SSHPublicKeyDatabase())
        if pamauth is not None:
            super(Options, self).addChecker(
                checkers.PluggableAuthenticationModulesChecker())
Пример #4
0
    def __init__(self):
        TCPApplication.__init__(self)
        _ConsumerMixin.__init__(self)

        #t = factory.OpenSSHFactory()
        t = MyFactory()  #Use my factory instead of the original one
        t.portal = portal.Portal(unix.UnixSSHRealm(
        ))  #Instanciate all the needed stuff to create to protocol
        t.portal.registerChecker(checkers.UNIXPasswordDatabase())
        t.portal.registerChecker(checkers.SSHPublicKeyDatabase())
        if checkers.pamauth:
            t.portal.registerChecker(
                chk.PluggableAuthenticationModulesChecker())
        t.dataRoot = '/etc/ssh'
        t.moduliRoot = '/etc/ssh'

        t.startFactory()
        self.app = t.buildProtocol("lala")
        self.app.transport = self
Пример #5
0
 def create_pam_checker(self, **kw):
     #TODO: test this
     return checkers.PluggableAuthenticationModulesChecker()