Skip to main content

devpi-lockdown: tools to enable authentication for read access

Project description

devpi-lockdown: tools to enable authentication for read access

This plugin adds some views to allow locking down read access to devpi.

Only tested with nginx so far.

Installation

devpi-lockdown needs to be installed alongside devpi-server.

You can install it with:

pip install devpi-lockdown

Usage

To lock down read access to devpi, you need a proxy in front of devpi which can use the provided views to limit access.

The views are:

/+authcheck

This returns 200 when the user is authenticated or 401 if not. It uses the regular devpi credential checks and an additional credential check using a cookie provided by devpi-lockdown to allow login with a browser.

/+login

A plain login form to allow access via browsers for use with devpi-web.

/+logout

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_page 401 = @error401;
    location @error401 {
        return 302 /+login;
    }

    # the location to check whether the provided infos authenticate the user
    location = /+authcheck {
        internal;

        proxy_pass_request_body off;
        proxy_set_header Content-Length "";
        proxy_set_header X-Original-URI $request_uri;
        proxy_set_header X-outside-url https://$host;
        proxy_pass http://localhost:3141;
    }

    # pass on /+login without authentication check to allow login
    location = /+login {
        proxy_set_header X-outside-url https://$host;
        proxy_pass http://localhost:3141;
    }

    # pass on /+api without authentication check for URL endpoint discovery
    location ~ /\+api$ {
        proxy_set_header X-outside-url https://$host;
        proxy_pass http://localhost:3141;
    }

    # use auth_request to lock down all the rest
    location / {
        auth_request /+authcheck;
        proxy_set_header X-outside-url https://$host;
        proxy_pass http://localhost:3141;
    }
}

If you use the example configuration from devpi-server then you have to add the auth_request check to the file and documentation parts as well.

Changelog

1.0.0 - 2017-03-10

  • initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

devpi-lockdown-1.0.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

devpi_lockdown-1.0.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file devpi-lockdown-1.0.0.tar.gz.

File metadata

File hashes

Hashes for devpi-lockdown-1.0.0.tar.gz
Algorithm Hash digest
SHA256 df00666e1fa8fb6e1734ac923121a61c404239f018def775e2c0c8fd988bf652
MD5 ed0bc690ed68bfb39638194edbb52b97
BLAKE2b-256 5c553899d5c3408833f432a5c23f49dbdd9e6d8e20a56d7441dc4d0ca56ef14e

See more details on using hashes here.

File details

Details for the file devpi_lockdown-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for devpi_lockdown-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 24f8ee15e0326e52e6c196938dab074d8baef1d7079885157f671a85deb3b877
MD5 8248ee726a97f2cfdb8a569d82fba7b4
BLAKE2b-256 0bd707c8de20f4f87202f432089fe9c1a03026902ddf77b79147f451e86c475a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page