devpi锁定:为读取访问启用身份验证的工具
devpi-lockdown的Python项目详细描述
devpi锁定:用于启用读访问身份验证的工具
这个插件添加了一些视图,允许锁定对devpi的读访问。
目前为止只有nginx测试过。
安装
devpi-lockdown需要与devpi-server一起安装。
您可以使用以下命令安装它:
pip install devpi-lockdown
使用量
要锁定对devpi的读取访问,需要在devpi前面有一个代理,该代理可以使用提供的视图来限制访问。
视图如下:
/+验证检查
This returns ^{tt3}$ when the user is authenticated or ^{tt4}$ if not. It uses the regular devpi credential checks and an additional credential check using a cookie provided by ^{tt1}$ to allow login with a browser.
/+登录
A plain login form to allow access via browsers for use with ^{tt6}$.
/+注销
Drops the authentication cookie.
For nginx the auth_request module is required and the configuration would something look like this:
server{...# this redirects to the login view when not logged in error_page401=@error401;location@error401{return302/+login;}# the location to check whether the provided infos authenticate the user location=/+authcheck{internal;proxy_pass_request_bodyoff;proxy_set_headerContent-Length"";proxy_set_headerX-Original-URI$request_uri;proxy_set_headerX-outside-urlhttps://$host;proxy_passhttp://localhost:3141;}# lock down everything by default auth_request/+authcheck;# pass on /+login without authentication check to allow login location=/+login{auth_requestoff;proxy_set_headerX-outside-urlhttps://$host;proxy_passhttp://localhost:3141;}# pass on /+api without authentication check for URL endpoint discovery location~/\+api${auth_requestoff;proxy_set_headerX-outside-urlhttps://$host;proxy_passhttp://localhost:3141;}# pass on /+static without authentication check for browser access to css etc location/+static/{auth_requestoff;proxy_set_headerX-outside-urlhttps://$host;proxy_passhttp://localhost:3141;}# use auth_request to lock down all the rest location/{proxy_set_headerX-outside-urlhttps://$host;proxy_passhttp://localhost:3141;}}
更改日志
1.0.1-2018年11月16日
- 修复棱锥体的导入>;=1.10.0。
- 将/+static添加到配置中
- 默认情况下锁定配置中的所有内容,并且只允许 必要位置
1.0.0-2017年3月10日
- 初始版本