This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
docpublic:systemes:systemes:jupyter:jupyterhub [2021/07/10 19:51] adminjp [ipywidgets] |
docpublic:systemes:systemes:jupyter:jupyterhub [2021/07/12 20:58] (current) adminjp [REMOTE_USER auth] |
||
---|---|---|---|
Line 124: | Line 124: | ||
Further configuration options may be found in the documentation. | Further configuration options may be found in the documentation. | ||
+ | ==== systemd startup ==== | ||
+ | |||
+ | Create a systemd " | ||
+ | |||
+ | < | ||
+ | [root@jhub jupyterhub]# | ||
+ | </ | ||
+ | |||
+ | edit the Unit file / | ||
+ | |||
+ | < | ||
+ | [root@jhub jupyterhub]# | ||
+ | [Unit] | ||
+ | |||
+ | Description=JupyterHub | ||
+ | After=syslog.target network.target | ||
+ | |||
+ | [Service] | ||
+ | |||
+ | User=root | ||
+ | Environment=" | ||
+ | ExecStart=/ | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=multi-user.target | ||
+ | </ | ||
+ | |||
+ | Now link that file to the directory with the system' | ||
+ | |||
+ | < | ||
+ | [root@jhub systemd]# | ||
+ | [root@jhub systemd]# | ||
+ | lrwxrwxrwx 1 root root 67 10 juil. 22:07 / | ||
+ | </ | ||
+ | |||
+ | Then tell systemd to reload its configuration files so that it knows about that new jupyterhub.service | ||
+ | |||
+ | < | ||
+ | [root@jpthub systemd]# | ||
+ | </ | ||
+ | |||
+ | start it and enable it at boot | ||
+ | |||
+ | < | ||
+ | [root@jhub systemd]# | ||
+ | [root@jhub systemd]# | ||
+ | ● jupyterhub.service - JupyterHub | ||
+ | | ||
+ | | ||
+ | |||
+ | [root@jhub systemd]# | ||
+ | Created symlink / | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | ==== firewall ==== | ||
+ | |||
+ | open jupyterhub webservice to our local ip network | ||
+ | |||
+ | < | ||
+ | [root@jhub systemd]# | ||
+ | success | ||
+ | [root@jhub systemd]# | ||
+ | success | ||
+ | </ | ||
+ | |||
+ | ==== jupyterhub webservice ==== | ||
+ | |||
+ | now the jupyterhub webservice is available at http:// | ||
+ | |||
+ | ===== https and reverse proxy with apache ===== | ||
+ | |||
+ | * https:// | ||
+ | |||
+ | change the // c.JupyterHub.bind_url// | ||
+ | |||
+ | < | ||
+ | [root@jhub jupyterhub]# | ||
+ | # | ||
+ | c.JupyterHub.bind_url = ' | ||
+ | </ | ||
+ | |||
+ | ==== apache ==== | ||
+ | |||
+ | install httpd and mod_ssl package | ||
+ | |||
+ | < | ||
+ | [root@jhub certs]# yum install httpd mod_ssl | ||
+ | </ | ||
+ | |||
+ | jupyterhub vhost configuration | ||
+ | |||
+ | < | ||
+ | [root@jhub certs]# cat / | ||
+ | |||
+ | # redirect HTTP to HTTPS | ||
+ | Listen 80 | ||
+ | < | ||
+ | ServerName jhub.domain.fr | ||
+ | Redirect / https:// | ||
+ | </ | ||
+ | |||
+ | Listen 443 | ||
+ | < | ||
+ | |||
+ | ServerName jhub.domain.fr | ||
+ | |||
+ | # configure SSL | ||
+ | SSLEngine on | ||
+ | SSLCertificateFile / | ||
+ | SSLCertificateKeyFile / | ||
+ | SSLProtocol All -SSLv2 -SSLv3 | ||
+ | # SSLOpenSSLConfCmd DHParameters / | ||
+ | SSLCipherSuite EECDH+AESGCM: | ||
+ | |||
+ | # Use RewriteEngine to handle websocket connection upgrades | ||
+ | RewriteEngine On | ||
+ | RewriteCond %{HTTP: | ||
+ | RewriteCond %{HTTP: | ||
+ | RewriteRule /(.*) ws:// | ||
+ | |||
+ | < | ||
+ | # preserve Host header to avoid cross-origin problems | ||
+ | ProxyPreserveHost on | ||
+ | # proxy to JupyterHub | ||
+ | ProxyPass | ||
+ | ProxyPassReverse | ||
+ | </ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ==== firewall ==== | ||
+ | |||
+ | open https service in the firewall to our IP subnet | ||
+ | |||
+ | < | ||
+ | [root@jpthub certs]# firewall-cmd --permanent --add-rich-rule 'rule family=" | ||
+ | success | ||
+ | [root@jpthub certs]# firewall-cmd --reload | ||
+ | success | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== SAML authenticator ===== | ||
+ | |||
+ | * https:// | ||
+ | * https:// | ||
+ | |||
+ | |||
+ | < | ||
+ | [root@jhub jupyterhub]# | ||
+ | Collecting jupyterhub-samlauthenticator | ||
+ | Downloading jupyterhub_samlauthenticator-0.0.9-py3-none-any.whl (17 kB) | ||
+ | Requirement already satisfied: jupyterhub> | ||
+ | ... | ||
+ | Installing collected packages: pyopenssl, future, lxml, eight, signxml, jupyterhub-samlauthenticator | ||
+ | Attempting uninstall: pyopenssl | ||
+ | Found existing installation: | ||
+ | Uninstalling pyOpenSSL-20.0.1: | ||
+ | Successfully uninstalled pyOpenSSL-20.0.1 | ||
+ | Successfully installed eight-1.0.1 future-0.18.2 jupyterhub-samlauthenticator-0.0.9 lxml-4.6.3 pyopenssl-19.1.0 signxml-2.8.2 | ||
+ | </ | ||
+ | |||
+ | it installed those directories/ | ||
+ | |||
+ | < | ||
+ | [root@jhub jupyterhub]# | ||
+ | total 44 | ||
+ | -rw-r--r-- 1 root root 36101 12 juil. 16:33 samlauthenticator.py | ||
+ | -rw-r--r-- 1 root root 1144 12 juil. 16:33 __init__.py | ||
+ | drwxr-xr-x 2 root root 4096 12 juil. 16:33 __pycache__ | ||
+ | [root@jhub jupyterhub]# | ||
+ | total 40 | ||
+ | -rw-r--r-- 1 root root 1085 12 juil. 16:33 LICENSE.txt | ||
+ | -rw-r--r-- 1 root root 92 12 juil. 16:33 WHEEL | ||
+ | -rw-r--r-- 1 root root 18 12 juil. 16:33 top_level.txt | ||
+ | -rw-r--r-- 1 root root 17256 12 juil. 16:33 METADATA | ||
+ | -rw-r--r-- 1 root root 0 12 juil. 16:33 REQUESTED | ||
+ | -rw-r--r-- 1 root root 4 12 juil. 16:33 INSTALLER | ||
+ | -rw-r--r-- 1 root root 1026 12 juil. 16:33 RECORD | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== REMOTE_USER auth ===== | ||
+ | |||
+ | we'll try to authenticate through a shibboleth SP proxy to benefit from federated access , then redirect that REMOTE_USER to jupyterhub | ||
+ | |||
+ | * https:// | ||
+ | |||
+ | < | ||
+ | [root@jhub jupyterhub]# | ||
+ | Collecting jhub_remote_user_authenticator | ||
+ | Downloading jhub_remote_user_authenticator-0.1.0-py3-none-any.whl (3.6 kB) | ||
+ | ... | ||
+ | Installing collected packages: jhub-remote-user-authenticator | ||
+ | Successfully installed jhub-remote-user-authenticator-0.1.0 | ||
+ | |||
+ | </ |