yuvipanda / jupyterhub-ssh

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

asyncssh.public_key.KeyImportError: Passphrase must be specified to import encrypted private keys #32

Closed sunkararp closed 3 years ago

sunkararp commented 3 years ago

Tried to install using below command helm install jupyterhub-ssh/jupyterhub-ssh --version 0.0.1-n077.h0c9caba --set hubUrl=https://jupyter.example.org --set-file hostKey=<path to a private SSH key> --set sftp.enabled=false --generate-name

How do I specify the SSH key passphrase?

Error I am see in the pod deployment Traceback (most recent call last): │ │ File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main │ │ return _run_code(code, main_globals, None, │ │ File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code │ │ exec(code, run_globals) │ │ File "/srv/jupyterhub-ssh/jupyterhub_ssh/__main__.py", line 4, in <module> │ │ main() │ │ File "/srv/jupyterhub-ssh/jupyterhub_ssh/__init__.py", line 285, in main │ │ loop.run_until_complete(app.start_server()) │ │ File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete │ │ return future.result() │ │ File "/srv/jupyterhub-ssh/jupyterhub_ssh/__init__.py", line 270, in start_server │ │ await asyncssh.listen( │ │ File "/usr/local/lib/python3.8/site-packages/asyncssh/connection.py", line 6629, in listen │ │ options = SSHServerConnectionOptions(options, config=config, host=host, │ │ File "/usr/local/lib/python3.8/site-packages/asyncssh/connection.py", line 5384, in __init__ │ │ super().__init__(options=options, last_config=last_config, **kwargs) │ │ File "/usr/local/lib/python3.8/site-packages/asyncssh/misc.py", line 268, in __init__ │ │ self.prepare(**self.kwargs) │ │ File "/usr/local/lib/python3.8/site-packages/asyncssh/connection.py", line 6301, in prepare │ │ server_keys = load_keypairs(server_host_keys, passphrase, │ │ File "/usr/local/lib/python3.8/site-packages/asyncssh/public_key.py", line 3159, in load_keypairs │ │ key, certs = read_private_key_and_certs(key, passphrase) │ │ File "/usr/local/lib/python3.8/site-packages/asyncssh/public_key.py", line 2977, in read_private_k │ │ key, cert = import_private_key_and_certs(read_file(filename), passphrase) │ │ File "/usr/local/lib/python3.8/site-packages/asyncssh/public_key.py", line 2867, in import_private │ │ key, end = _decode_private(data, passphrase) │ │ File "/usr/local/lib/python3.8/site-packages/asyncssh/public_key.py", line 2527, in _decode_privat │ │ key = _decode_pem_private(pem_name, headers, data, passphrase) │ │ File "/usr/local/lib/python3.8/site-packages/asyncssh/public_key.py", line 2445, in _decode_pem_pr │ │ raise KeyImportError('Passphrase must be specified to import ' │ │ asyncssh.public_key.KeyImportError: Passphrase must be specified to import encrypted private keys │ │ stream closed

yuvipanda commented 3 years ago

Does the key currently have a passphrase? I think hostkeys are generally not protected by passphrases. Can you try it without a passphrase?

sunkararp commented 3 years ago

I tried with not passphrase, it worked, Thanks.

But, now I'm not able to SSH, does the load balancer doesn't have 22 opened?

Below is 'kubectl get svc -n cohort-workbench -o wide' output

NAME             TYPE           CLUSTER-IP    EXTERNAL-IP     PORT(S)                      AGE     SELECTOR
hub              ClusterIP      10.0.47.134   <none>          8081/TCP                     5h55m   app=jupyterhub,component=hub,release=cohortworkbench
jupyterhub-ssh   ClusterIP      10.0.117.6    <none>          22/TCP                       55m     app.kubernetes.io/component=ssh,app.kubernetes.io/instance=jupyterhub-ssh-1614238632,app.kubernetes.io/name=jupyterhub-ssh
proxy-api        ClusterIP      10.0.64.129   <none>          8001/TCP                     5h55m   app=jupyterhub,component=proxy,release=cohortworkbench
proxy-public     LoadBalancer   10.0.216.6    52.137.71.192   443:30863/TCP,80:32743/TCP   5h55m   component=proxy,release=cohortworkbench
yuvipanda commented 3 years ago

ooh, yeah. ssh.service.type' is set toClusterIP, can you try setting it toLoadBalancer`?

consideRatio commented 3 years ago

Original issue solved, I'll close this issue!