mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-19 16:03:00 +00:00
use pamela instead of simplepam
and open PAM sessions after successful auth
This commit is contained in:
@@ -8,7 +8,7 @@ import pwd
|
|||||||
from subprocess import check_call, check_output, CalledProcessError
|
from subprocess import check_call, check_output, CalledProcessError
|
||||||
|
|
||||||
from tornado import gen
|
from tornado import gen
|
||||||
import simplepam
|
import pamela
|
||||||
|
|
||||||
from traitlets.config import LoggingConfigurable
|
from traitlets.config import LoggingConfigurable
|
||||||
from traitlets import Bool, Set, Unicode, Any
|
from traitlets import Bool, Set, Unicode, Any
|
||||||
@@ -208,10 +208,11 @@ class PAMAuthenticator(LocalAuthenticator):
|
|||||||
username = data['username']
|
username = data['username']
|
||||||
if not self.check_whitelist(username):
|
if not self.check_whitelist(username):
|
||||||
return
|
return
|
||||||
# simplepam wants bytes, not unicode
|
try:
|
||||||
# see simplepam#3
|
pamela.authenticate(username, data['password'], service=self.service)
|
||||||
busername = username.encode(self.encoding)
|
pamela.open_session(username, service=self.service)
|
||||||
bpassword = data['password'].encode(self.encoding)
|
except pamela.PAMError as e:
|
||||||
if simplepam.authenticate(busername, bpassword, service=self.service):
|
self.log.warn("PAM Authentication failed: %s", e)
|
||||||
|
else:
|
||||||
return username
|
return username
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
traitlets>=4
|
traitlets>=4
|
||||||
tornado>=4
|
tornado>=4
|
||||||
jinja2
|
jinja2
|
||||||
simplepam
|
pamela
|
||||||
sqlalchemy
|
sqlalchemy
|
||||||
requests
|
requests
|
||||||
|
Reference in New Issue
Block a user