Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/auth by pam #149

Merged
merged 8 commits into from
Jun 24, 2016
Merged

Conversation

blade2005
Copy link
Contributor

No description provided.

def listdir(root):
return listdir_cache.get(root, _listdir)
except ImportError:
listdir = _listdir
Copy link
Contributor

@mplanchard mplanchard Jun 24, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blade2005 what's the purpose of this block in relation to the pam auth?

Copy link
Contributor Author

@blade2005 blade2005 Jun 24, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ha. I know what happened. This is older code from my version of core.py that got patched. When I rebased it got pulled back in.

See this is why you shouldn't game and code.

I'll refactor and redo the PR. Let's just get this version out for now.

EDIT: What I mean is that I'll close this PR and we can release without the pam auth.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup as I thought. This section was removed in 18dc199 and because I was hurrying I didn't look closely enough at what git was telling me.

@mplanchard mplanchard mentioned this pull request Jun 24, 2016
@mplanchard
Copy link
Contributor

Bueno!

@mplanchard
Copy link
Contributor

So, not to be persnickety, but I would like to get some tests in for this if possible. I can work on adding them, but I won't have time before I leave tomorrow for vacation. As such, I think we can wait and push this out as an update to the next version, unless you have any objections, @ankostis.

@mplanchard
Copy link
Contributor

Meh, looking at it, we're not really doing any logic. It would be the equivalent of testing pam's code, which I don't think we need to do. I'm going to merge this and release a new beta.

@mplanchard mplanchard merged commit 9e379a4 into pypiserver:master Jun 24, 2016
@mplanchard
Copy link
Contributor

@blade2005 can you confirm that the most recent version 1.2.0b1 works as expected?

@blade2005
Copy link
Contributor Author

Current master: 0bf0024 works as expected. I test with a incorrect password and got a 403 forbidden response. Cleared cached and tried again and was able to download the package.

Test pypi-server with API accessors used was

#!/usr/bin/python2.7

from pypiserver import bottle
import pypiserver
from pypiserver.core import auth_by_pam

kwds = pypiserver.default_config(auther=auth_by_pam, root='/packages', authenticated=['update','download'], port=8092)
config = pypiserver.Configuration(**kwds)
app = pypiserver.app(**kwds)
print config
bottle.run(app=app, host=config.host, port=config.port, server=config.server)

@ankostis ankostis self-assigned this Jun 24, 2016
@ankostis
Copy link
Member

@blade2005 I cannot use this auther to upload a package.
Can you give me a concrete example??

Also for the example code to work, the following dependency is needed (which is missing from the docs): pip install pam

@ankostis
Copy link
Member

@mplanchard said:

think we can wait and push this out as an update to the next version,

Yes, I agree.

@ankostis
Copy link
Member

Also I suggest to squash small commits like these.

@blade2005
Copy link
Contributor Author

Because the import is inside the function rather than at the top it is imported only in the context of the function itself causing it to be an optional dependancy. Though the README should be updated to reflect that.

My original plan had been to squash it all into one. I usually do.

@mplanchard
Copy link
Contributor

@ankostis, with a quick update to the README, I think we're good to release. I can get that done today if you don't have the time. Let me know.

@blade2005
Copy link
Contributor Author

@ankostis

using the file i provided above and running that in a vagrant instance.

 2431  [2016-06-24 11:31:23]  git clone https://github.com/pypiserver/pypiserver.git
 2432  [2016-06-24 11:31:27]  cd pypiserver/
 2436  [2016-06-24 11:33:52]  nano ~/.pypirc
 2437  [2016-06-24 11:34:46]  python setup.py sdist upload -r test

Which in the end gave me the following:

running sdist
running egg_info
writing requirements to pypiserver.egg-info/requires.txt
writing pypiserver.egg-info/PKG-INFO
writing top-level names to pypiserver.egg-info/top_level.txt
writing dependency_links to pypiserver.egg-info/dependency_links.txt
writing entry points to pypiserver.egg-info/entry_points.txt
writing manifest file 'pypiserver.egg-info/SOURCES.txt'
running check
creating pypiserver-1.2.0b1
creating pypiserver-1.2.0b1/bin
creating pypiserver-1.2.0b1/pypiserver
creating pypiserver-1.2.0b1/pypiserver.egg-info
creating pypiserver-1.2.0b1/requirements
creating pypiserver-1.2.0b1/tests
making hard links in pypiserver-1.2.0b1...
hard linking .dockerignore -> pypiserver-1.2.0b1
hard linking .gitignore -> pypiserver-1.2.0b1
hard linking .project.sample -> pypiserver-1.2.0b1
hard linking .pydevproject.sample -> pypiserver-1.2.0b1
hard linking .travis.yml -> pypiserver-1.2.0b1
hard linking AUTHORS.rst -> pypiserver-1.2.0b1
hard linking CHANGES.rst -> pypiserver-1.2.0b1
hard linking Dockerfile -> pypiserver-1.2.0b1
hard linking LICENSE.txt -> pypiserver-1.2.0b1
hard linking README.rst -> pypiserver-1.2.0b1
hard linking bootstrap.py -> pypiserver-1.2.0b1
hard linking buildout.cfg -> pypiserver-1.2.0b1
hard linking docker-compose.yml -> pypiserver-1.2.0b1
hard linking pypiserver_logo.png -> pypiserver-1.2.0b1
hard linking setup.cfg -> pypiserver-1.2.0b1
hard linking setup.py -> pypiserver-1.2.0b1
hard linking tox.ini -> pypiserver-1.2.0b1
hard linking bin/.gitignore -> pypiserver-1.2.0b1/bin
hard linking bin/commit-standalone.sh -> pypiserver-1.2.0b1/bin
hard linking bin/gen-standalone.sh -> pypiserver-1.2.0b1/bin
hard linking bin/package.sh -> pypiserver-1.2.0b1/bin
hard linking bin/test_standalone.sh -> pypiserver-1.2.0b1/bin
hard linking pypiserver/__init__.py -> pypiserver-1.2.0b1/pypiserver
hard linking pypiserver/__main__.py -> pypiserver-1.2.0b1/pypiserver
hard linking pypiserver/_app.py -> pypiserver-1.2.0b1/pypiserver
hard linking pypiserver/bottle.py -> pypiserver-1.2.0b1/pypiserver
hard linking pypiserver/cache.py -> pypiserver-1.2.0b1/pypiserver
hard linking pypiserver/core.py -> pypiserver-1.2.0b1/pypiserver
hard linking pypiserver/manage.py -> pypiserver-1.2.0b1/pypiserver
hard linking pypiserver/welcome.html -> pypiserver-1.2.0b1/pypiserver
hard linking pypiserver.egg-info/PKG-INFO -> pypiserver-1.2.0b1/pypiserver.egg-info
hard linking pypiserver.egg-info/SOURCES.txt -> pypiserver-1.2.0b1/pypiserver.egg-info
hard linking pypiserver.egg-info/dependency_links.txt -> pypiserver-1.2.0b1/pypiserver.egg-info
hard linking pypiserver.egg-info/entry_points.txt -> pypiserver-1.2.0b1/pypiserver.egg-info
hard linking pypiserver.egg-info/requires.txt -> pypiserver-1.2.0b1/pypiserver.egg-info
hard linking pypiserver.egg-info/top_level.txt -> pypiserver-1.2.0b1/pypiserver.egg-info
hard linking pypiserver.egg-info/zip-safe -> pypiserver-1.2.0b1/pypiserver.egg-info
hard linking requirements/dev.pip -> pypiserver-1.2.0b1/requirements
hard linking requirements/exe.pip -> pypiserver-1.2.0b1/requirements
hard linking tests/__init__.py -> pypiserver-1.2.0b1/tests
hard linking tests/centodeps-setup.py -> pypiserver-1.2.0b1/tests
hard linking tests/htpasswd.a.a -> pypiserver-1.2.0b1/tests
hard linking tests/sample_msg.html -> pypiserver-1.2.0b1/tests
hard linking tests/test_app.py -> pypiserver-1.2.0b1/tests
hard linking tests/test_core.py -> pypiserver-1.2.0b1/tests
hard linking tests/test_docs.py -> pypiserver-1.2.0b1/tests
hard linking tests/test_init.py -> pypiserver-1.2.0b1/tests
hard linking tests/test_main.py -> pypiserver-1.2.0b1/tests
hard linking tests/test_manage.py -> pypiserver-1.2.0b1/tests
hard linking tests/test_server.py -> pypiserver-1.2.0b1/tests
copying setup.cfg -> pypiserver-1.2.0b1
Writing pypiserver-1.2.0b1/setup.cfg
creating 'dist/pypiserver-1.2.0b1.zip' and adding 'pypiserver-1.2.0b1' to it
adding 'pypiserver-1.2.0b1/.dockerignore'
adding 'pypiserver-1.2.0b1/buildout.cfg'
adding 'pypiserver-1.2.0b1/PKG-INFO'
adding 'pypiserver-1.2.0b1/pypiserver_logo.png'
adding 'pypiserver-1.2.0b1/tox.ini'
adding 'pypiserver-1.2.0b1/docker-compose.yml'
adding 'pypiserver-1.2.0b1/Dockerfile'
adding 'pypiserver-1.2.0b1/setup.py'
adding 'pypiserver-1.2.0b1/.gitignore'
adding 'pypiserver-1.2.0b1/setup.cfg'
adding 'pypiserver-1.2.0b1/LICENSE.txt'
adding 'pypiserver-1.2.0b1/bootstrap.py'
adding 'pypiserver-1.2.0b1/.pydevproject.sample'
adding 'pypiserver-1.2.0b1/README.rst'
adding 'pypiserver-1.2.0b1/.project.sample'
adding 'pypiserver-1.2.0b1/CHANGES.rst'
adding 'pypiserver-1.2.0b1/.travis.yml'
adding 'pypiserver-1.2.0b1/AUTHORS.rst'
adding 'pypiserver-1.2.0b1/pypiserver.egg-info/entry_points.txt'
adding 'pypiserver-1.2.0b1/pypiserver.egg-info/PKG-INFO'
adding 'pypiserver-1.2.0b1/pypiserver.egg-info/zip-safe'
adding 'pypiserver-1.2.0b1/pypiserver.egg-info/dependency_links.txt'
adding 'pypiserver-1.2.0b1/pypiserver.egg-info/SOURCES.txt'
adding 'pypiserver-1.2.0b1/pypiserver.egg-info/requires.txt'
adding 'pypiserver-1.2.0b1/pypiserver.egg-info/top_level.txt'
adding 'pypiserver-1.2.0b1/requirements/exe.pip'
adding 'pypiserver-1.2.0b1/requirements/dev.pip'
adding 'pypiserver-1.2.0b1/pypiserver/manage.py'
adding 'pypiserver-1.2.0b1/pypiserver/bottle.py'
adding 'pypiserver-1.2.0b1/pypiserver/welcome.html'
adding 'pypiserver-1.2.0b1/pypiserver/__init__.py'
adding 'pypiserver-1.2.0b1/pypiserver/_app.py'
adding 'pypiserver-1.2.0b1/pypiserver/cache.py'
adding 'pypiserver-1.2.0b1/pypiserver/__main__.py'
adding 'pypiserver-1.2.0b1/pypiserver/core.py'
adding 'pypiserver-1.2.0b1/tests/sample_msg.html'
adding 'pypiserver-1.2.0b1/tests/test_main.py'
adding 'pypiserver-1.2.0b1/tests/test_manage.py'
adding 'pypiserver-1.2.0b1/tests/htpasswd.a.a'
adding 'pypiserver-1.2.0b1/tests/test_init.py'
adding 'pypiserver-1.2.0b1/tests/test_app.py'
adding 'pypiserver-1.2.0b1/tests/__init__.py'
adding 'pypiserver-1.2.0b1/tests/centodeps-setup.py'
adding 'pypiserver-1.2.0b1/tests/test_docs.py'
adding 'pypiserver-1.2.0b1/tests/test_core.py'
adding 'pypiserver-1.2.0b1/tests/test_server.py'
adding 'pypiserver-1.2.0b1/bin/gen-standalone.sh'
adding 'pypiserver-1.2.0b1/bin/.gitignore'
adding 'pypiserver-1.2.0b1/bin/test_standalone.sh'
adding 'pypiserver-1.2.0b1/bin/commit-standalone.sh'
adding 'pypiserver-1.2.0b1/bin/package.sh'
removing 'pypiserver-1.2.0b1' (and everything under it)
running upload
Submitting dist/pypiserver-1.2.0b1.zip to http://127.0.0.1:8092/
Server response (200): OK

Upload does work.

I will do another PR to reflect that. I will also add some better error handling for core.py on the import if someone doesn't have pam installed.

@blade2005 blade2005 deleted the feature/auth-by-pam branch June 24, 2016 16:46
@ankostis
Copy link
Member

  • @mplanchard OK, but I would prefer that you do the actual release in pypi and gpg-tagging this time; so start with this beta1, and probably you would need help to pack and commit the standalone script.
  • @blade2005 the instructions definitely need some improvements to explain how one can authenticate through /etc/passwd work.
    In general, I believe that in a future release it's worthwhile to reflect this feature in main() flags; but I would wait the planned introduction of docopt, to facilitate the use of more complicated cmd-line flags.

@mplanchard
Copy link
Contributor

mplanchard commented Jun 24, 2016

@ankostis you're right. I haven't packaged the standalone script before. Seems like we run gen-standalone.sh and then commit-standalone.sh? I'll go ahead and release the beta.

@blade2005 blade2005 restored the feature/auth-by-pam branch June 24, 2016 18:26
@ankostis ankostis modified the milestone: M1.2.0 Jun 25, 2016
michaelkuty pushed a commit to michaelkuty/pypiserver that referenced this pull request Jun 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants