Skip to content

Instantly share code, notes, and snippets.

@bmmalone
Last active November 28, 2024 12:55
Show Gist options
  • Save bmmalone/b5a0f44412d693d332b3e319f369bb06 to your computer and use it in GitHub Desktop.
Save bmmalone/b5a0f44412d693d332b3e319f369bb06 to your computer and use it in GitHub Desktop.
def add_home_dir(*fn):
import os.path
return os.path.join(os.path.expanduser('~'), *fn)
c.ServerApp.ip = '*'
c.ServerApp.port = 9999
c.ServerApp.certfile = add_home_dir('certs', 'mycert.pem')
c.ServerApp.keyfile = add_home_dir('certs', 'mykey.key')
c.NotebookApp.open_browser = False
c.LabApp.open_browser = False
c.ServerApp.open_browser = False
c.PasswordIdentityProvider.hashed_password = u'sha1:5f2cf85d2872:e9b52b2240cbcde307b5907e5c3848f3f9fd8a92' # 31KT
#------------------------------------------------------------------------------
# Configurable configuration
#------------------------------------------------------------------------------
# templates
c.JupyterLabTemplates.template_dirs = [add_home_dir('jupyter-templates')]
c.JupyterLabTemplates.include_default = False
conda create --name "jupyterlab" pip wheel jupyter ipykernel
conda activate jupyterlab
conda install -c conda-forge jupyterlab
conda install -c conda-forge nodejs
conda install -c conda-forge jupyterlab_templates
#jupyter serverextension enable --py jupyterlab_templates
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bmmalone
Copy link
Author

The template should likely be placed at $HOME/jupyter-templates/templates.

@bmmalone
Copy link
Author

bmmalone commented Jul 28, 2021

The certificate and key are self-signed using the method described here. Namely, the following command is used:

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mykey.key -out mycert.pem

The config file expects these to be located in $HOME/certs.


Update:

The following command also specifies the certificate details from the command line and requires no user input:

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mykey.key -out mycert.pem -subj "/C=DE/ST= /L= /O= /OU= /CN= "

The password specified in the template to access the server is 31KT.

@bmmalone
Copy link
Author

The config file should be located in $HOME/.jupyter

@bmmalone
Copy link
Author

The following error message (and similar) is common when using Chrome to access the server:

SSL Error on 8 ('::1', 53988, 0, 0): [SSL: SSLV3_ALERT_CERTIFICATE_UNKNOWN] ssl/tls alert certificate unknown (_ssl.c:1000)

This appears to be specific to Chrome. If it does not appear when using some other browser, then it can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment