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
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
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())
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
def create_pam_checker(self, **kw): #TODO: test this return checkers.PluggableAuthenticationModulesChecker()