Beispiel #1
0
 def pre_spawn_start(self, user, spawner):
     """Open PAM session for user"""
     try:
         pamela.open_session(user.name, service=self.service)
     except pamela.PAMError as e:
         self.log.warn("Failed to open PAM session for %s: %s", user.name,
                       e)
Beispiel #2
0
 def pre_spawn_start(self, user, spawner):
     """Open PAM session for user if so configured"""
     if not self.open_sessions:
         return
     try:
         pamela.open_session(user.name, service=self.service)
     except pamela.PAMError as e:
         self.log.warning("Failed to open PAM session for %s: %s", user.name, e)
         self.log.warning("Disabling PAM sessions from now on.")
         self.open_sessions = False
Beispiel #3
0
 def pre_spawn_start(self, user, spawner):
     """Open PAM session for user if so configured"""
     if not self.open_sessions:
         return
     try:
         pamela.open_session(user.name, service=self.service, encoding=self.encoding)
     except pamela.PAMError as e:
         self.log.warning("Failed to open PAM session for %s: %s", user.name, e)
         self.log.warning("Disabling PAM sessions from now on.")
         self.open_sessions = False
Beispiel #4
0
def auth(username, password):
    from pamela import authenticate, open_session, PAMError
    try:
        authenticate(username, password,  service=settings.ANTILLES_PAM_SERVICE)
    except PAMError:
        raise
    try:
        open_session(username, service=settings.ANTILLES_PAM_SERVICE)
    except PAMError:
        logger.exception('Error call "open_session"')
Beispiel #5
0
 def authenticate(self, handler, data):
     """Authenticate with PAM, and return the username if login is successful.
 
     Return None otherwise.
     """
     username = data['username']
     if not self.check_whitelist(username):
         return
     try:
         pamela.authenticate(username, data['password'], service=self.service)
         pamela.open_session(username, service=self.service)
     except pamela.PAMError as e:
         self.log.warn("PAM Authentication failed: %s", e)
     else:
         return username
Beispiel #6
0
 def pre_spawn_start(self, user, spawner):
     """Open PAM session for user"""
     try:
         pamela.open_session(user.name, service=self.service)
     except pamela.PAMError as e:
         self.log.warn("Failed to open PAM session for %s: %s", user.name, e)