Skip to content

Allow SSH authentication via GSS. #950

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 1, 2021
Merged

Conversation

Carreau
Copy link
Contributor

@Carreau Carreau commented Apr 14, 2021

This attempt to implement GSS as requested in #946.

I've tried to also document the other environment variable, though I
couldn't find where or how they are supposed to be used.

I'm also currently trying to find a deployment that could use GSS to
test this, but haven't so far.

I'm assuming that if GSS is enabled then it takes priority over
username/password.

@Carreau Carreau mentioned this pull request Apr 14, 2021
2 tasks
@lresende
Copy link
Member

Thanks for looking into this @Carreau. I am sort of coming back from vacation and will take a look at this... and sorry for the delay...

@Carreau
Copy link
Contributor Author

Carreau commented Apr 19, 2021

Thanks for looking into this @Carreau. I am sort of coming back from vacation and will take a look at this... and sorry for the delay...

No problem, take your time.

@mlucool
Copy link

mlucool commented Apr 21, 2021

This works great for the initial connection!

When I restart a kernel, I see the following error:

[E 2021-04-21 10:26:09.242 EnterpriseGatewayApp] Failed to authenticate SSHClient with password-less SSH
[E 2021-04-21 10:26:09.242 EnterpriseGatewayApp] Failure occurred starting kernel on '<REDACTED>'.  Returned result: HTTP 403: Failed to authenticate SSHClient with password-less SSH
[E 2021-04-21 10:26:09.242 EnterpriseGatewayApp] Exception restarting kernel
    Traceback (most recent call last):
      File "/path/to//lib64/python3.7/site-packages/enterprise_gateway/services/processproxies/processproxy.py", line 605, in _get_ssh_client
        if use_gss:
    UnboundLocalError: local variable 'use_gss' referenced before assignment
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/path/to//lib64/python3.7/site-packages/enterprise_gateway/services/processproxies/distributed.py", line 44, in launch_process
        result_pid = self._launch_remote_process(kernel_cmd, **kwargs)
      File "/path/to//lib64/python3.7/site-packages/enterprise_gateway/services/processproxies/distributed.py", line 73, in _launch_remote_process
        result = self.rsh(self.ip, cmd)
      File "/path/to//lib64/python3.7/site-packages/enterprise_gateway/services/processproxies/processproxy.py", line 649, in rsh
        ssh = self._get_ssh_client(host)
      File "/path/to//lib64/python3.7/site-packages/enterprise_gateway/services/processproxies/processproxy.py", line 630, in _get_ssh_client
        self.log_and_raise(http_status_code=http_status_code, reason=error_message)
      File "/path/to//lib64/python3.7/site-packages/enterprise_gateway/services/processproxies/processproxy.py", line 1388, in log_and_raise
        super().log_and_raise(http_status_code, reason)
      File "/path/to//lib64/python3.7/site-packages/enterprise_gateway/services/processproxies/processproxy.py", line 915, in log_and_raise
        raise web.HTTPError(status_code=http_status_code, reason=reason)
    tornado.web.HTTPError: HTTP 403: Failed to authenticate SSHClient with password-less SSH

This makes it impossible to change kernels in that same notebooks:

[E 210421 10:30:19 web:1793] Uncaught exception DELETE /api/kernels/d88c772d-c475-41b8-a5a8-2db649f301af (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:9999', method='DELETE', uri='/api/kernels/d88c772d-c475-41b8-a5a8-2db649f301af', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "/path/to/lib64/python3.7/site-packages/tornado/web.py", line 1704, in _execute
        result = await result
      File "/path/to/lib64/python3.7/site-packages/jupyter_server/services/kernels/handlers.py", line 66, in delete
        await ensure_async(km.shutdown_kernel(kernel_id))
      File "/path/to/lib64/python3.7/site-packages/jupyter_server/utils.py", line 176, in ensure_async
        result = await obj
      File "/path/to/lib64/python3.7/site-packages/jupyter_server/services/kernels/kernelmanager.py", line 527, in shutdown_kernel
        ret = await self.pinned_superclass.shutdown_kernel(self, kernel_id, now=now, restart=restart)
      File "/usr/local/python/python-3.7/std/lib64/python3.7/site-packages/jupyter_client/multikernelmanager.py", line 508, in shutdown_kernel
        await km.shutdown_kernel(now, restart)
      File "/usr/local/python/python-3.7/std/lib64/python3.7/site-packages/jupyter_client/manager.py", line 718, in shutdown_kernel
        await self.interrupt_kernel()
      File "/usr/local/python/python-3.7/std/lib64/python3.7/site-packages/jupyter_client/manager.py", line 867, in interrupt_kernel
        raise RuntimeError("Cannot interrupt kernel. No kernel is running!")
    RuntimeError: Cannot interrupt kernel. No kernel is running!
[E 210421 10:30:19 web:2243] 500 DELETE /api/kernels/d88c772d-c475-41b8-a5a8-2db649f301af (127.0.0.1) 7.52ms

Even worse, this makes the gateway unusable after for future remote kernels (i.e. make a new notebook):

[E 2021-04-21 10:30:51.075 EnterpriseGatewayApp] Failed to authenticate SSHClient with password-less SSH
[E 2021-04-21 10:30:51.076 EnterpriseGatewayApp] Failure occurred starting kernel on '<REDACTED>'.  Returned result: HTTP 403: Failed to authenticate SSHClient with password-less SSH

@Carreau
Copy link
Contributor Author

Carreau commented Apr 21, 2021

Oops, pushed a commit that should fix the unbound local; hopefully it fix the rest, I'll read in more details.

@mlucool
Copy link

mlucool commented Apr 21, 2021

Now those errors do not appear, but restart never completes. I can change kernels and go back to the kernel again, which does cause it to start.

Messages in the server output:

[D 2021-04-21 14:12:07.690 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (busy)
[D 2021-04-21 14:12:07.692 EnterpriseGatewayApp] Signal (2) sent via gateway communication port.
[D 2021-04-21 14:12:07.694 EnterpriseGatewayApp] Signal (15) sent via gateway communication port.
[D 2021-04-21 14:12:07.695 EnterpriseGatewayApp] Shutdown request sent to listener via gateway communication port.
[D 2021-04-21 14:12:07.696 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (idle)
[D 2021-04-21 14:12:07.699 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (busy)
[D 2021-04-21 14:12:07.705 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (idle)
[D 2021-04-21 14:12:07.711 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (busy)
[D 2021-04-21 14:12:07.712 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (idle)
[D 2021-04-21 14:12:07.719 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (busy)
[D 2021-04-21 14:12:07.725 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (idle)
[D 2021-04-21 14:12:07.726 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (busy)
[D 2021-04-21 14:12:07.727 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: shutdown_reply
[D 2021-04-21 14:12:07.832 EnterpriseGatewayApp] Instantiating kernel 'EG Dist Python 3' with process proxy: enterprise_gateway.services.processproxies.distributed.DistributedProcessProxy
[D 2021-04-21 14:12:07.834 EnterpriseGatewayApp] Starting kernel (async): <REDACTED>
[D 2021-04-21 14:12:07.834 EnterpriseGatewayApp] Launching kernel: 'EG Dist Python 3' with command: <REDACTED>
[D 2021-04-21 14:12:07.834 EnterpriseGatewayApp] BaseProcessProxy.launch_process() env: {<REDACTED> 'KERNEL_GATEWAY': '1', 'EG_MIN_PORT_RANGE_SIZE': '1000', 'EG_MAX_PORT_RANGE_RETRIES': '5', 'KERNEL_ID': 'c0508a8e-ea61-4cb1-8f09-eacb693b40e0', 'KERNEL_LANGUAGE': 'python', 'EG_IMPERSONATION_ENABLED': 'False'}
[D 2021-04-21 14:12:07.837 EnterpriseGatewayApp] Invoking cmd: 'export KERNEL_ID="c0508a8e-ea61-4cb1-8f09-eacb693b40e0";export KERNEL_USERNAME="<REDACTED>";export EG_IMPERSONATION_ENABLED="False";nohup <REDACTED>
[I 2021-04-21 14:12:08.096 EnterpriseGatewayApp] Kernel launched on <REDACTED>
[D 2021-04-21 14:12:08.377 EnterpriseGatewayApp] Received payload 'KIPWWHbtMYqMOVI5YkixIL5QF7J5gg9IpbtiL6yLQblVv56BUtcshMilU+TA5u3ERxXTIbjqx6th/wwuwCKfHOPA3zhb7X4dTPplnLx2mrJdgNzx3cjFybqEbiH/YKvYaWtUS+/BOZGi8W1dP+82SkAB/bRAoN3Q5cBoZXYjpNJGiWEgat2OVm21RXxizce00qJCKCNM3i1j62pGxlZxMaJoD9Y6GMgCWGm3Q6GdZgFt6Ca2ZU3Eh7M0QKryfFAwK5MYiB8FSEfPfKZBHICXCOo82aVAzBeLxdn0YZ0rl1RZzUiHLL14+QiBhC2/AL9TCTUPTTpuXMY1ibLq4t+cQB/xroUPYleiRrw2U8hi0M2iXP623iwsvQHJBsaBkA1WnB2wB5oxukABlhJUOoLmGA=='
[D 2021-04-21 14:12:08.377 EnterpriseGatewayApp] decode_payload exception - UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 1: invalid start byte
[W 2021-04-21 14:12:08.377 EnterpriseGatewayApp] WARNING!!!! Legacy kernel response received for kernel_id 'c0508a8e-ea61-4cb1-8f09-eacb693b40e0'! Update kernel launchers to current version!
[D 2021-04-21 14:12:08.377 EnterpriseGatewayApp] Decrypted payload '{'shell_port': 35625, 'iopub_port': 36396, 'stdin_port': 45834, 'control_port': 55238, 'hb_port': 39431, 'ip': '0.0.0.0', 'key': 'a74fa34e-4c59-4f93-9a19-9acb8988f203', 'transport': 'tcp', 'signature_scheme': 'hmac-sha256', 'kernel_name': '', 'pid': '106779', 'pgid': '106737', 'comm_port': 58641, 'kernel_id': 'c0508a8e-ea61-4cb1-8f09-eacb693b40e0'}'
[D 2021-04-21 14:12:08.377 EnterpriseGatewayApp] Connection info received for kernel 'c0508a8e-ea61-4cb1-8f09-eacb693b40e0': {'shell_port': 35625, 'iopub_port': 36396, 'stdin_port': 45834, 'control_port': 55238, 'hb_port': 39431, 'ip': '0.0.0.0', 'key': 'a74fa34e-4c59-4f93-9a19-9acb8988f203', 'transport': 'tcp', 'signature_scheme': 'hmac-sha256', 'kernel_name': '', 'pid': '106779', 'pgid': '106737', 'comm_port': 58641, 'kernel_id': 'c0508a8e-ea61-4cb1-8f09-eacb693b40e0'}
[D 2021-04-21 14:12:08.605 EnterpriseGatewayApp] 1: Waiting to connect.  Host: '[D 2021-04-21 14:12:07.690 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (busy)
[D 2021-04-21 14:12:07.692 EnterpriseGatewayApp] Signal (2) sent via gateway communication port.
[D 2021-04-21 14:12:07.694 EnterpriseGatewayApp] Signal (15) sent via gateway communication port.
[D 2021-04-21 14:12:07.695 EnterpriseGatewayApp] Shutdown request sent to listener via gateway communication port.
[D 2021-04-21 14:12:07.696 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (idle)
[D 2021-04-21 14:12:07.699 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (busy)
[D 2021-04-21 14:12:07.705 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (idle)
[D 2021-04-21 14:12:07.711 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (busy)
[D 2021-04-21 14:12:07.712 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (idle)
[D 2021-04-21 14:12:07.719 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (busy)
[D 2021-04-21 14:12:07.725 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (idle)
[D 2021-04-21 14:12:07.726 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (busy)
[D 2021-04-21 14:12:07.727 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: shutdown_reply
[D 2021-04-21 14:12:07.832 EnterpriseGatewayApp] Instantiating kernel 'EG Dist Python 3' with process proxy: enterprise_gateway.services.processproxies.distributed.DistributedProcessProxy
[D 2021-04-21 14:12:07.834 EnterpriseGatewayApp] Starting kernel (async): <REDACTED>
[D 2021-04-21 14:12:07.834 EnterpriseGatewayApp] Launching kernel: 'EG Dist Python 3' with command: <REDACTED>
[D 2021-04-21 14:12:07.834 EnterpriseGatewayApp] BaseProcessProxy.launch_process() env: {<REDACTED> 'KERNEL_GATEWAY': '1', 'EG_MIN_PORT_RANGE_SIZE': '1000', 'EG_MAX_PORT_RANGE_RETRIES': '5', 'KERNEL_ID': 'c0508a8e-ea61-4cb1-8f09-eacb693b40e0', 'KERNEL_LANGUAGE': 'python', 'EG_IMPERSONATION_ENABLED': 'False'}
[D 2021-04-21 14:12:07.837 EnterpriseGatewayApp] Invoking cmd: 'export KERNEL_ID="c0508a8e-ea61-4cb1-8f09-eacb693b40e0";export KERNEL_USERNAME="<REDACTED>";export EG_IMPERSONATION_ENABLED="False";nohup <REDACTED>
[I 2021-04-21 14:12:08.096 EnterpriseGatewayApp] Kernel launched on <REDACTED>
[D 2021-04-21 14:12:08.377 EnterpriseGatewayApp] Received payload 'KIPWWHbtMYqMOVI5YkixIL5QF7J5gg9IpbtiL6yLQblVv56BUtcshMilU+TA5u3ERxXTIbjqx6th/wwuwCKfHOPA3zhb7X4dTPplnLx2mrJdgNzx3cjFybqEbiH/YKvYaWtUS+/BOZGi8W1dP+82SkAB/bRAoN3Q5cBoZXYjpNJGiWEgat2OVm21RXxizce00qJCKCNM3i1j62pGxlZxMaJoD9Y6GMgCWGm3Q6GdZgFt6Ca2ZU3Eh7M0QKryfFAwK5MYiB8FSEfPfKZBHICXCOo82aVAzBeLxdn0YZ0rl1RZzUiHLL14+QiBhC2/AL9TCTUPTTpuXMY1ibLq4t+cQB/xroUPYleiRrw2U8hi0M2iXP623iwsvQHJBsaBkA1WnB2wB5oxukABlhJUOoLmGA=='
[D 2021-04-21 14:12:08.377 EnterpriseGatewayApp] decode_payload exception - UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 1: invalid start byte
[W 2021-04-21 14:12:08.377 EnterpriseGatewayApp] WARNING!!!! Legacy kernel response received for kernel_id 'c0508a8e-ea61-4cb1-8f09-eacb693b40e0'! Update kernel launchers to current version!
[D 2021-04-21 14:12:08.377 EnterpriseGatewayApp] Decrypted payload '{'shell_port': 35625, 'iopub_port': 36396, 'stdin_port': 45834, 'control_port': 55238, 'hb_port': 39431, 'ip': '0.0.0.0', 'key': 'a74fa34e-4c59-4f93-9a19-9acb8988f203', 'transport': 'tcp', 'signature_scheme': 'hmac-sha256', 'kernel_name': '', 'pid': '106779', 'pgid': '106737', 'comm_port': 58641, 'kernel_id': 'c0508a8e-ea61-4cb1-8f09-eacb693b40e0'}'
[D 2021-04-21 14:12:08.377 EnterpriseGatewayApp] Connection info received for kernel 'c0508a8e-ea61-4cb1-8f09-eacb693b40e0': {'shell_port': 35625, 'iopub_port': 36396, 'stdin_port': 45834, 'control_port': 55238, 'hb_port': 39431, 'ip': '0.0.0.0', 'key': 'a74fa34e-4c59-4f93-9a19-9acb8988f203', 'transport': 'tcp', 'signature_scheme': 'hmac-sha256', 'kernel_name': '', 'pid': '106779', 'pgid': '106737', 'comm_port': 58641, 'kernel_id': 'c0508a8e-ea61-4cb1-8f09-eacb693b40e0'}
[D 2021-04-21 14:12:08.605 EnterpriseGatewayApp] 1: Waiting to connect.  Host: '<REDACTED>', KernelID: 'c0508a8e-ea61-4cb1-8f09-eacb693b40e0'
[D 2021-04-21 14:12:08.616 EnterpriseGatewayApp] Host assigned to the kernel is: '<REDACTED>' '<REDACTED>'
[D 2021-04-21 14:12:08.616 EnterpriseGatewayApp] Established gateway communication to: <REDACTED>:58641 for KernelID 'c0508a8e-ea61-4cb1-8f09-eacb693b40e0'
[D 2021-04-21 14:12:08.616 EnterpriseGatewayApp] Received connection info for KernelID 'c0508a8e-ea61-4cb1-8f09-eacb693b40e0' from host <REDACTED>: {'shell_port': 35625, 'iopub_port': 36396, 'stdin_port': 45834, 'control_port': 55238, 'hb_port': 39431, 'ip': '<REDACTED>', 'key': 'a74fa34e-4c59-4f93-9a19-9acb8988f203', 'transport': 'tcp', 'signature_scheme': 'hmac-sha256', 'kernel_name': '', 'comm_port': 58641, 'kernel_id': 'c0508a8e-ea61-4cb1-8f09-eacb693b40e0'}...
[D 2021-04-21 14:12:08.616 EnterpriseGatewayApp] Connecting to: tcp://<REDACTED>:55238
[D 2021-04-21 14:12:08.617 EnterpriseGatewayApp] Connecting to: tcp://<REDACTED>:36396
[D 2021-04-21 14:12:08.618 EnterpriseGatewayApp] Refreshing kernel session for id: c0508a8e-ea61-4cb1-8f09-eacb693b40e0
[I 2021-04-21 14:12:08.618 EnterpriseGatewayApp] Kernel restarted: c0508a8e-ea61-4cb1-8f09-eacb693b40e0
[D 2021-04-21 14:12:08.618 EnterpriseGatewayApp] Connecting to: tcp://<REDACTED>:35625
[D 2021-04-21 14:12:08.619 EnterpriseGatewayApp] Connecting to: tcp://<REDACTED>:36396
[I 210421 14:12:08 web:2243] 200 POST /api/kernels/c0508a8e-ea61-4cb1-8f09-eacb693b40e0/restart (127.0.0.1) 935.99ms
[I 210421 14:12:08 web:2243] 200 GET /api/kernels/c0508a8e-ea61-4cb1-8f09-eacb693b40e0 (127.0.0.1) 5.86ms
[D 2021-04-21 14:12:08.836 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: comm_open
[D 2021-04-21 14:12:08.836 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: comm_msg
[D 2021-04-21 14:12:08.841 EnterpriseGatewayApp] Kernel info reply received: c0508a8e-ea61-4cb1-8f09-eacb693b40e0
[D 2021-04-21 14:12:08.842 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (starting)
[D 2021-04-21 14:12:08.848 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (busy)
[D 2021-04-21 14:12:08.848 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (idle)
', KernelID: 'c0508a8e-ea61-4cb1-8f09-eacb693b40e0'
[D 2021-04-21 14:12:08.616 EnterpriseGatewayApp] Host assigned to the kernel is: '<REDACTED>' '<REDACTED>'
[D 2021-04-21 14:12:08.616 EnterpriseGatewayApp] Established gateway communication to: <REDACTED>:58641 for KernelID 'c0508a8e-ea61-4cb1-8f09-eacb693b40e0'
[D 2021-04-21 14:12:08.616 EnterpriseGatewayApp] Received connection info for KernelID 'c0508a8e-ea61-4cb1-8f09-eacb693b40e0' from host <REDACTED>: {'shell_port': 35625, 'iopub_port': 36396, 'stdin_port': 45834, 'control_port': 55238, 'hb_port': 39431, 'ip': '<REDACTED>', 'key': 'a74fa34e-4c59-4f93-9a19-9acb8988f203', 'transport': 'tcp', 'signature_scheme': 'hmac-sha256', 'kernel_name': '', 'comm_port': 58641, 'kernel_id': 'c0508a8e-ea61-4cb1-8f09-eacb693b40e0'}...
[D 2021-04-21 14:12:08.616 EnterpriseGatewayApp] Connecting to: tcp://<REDACTED>:55238
[D 2021-04-21 14:12:08.617 EnterpriseGatewayApp] Connecting to: tcp://<REDACTED>:36396
[D 2021-04-21 14:12:08.618 EnterpriseGatewayApp] Refreshing kernel session for id: c0508a8e-ea61-4cb1-8f09-eacb693b40e0
[I 2021-04-21 14:12:08.618 EnterpriseGatewayApp] Kernel restarted: c0508a8e-ea61-4cb1-8f09-eacb693b40e0
[D 2021-04-21 14:12:08.618 EnterpriseGatewayApp] Connecting to: tcp://<REDACTED>:35625
[D 2021-04-21 14:12:08.619 EnterpriseGatewayApp] Connecting to: tcp://<REDACTED>:36396
[I 210421 14:12:08 web:2243] 200 POST /api/kernels/c0508a8e-ea61-4cb1-8f09-eacb693b40e0/restart (127.0.0.1) 935.99ms
[I 210421 14:12:08 web:2243] 200 GET /api/kernels/c0508a8e-ea61-4cb1-8f09-eacb693b40e0 (127.0.0.1) 5.86ms
[D 2021-04-21 14:12:08.836 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: comm_open
[D 2021-04-21 14:12:08.836 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: comm_msg
[D 2021-04-21 14:12:08.841 EnterpriseGatewayApp] Kernel info reply received: c0508a8e-ea61-4cb1-8f09-eacb693b40e0
[D 2021-04-21 14:12:08.842 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (starting)
[D 2021-04-21 14:12:08.848 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (busy)
[D 2021-04-21 14:12:08.848 EnterpriseGatewayApp] activity on c0508a8e-ea61-4cb1-8f09-eacb693b40e0: status (idle)

@Carreau
Copy link
Contributor Author

Carreau commented Apr 21, 2021

I'm not too sure why using gss would affect the rest of the functionality.
I'll try to test more thoroughly without gss enable to understand; if not I'll try to setup some VMs with kerberos to test this.

I've pushed additional changes that remove use of the globals and made them instance variables, plus added a number of debug statements, which I hope will help.

@mlucool
Copy link

mlucool commented Apr 21, 2021

This looks good to me now. I upgraded all things jupyter and now restart just works. I suspect the bug was unrelated to gss and more related to

Legacy kernel response received for kernel_id

) # this should use password-less ssh
self.remote_user = os.getenv("EG_REMOTE_USER", getpass.getuser())

if use_gss and (self.remote_pwd or self.remote_user):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you are defaulting remote_user to getpass.getuser() then when use_gss is True it seems this will always print the warning even if neither EG_REMOTE_PWD or EG_REMOTE_USER have been set.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've move the logic for the warning to __init__ that might not be exactly the same but I doubt there are use case where use change the value of env variable after the object have been constructed.

That should take care of the problem.

@Carreau
Copy link
Contributor Author

Carreau commented May 3, 2021

Gentle nudge; I believe I have addressed all the review points, if not I'm happy to iterate more.

Copy link
Collaborator

@akchinSTC akchinSTC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Carreau - I'm good with these changes. Can we also update some of the relevant documentation sections? At a quick glance

@Carreau
Copy link
Contributor Author

Carreau commented May 5, 2021

Added on commit with docs and be stricter on bool env variable.

In SSH tunneling section add information about GSS and Kerberos.
I realised that this is bool env, and that we likely want to be stricter
on which values are allowed, we don't want "0" to mean enable.

Thus only allow "True", "False", empty string and unset (case
insensitive) as possible values.

Store the raw variable and its boolean interpretation separately for
error messages.

Also one typo Addtional -> Additional, that does change the html anchor, but I haven't found any reference to it.

Carreau and others added 9 commits May 31, 2021 11:33
This attempt to implement GSS as requested in jupyter-server#946.

I've tried to also document the other environment variable, though I
couldn't find where or how they are supposed to be used.

I'm also currently trying to find a deployment that could use GSS to
test this, but haven't so far.

I'm assuming that if GSS is enabled then it takes priority over
username/password.
The globals used to be loaded at module level, which i not the case
anymore; move them to instance values.
In SSH tunneling section add information about GSS and Kerberos.
I realised that this is bool env, and that we likely want to be stricter
on which values are allowed, we don't want "0" to mean enable.

Thus only allow "True",  "False", empty string and unset (case
insensitive) as possible values.

Store the raw variable and its boolean interpretation separately for
error messages.
@Carreau
Copy link
Contributor Author

Carreau commented May 31, 2021

Rebased on master – Is there anything else I can do to push this forward ?

@kevin-bates
Copy link
Member

I believe this is good to go (thank you @Carreau) but I'd like to finalize with Alan first. @akchinSTC - is there anything remaining here? If not, please go ahead and merge. Thanks.

@akchinSTC akchinSTC merged commit a29e9c6 into jupyter-server:master Jun 1, 2021
@Carreau
Copy link
Contributor Author

Carreau commented Jun 4, 2021

Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants