added some utilty functions for passwords into makefile.
This commit is contained in:
parent
389d934f40
commit
2623ec044d
15
.env
15
.env
@ -33,14 +33,9 @@ DOCKER_NOTEBOOK_DIR=/home/jovyan/work
|
|||||||
# DO NOT CHANGE THIS. It is how the docker-stacks notebooks launch the single-user servers.
|
# DO NOT CHANGE THIS. It is how the docker-stacks notebooks launch the single-user servers.
|
||||||
DOCKER_SPAWN_CMD=start-singleuser.sh
|
DOCKER_SPAWN_CMD=start-singleuser.sh
|
||||||
|
|
||||||
# Name of JupyterHub container data volume
|
|
||||||
#DATA_VOLUME_HOST=stathub-data
|
|
||||||
|
|
||||||
# Data volume container mount point
|
# provide at least one user from `userlist` so that `make login` can show you the associated password
|
||||||
#DATA_VOLUME_CONTAINER=/data
|
# (useful when changing secret keys or creating hub for the first time)
|
||||||
|
# afterwards, you can visit /hub/login_list (if enabled and you are an admin) to see everyone's passwords.
|
||||||
# Name of JupyterHub postgres database data volume
|
USERNAME=default
|
||||||
#DB_VOLUME_HOST=stathub-db-data
|
PASSWORD_LENGTH=6
|
||||||
|
|
||||||
# The name of the postgres database containing JupyterHub state
|
|
||||||
#POSTGRES_DB=stathub
|
|
||||||
|
8
Makefile
8
Makefile
@ -2,6 +2,7 @@
|
|||||||
# Distributed under the terms of the Modified BSD License.
|
# Distributed under the terms of the Modified BSD License.
|
||||||
|
|
||||||
include .env
|
include .env
|
||||||
|
include secrets/oauth.env
|
||||||
|
|
||||||
.DEFAULT_GOAL=build
|
.DEFAULT_GOAL=build
|
||||||
|
|
||||||
@ -17,8 +18,11 @@ secrets/postgres.env:
|
|||||||
@echo "POSTGRES_PASSWORD=$(shell openssl rand -hex 32)" > $@
|
@echo "POSTGRES_PASSWORD=$(shell openssl rand -hex 32)" > $@
|
||||||
|
|
||||||
secrets/oauth.env:
|
secrets/oauth.env:
|
||||||
@echo "Need oauth.env file in secrets with GitHub parameters"
|
@echo "Generating postgres password in $@"
|
||||||
@exit 1
|
@echo "HASH_SECRET_KEY=$(shell openssl rand -hex 32)" > $@
|
||||||
|
|
||||||
|
login:
|
||||||
|
@docker run $(HUB_NAME) hashauthpw --length $(PASSWORD_LENGTH) $(USERNAME) $(HASH_SECRET_KEY)
|
||||||
|
|
||||||
secrets/jupyterhub.crt:
|
secrets/jupyterhub.crt:
|
||||||
@echo "Need an SSL certificate in secrets/jupyterhub.crt"
|
@echo "Need an SSL certificate in secrets/jupyterhub.crt"
|
||||||
|
@ -41,17 +41,18 @@ services:
|
|||||||
links:
|
links:
|
||||||
- hub-db
|
- hub-db
|
||||||
environment:
|
environment:
|
||||||
HUB_NAME: ${HUB_NAME}
|
#HUB_NAME: ${HUB_NAME}
|
||||||
# Notebook directory inside user image
|
# Notebook directory inside user image
|
||||||
DOCKER_NOTEBOOK_DIR: ${DOCKER_NOTEBOOK_DIR}
|
#DOCKER_NOTEBOOK_DIR: ${DOCKER_NOTEBOOK_DIR}
|
||||||
# Using this run command (optional)
|
# Using this run command (optional)
|
||||||
DOCKER_SPAWN_CMD: ${DOCKER_SPAWN_CMD}
|
#DOCKER_SPAWN_CMD: ${DOCKER_SPAWN_CMD}
|
||||||
# Postgres db info
|
# Postgres db info
|
||||||
POSTGRES_DB: ${HUB_NAME}
|
POSTGRES_DB: ${HUB_NAME}
|
||||||
POSTGRES_HOST: hub-db
|
POSTGRES_HOST: hub-db
|
||||||
env_file:
|
env_file:
|
||||||
- secrets/postgres.env
|
- secrets/postgres.env
|
||||||
- secrets/oauth.env
|
- secrets/oauth.env
|
||||||
|
- .env
|
||||||
command: >
|
command: >
|
||||||
jupyterhub -f /srv/jupyterhub/jupyterhub_config.py
|
jupyterhub -f /srv/jupyterhub/jupyterhub_config.py
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ c.JupyterHub.authenticator_class = 'hashauthenticator.HashAuthenticator'
|
|||||||
# You can generate a good "secret key" by running `openssl rand -hex 32` in terminal.
|
# You can generate a good "secret key" by running `openssl rand -hex 32` in terminal.
|
||||||
# it is recommended to do this from time-to-time to change passwords (including changing their length)
|
# it is recommended to do this from time-to-time to change passwords (including changing their length)
|
||||||
c.HashAuthenticator.secret_key = os.environ['HASH_SECRET_KEY'] # Defaults to ''
|
c.HashAuthenticator.secret_key = os.environ['HASH_SECRET_KEY'] # Defaults to ''
|
||||||
c.HashAuthenticator.password_length = 6 # Defaults to 6
|
c.HashAuthenticator.password_length = int(os.environ['PASSWORD_LENGTH']) # Defaults to 6
|
||||||
# Can find your password by looking at `hashauthpw --length 10 [username] [key]`
|
# Can find your password by looking at `hashauthpw --length 10 [username] [key]`
|
||||||
# If the `show_logins` option is set to `True`, a CSV file containing
|
# If the `show_logins` option is set to `True`, a CSV file containing
|
||||||
#login names and passwords will be served (to admins only) at `/hub/login_list`.
|
#login names and passwords will be served (to admins only) at `/hub/login_list`.
|
||||||
|
Loading…
Reference in New Issue
Block a user