1
0
mirror of https://github.com/pypiserver/pypiserver synced 2024-11-09 16:45:51 +01:00

Merge pull request #151 from blade2005/topic/pam-auth

Added a try/except for importing pam with logging an error and update…
This commit is contained in:
Matthew Planchard 2016-06-24 12:16:19 -05:00 committed by GitHub
commit 90b75f26f5
2 changed files with 8 additions and 3 deletions

@ -111,7 +111,8 @@ Currently only password-protected uploads are supported!
bottle.run(app=app, host=config.host, port=config.port, server=config.server) bottle.run(app=app, host=config.host, port=config.port, server=config.server)
.. Note:: .. Note::
If you are getting authentication even with incorrect credentials please check your PAM configuration. - If you are getting authentication even with incorrect credentials please check your PAM configuration.
- This requires installing pam module `pip install pam`
#. On client-side, edit or create a `~/.pypirc` file with a similar content:: #. On client-side, edit or create a `~/.pypirc` file with a similar content::

@ -92,8 +92,12 @@ def auth_by_htpasswd_file(htPsswdFile, username, password):
def auth_by_pam(username, password): def auth_by_pam(username, password):
import pam try:
return pam.authenticate(username, password) import pam
return pam.authenticate(username, password)
except ImportError as error:
log.error('PAM module not found. Please install pam module')
return False
mimetypes.add_type("application/octet-stream", ".egg") mimetypes.add_type("application/octet-stream", ".egg")