Skip to content

LyleLaii/jupyterhub-ssh-proxy

Repository files navigation

JupyterHub SSH Proxy

An external solution allows the user ssh to the user's jupyter environment.

This project has not been fully tested.

Test Environment

  • k8s
  • jupyterhub deployed by helm

How to use

  1. Build a notebook image with sshd, see example/Dockerfile.example

  2. Change Helm values, use postStart to run sshd service, see example/jupyterhub-helm-values.yaml

  3. Create a NetworkPolicy to allow proxy access ssh port

  4. Create config.

host_key_path: ./etc/id_rsa # hostkey file path in container
jupyterhub:
  url: http://127.0.0.1:6868/hub/api # jupyterhub rest api address
  admin_token: test # jupyterhub admin token to get user pod info
  conn_user: username # user pod ssh username
  conn_passwd: password # user pod ssh password
  authorized_keys_path: '' # authorized_keys_path in user pod
  ssh_port: "2022" # user pod ssh port
  verify_tls: false
  1. You should manual create id_rsa file and mount it to the container, instead of execute 'RUN ssh-keygen -q -N "" -f ./etc/id_rsa' in Dockerfile.

Because every build will change this file.

  1. Create jupyterhub-ssh-proxy deployment

  2. Create jupyterhub-ssh-proxy service

The tcp port should be used, so the TCP forwarding service should be used. NodePort is the simpleest way.

  1. Create token in jupyterhub.

  2. Use Jupyterhub username and token to login. Or create a authorized_keys file in user pod.

  • User should manually create ~/.bashrc or change /etc/bash.bashrc when build image to allow load env via ssh
  • User should manually create ~/.bash_profile or change /etc/profile when build image to allow load env via ssh-command

Thanks for https://github.com/dutchcoders/sshproxy

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published