Skip to main content

REMOTE_USER Authenticator: An Authenticator for Jupyterhub to read user information from HTTP request headers, as when running behind an authenticating proxy. Based on https://github.com/cwaldbieser/jhub_remote_user_authenticator and https://github.com/rasmunk/jhub-authenticators

Project description

https://travis-ci.org/cbjuan/jhub_remote_login.svg?branch=master

Jupyterhub Authenticators

Authenticate to Jupyterhub using an authenticating proxy that can set the Remote-User header. Also supports for passing additional information to the jupyter user. This includes a list of user defined /data headers.

Architecture and Security Recommendations

This type of authentication relies on an HTTP header, and a malicious client could spoof the REMOTE_USER header. The recommended architecture for this type of authentication requires that an authenticating proxy be placed in front of your Jupyterhub. Your Jupyerhub should only be accessible from the proxy and never directly accessible by a client.

This type of access is typically enforced with network access controls. E.g. in a simple case, the host on which the Jupyterhub service accepts incoming requests has its host based firewall configured to only accept incoming connections from the proxy host.

Further, the authenticating proxy should make sure it removes any REMOTE_USER headers from incoming requests and only applies the header to proxied requests that have been properly authenticated.

Installation

This package can be installed with pip either from a local git repository or from PyPi.

Installation from local git repository:

cd jhub_remote_login
pip install .

Installation from PyPi:

pip install jhub-remote-login

Alternately, you can add the local project folder must be on your PYTHONPATH.

Configuration

You should edit your jupyterhub_config.py config file to set the authenticator class:

c.JupyterHub.authenticator_class = 'jhub_remote_login.RemoteUserAuthenticator'

You should be able to start jupyterhub. The “/login” resource will look for the authenticated user name in the HTTP header “Remote-User”. If found, and not blank, you will be logged in as that user.

Alternatively, you can use RemoteUserLocalAuthenticator:

c.JupyterHub.authenticator_class = 'jhub_remote_login.RemoteUserLocalAuthenticator'

This provides the same authentication functionality but is derived from LocalAuthenticator and therefore provides features such as the ability to add local accounts through the admin interface if configured to do so.

Dummy Authentication

Provides an option for testing JupyterHub authentication with a dummy authenticator that can have a global preset password for any account:

c.JupyterHub.authenticator_class = 'jhub_remote_login.DummyAuthenticator'
c.DummyAuthenticator.password = 'password'

Note! Don’t use in production.

Remote User Authentication extended with user-defined headers

Provides the capability to supply the jupyterhub user with additional state information via the /data path. This adds two base request paths to the jupyterhub web application:

'/login' -> requires a non empty Remote-User header
'/data' -> requires both an authenticated request and a valid configured header

Before information can be passed to the user via the ‘/data’ path, a list of valid headers is required. These preset valid headers are then upon a POST request to the ‘/data’ URl appended to the current authenticated jupyterhub user data dictionary. I.e. user.data[Header] = HeaderValue

The extended authenticator can be activated by setting the following option in the jupyterhub config file:

c.JupyterHub.authenticator_class = 'jhub_remote_login.DataRemoteUserAuthenticator'
# Making 'State' a valid header to pass to /data
c.DataRemoteUserAuthenticator.data_headers = ['State']

Beyond providing the custom header possibility, the authenticator also by default encodes the Remote-User header with ‘b32encode’. The authenticator therefore also provides the possibility of storing the actual value for debugging purposes in the user.real_name variable via the jupyterhub auth_state mechanism of passing information to the spawner as noted at Authenticators.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

jhub_remote_login-0.2.74.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jhub_remote_login-0.2.74-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file jhub_remote_login-0.2.74.tar.gz.

File metadata

  • Download URL: jhub_remote_login-0.2.74.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for jhub_remote_login-0.2.74.tar.gz
Algorithm Hash digest
SHA256 a3d8ebac458f21a01435c83bbd8f1666b69e0fbdaabd83c5e8b2fa497200f55e
MD5 5946bd49934c2b5a5d3c11449a3820cf
BLAKE2b-256 6c4943c410472da97d47c26a27ceb5d78b2e1b7633cf3c5b2aff2277b5f3eaa3

See more details on using hashes here.

File details

Details for the file jhub_remote_login-0.2.74-py3-none-any.whl.

File metadata

  • Download URL: jhub_remote_login-0.2.74-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for jhub_remote_login-0.2.74-py3-none-any.whl
Algorithm Hash digest
SHA256 b58153d279f467363ea2be35faedf0266ddd7b868625282b2e3482c380b07d4a
MD5 faada75e17713afb96100fa9632ec07f
BLAKE2b-256 f845b6398a6887c3e1672e06aa07f78b6df60b5f9f3d74c63e0409f0f2bca02d

See more details on using hashes here.

Supported by

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