yuvipanda / jupyterhub-ssh

SSH Access to JupyterHubs
BSD 3-Clause "New" or "Revised" License
93 stars 29 forks source link

Unable to establish a ssh connection #33

Closed dschartman closed 3 years ago

dschartman commented 3 years ago

Environment

Local k3s instance of JupyterHub deployed with ZTJH helm chart 0.11.1 deployed behind a LoadBalancer for local testing.

Config

I'm running the command:

helm upgrade \
            --install jhub-ssh jupyterhub-ssh/jupyterhub-ssh \
            --namespace jhub \
            --version 0.0.1-n077.h0c9caba \
            --set hubUrl=http://hub:8081 \
            --set-file hostKey=~/.ssh/id_rsa \
            --set sftp.enabled=false \
            --values ssh_config.yaml

ssh_config.yaml:

ssh:
  service:
    type: LoadBalancer
    port: 22

sftp:
  enabled: false

Issue

When I attempt to ssh into my local testing instance I get something like this:

ssh don.schartman@192.168.35.156
Password:
Starting your server...........done!
Connection to 192.168.35.156 closed by remote host.
Connection to 192.168.35.156 closed.

After inspecting the logs of the jupyterhub_ssh pod, I see this error message:

[asyncssh] Creating SSH listener on port 8022
[asyncssh] [conn=0] Accepted SSH connection on 10.42.0.38, port 8022
[asyncssh] [conn=0]   Client address: 10.42.0.1, port 35462
[asyncssh] [conn=0] Requesting key exchange
[asyncssh] [conn=0] Received key exchange request
[asyncssh] [conn=0] Beginning key exchange
[asyncssh] [conn=0] Completed key exchange
[asyncssh] [conn=0] Beginning auth for user don.schartman
[asyncssh] [conn=0] Trying keyboard-interactive auth
[asyncssh] [conn=0] Auth for user don.schartman succeeded
[asyncssh] [conn=0, chan=0] Set write buffer limits: low-water=16384, high-water=65536
[asyncssh] [conn=0, chan=0] New SSH session requested
[asyncssh] [conn=0, chan=0]   Terminal type: xterm-256color
[asyncssh] [conn=0, chan=0]   Terminal size: 88x47
[asyncssh] [conn=0, chan=0]   PTY created
[asyncssh] [conn=0, chan=0]   Env: LANG=en_US.UTF-8
[asyncssh] [conn=0, chan=0]   Interactive shell requested
[asyncssh] [conn=0, chan=0] Uncaught exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/asyncssh/connection.py", line 699, in _reap_task
    task.result()
  File "/srv/jupyterhub-ssh/jupyterhub_ssh/__init__.py", line 145, in _handle_client
    async with ClientSession() as client, Terminado(self.notebook_url, self.token, client) as terminado:
  File "/srv/jupyterhub-ssh/jupyterhub_ssh/terminado.py", line 24, in __aenter__
    data = await resp.json()
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 1097, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('http://hub:8081/user/don.schartman/api/terminals')
[asyncssh] [conn=0, chan=0] Closing channel due to connection close
[asyncssh] [conn=0, chan=0] Channel closed: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('http://hub:8081/user/don.schartman/api/terminals')

I was successfully able to use the python requests library and the same token to create a terminal at /api/terminals.

I'm pretty stuck at the moment and am not sure where to go from here. Any advice about what to do next would be greatly appreciated. Thanks in advance.

dschartman commented 3 years ago

This is related to misconfiguration of self signed certs. Closing this issue.

kaaquist commented 1 year ago

@dschartman I know this here is an old issue. I still hope you can help/remember? I get the same error, and I'm not totally sure what I did wrong. But I can see you are mentioning that it is due to self signed certs. Please help me understand :+1: .. Which certs? Thanks a million.