Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

nginxauthdaemon

Authentication daemon for nginx-proxied or nginx-served applications.

Installation and Configuration

  1. Create virtual environment for the daemon virtualenv env

  2. Activate it using . ./env/bin/activate

  3. Install nginxauthdaemon from pypi pip install nginxauthdaemon

  4. Create config file overriding default values, see [Daemon configuration]. NB! You need to override default SESSION_SALT, DES_IV and DES_KEY for security.

  5. Setup env variable DAEMON_SETTINGS pointing to your config file.

  6. Run daemon with your favorite WSGI server, for ex gunicorn nginxauthdaemon:app.

  7. Update nginx.conf. See [NGINX Configuration].

  8. Reload nginx (nginx -t reload).

  9. Test your setup.

Daemon configuration

Basic configuration properties are:

Option

Description

REALM_NAME

Realm name shown on login page

SESSION_COOKIE

Session cookie name. Typically you do not need to change this.

TARGET_HEADER

Header used to pass protected URL from NGINX

SESSION_SALT

Long string used a salt for creation of session key.

DES_IV

8byte initial vector for DES algorithm

DES_KEY

8byte DES encryption key

AUTHENTICATOR

Authenticator class name, by default ‘auth.DummyAuthenticator’

Authenticators available out-of-the-box:

Authenticator name

Description

nginxauthdaemon.auth.DummyAuthenticator

Simplest authenticator checking username equals password

nginxauthdaemon.crowdauth.CrowdAuthenticator

Atlassian Crowd based authenticator

Crowd authenticator has additional options:

Option

Description

CROWD_URL

Crowd server URL, for ex http://localhost:8095/crowd/

CROWD_APP_NAME

Crowd application name

CROWD_APP_PASSWORD

Crowd application password

NGINX Configuration

Your NGINX should be compiled with ngx_http_auth_request_module. Please check it using nginx -V command.

Example configuration:

upstream auth-backend {
    server 127.0.0.1:5000;
}

location = /auth/validate {
    internal;
    proxy_pass http://auth-backend;

    proxy_pass_request_body off;
    proxy_set_header Content-Length "";
}

location = /auth/login {
    proxy_pass http://auth-backend;
    proxy_set_header X-Target $request_uri;
}

# Protected application
location / {
    auth_request /auth/validate;

    # redirect 401 and 403 to login form
    error_page 401 403 =200 /auth/login;
}

Limitations

Daemon can be extended to support LDAP or any other auth method, but it support only Atlassian Crowd for now. I’ll be happy to merge PRs with new auth methods.

License

The reference implementation is subject to MIT License.

Metadata

Release files for nginxauthdaemon 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nginxauthdaemon 1.1.0
File Size Uploaded Provenance Actions
nginxauthdaemon-1.1.0.tar.gz 8.0 kB Without provenance Details for nginxauthdaemon-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nginxauthdaemon 1.1.0
File Interpreter ABI Platform Actions
nginxauthdaemon-1.1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details for nginxauthdaemon-1.1.0-py2.py3-none-any.whl

Total release size: 18.6 kB

Release files / nginxauthdaemon-1.1.0.tar.gz

Download URL nginxauthdaemon-1.1.0.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4dd34ee0f018c97f4df6f45de63e6b7aace1266273e68c3cb66d2a6090067d38
BLAKE2b-256 checksum
How to use checksums
03806779c441b9bb37292604b14c09df4ec941966d9c0c60a6fae87fa22a6fca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / nginxauthdaemon-1.1.0-py2.py3-none-any.whl

Download URL nginxauthdaemon-1.1.0-py2.py3-none-any.whl
Size 10.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e1a5de77f17a8653a73d98f4f40ab1f4bac1c2c524ee52a6a2b9cdbc7f44e23a
BLAKE2b-256 checksum
How to use checksums
578f7b171d4996446feb7a558e0dff0d710aedcf7d9a4cfe578482100c804380
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for nginxauthdaemon 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page