@minrk ... thanks for putting this tool together.
I'm trying to use it in the following context, but having difficulties in getting it working properly.
I have my own app which authenticates against firebase using JWT tokens. It includes functionality requiring connecting to jupyterlab, and I wanted to avoid a user having to login twice to two separate systems and so the nullauthenticator fits my needs well, in that sense.
In my case, jupyterhub is using a similar set-up to the zero-to-jupyterhub-k8s and runs on Google's GKE infrastructure. I have been able to setup nbviewer and nbdime as external services to the hub in this context, but setting up nullauthenticator the same way is not working and I can't figure out why. This is my set-up as an external service in the jupyterhub_config.py
:
c.JupyterHub.services = [{
'name': 'login',
'admin': True,
'url': 'http://' + os.environ['LOGIN_SERVICE_HOST'] + ':' + os.environ['LOGIN_SERVICE_PORT'],
'api_token': os.environ['LOGIN_JHUB_TOKEN']
}]
I have also tried setting things up as an internal service, but that is somehow also failing.
c.JupyterHub.services = [{
'name': 'login',
'admin': True,
'command': [sys.executable, '/srv/login-service.py'],
'url': 'http://127.0.0.1:4202',
}]
In an effort to get the internal service working, I have hard-coded the env variable lookup in the login-services.py
directly, since it's easier this way than trying to pass them to the kubernetes environment, for now at least.
env = {'JUPYTERHUB_API_URL':'http://127.0.0.1:8081/hub/api', 'JUPYTERHUB_BASE_URL': 'http://myhubserver.com/hub/', 'JUPYTERHUB_SERVICE_URL': 'http://127.0.0.1:4202', 'JUPYTERHUB_API_TOKEN': 'some-fixed-token'}
I continue to get a combination of 403
and 302
errors.
[I 2018-02-18 19:54:02.463 JupyterHub app:1528] Hub API listening on http://0.0.0.0:8081/hub/
[I 2018-02-18 19:54:02.467 JupyterHub app:1538] Not starting proxy
[I 2018-02-18 19:54:02.467 JupyterHub app:1544] Starting managed service login at http://127.0.0.1:4202
[I 2018-02-18 19:54:02.468 JupyterHub service:266] Starting service 'login': ['/usr/bin/python3', '/srv/login-service.py']
[I 2018-02-18 19:54:02.475 JupyterHub service:109] Spawning /usr/bin/python3 /srv/login-service.py
[I 2018-02-18 19:54:02.911 JupyterHub app:1551] Adding external service nbdime at http://10.7.243.191:9000
[I 2018-02-18 19:54:03.049 JupyterHub app:1551] Adding external service nbviewer at http://10.7.247.171:8080
[I 2018-02-18 19:54:03.071 JupyterHub app:1581] JupyterHub is now running at http://10.7.xxx.xxx:80/
[W 2018-02-18 20:05:04.928 JupyterHub base:351] Failed login for unknown user
[W 2018-02-18 20:05:04.955 JupyterHub log:122] 403 GET /hub/login?next=%2Fhub%2Fuser%2Fmccoole%2F%3Ftoken%3Dsome-fixed-token (@10.4.0.1) 28.62ms
[I 2018-02-18 20:05:36.646 JupyterHub log:122] 302 GET / \u2192 /hub (@10.132.0.6) 0.70ms
[I 2018-02-18 20:05:36.959 JupyterHub log:122] 302 GET /hub \u2192 /hub/login (@10.132.0.6) 0.70ms
[W 2018-02-18 20:05:37.272 JupyterHub base:351] Failed login for unknown user
[W 2018-02-18 20:05:37.273 JupyterHub log:122] 403 GET /hub/login (@10.132.0.6) 1.84ms
[W 2018-02-18 20:05:37.898 JupyterHub log:122] 405 POST /q.php (@10.132.0.6) 1.46ms
[W 2018-02-18 20:05:38.521 JupyterHub log:122] 405 POST /s.php (@10.132.0.6) 1.43ms
[W 2018-02-18 20:05:39.144 JupyterHub log:122] 405 POST /wuwu11.php (@10.132.0.6) 1.43ms
[W 2018-02-18 20:05:39.766 JupyterHub log:122] 405 POST /slider.php (@10.132.0.6) 1.50ms
[W 2018-02-18 20:05:40.389 JupyterHub log:122] 405 POST /sheep.php (@10.132.0.6) 1.61ms
[W 2018-02-18 20:05:41.013 JupyterHub log:122] 405 POST /q.php (@10.132.0.6) 1.75ms
[W 2018-02-18 20:05:41.637 JupyterHub log:122] 405 POST /xx.php (@10.132.0.6) 1.51ms
[I 2018-02-18 20:07:00.796 JupyterHub log:122] 302 GET /hub/user/mccoole/?token=mccoole-token \u2192 /hub/login?next=%2Fhub%2Fuser%2Fmccoole%2F%3Ftoken%3Dsome-fixed-token (@10.4.0.1) 1.21ms
[W 2018-02-18 20:07:00.833 JupyterHub base:351] Failed login for unknown user
[W 2018-02-18 20:07:00.835 JupyterHub log:122] 403 GET /hub/login?next=%2Fhub%2Fuser%2Fmccoole%2F%3Ftoken%3Dsome-fixed-token (@10.4.0.1) 1.93ms
Looking at those logs above, none of them show the base url .. just the part /hub/login....
... could it be that this base url part is not getting captured?
Does this solution somehow require that the port 4202
is exposed externally to the internet, or is it enough that it is just exposed internally within the kubernetes infrastructure? Could that be the reason it is failing ... even to redirect me to the login.html
page?