huashengdun / webssh

:seedling: Web based ssh client
https://webssh.huashengdun.org/
MIT License
4.57k stars 1.31k forks source link

Authentication Failure with OpenSSH 9: Bad authentication type #379

Closed benoit-scnd closed 8 months ago

benoit-scnd commented 8 months ago

When using OpenSSH 8, there is no authentication failure:

[I 240311 16:11:42 handler:161] Parsing private key 'id_rsa_passphrase'
[I 240311 16:11:42 handler:442] Connecting to 172.17.0.1:22
[I 240311 16:11:42 transport:1819] Connected (version 2.0, client OpenSSH_8.4p1)
[I 240311 16:11:42 handler:71] Trying publickey authentication
[I 240311 16:11:42 transport:1819] Authentication (publickey) successful!

When using OpenSSH 9, there is an authentication error during SSH connection with webssh. The error message indicates that authentication failed with the following traceback:

[I 240311 17:28:28 handler:161] Parsing private key 'id_rsa_passphrase'
[I 240311 17:28:28 handler:442] Connecting to 172.17.0.1:22
[I 240311 17:28:28 transport:1819] Connected (version 2.0, client OpenSSH_9.2p1)
[I 240311 17:28:28 handler:71] Trying publickey authentication
[I 240311 17:28:28 transport:1819] Authentication (publickey) failed.
[I 240311 17:28:28 handler:87] Trying password authentication
[E 240311 17:28:28 handler:505] Traceback (most recent call last):
      File "/code/webssh/handler.py", line 445, in ssh_connect
        ssh.connect(*args, timeout=6)
      File "/usr/local/lib/python3.7/site-packages/paramiko/client.py", line 446, in connect
        passphrase,
      File "/code/webssh/handler.py", line 101, in _auth
        raise saved_exception
      File "/code/webssh/handler.py", line 89, in _auth
        self._transport.auth_password(username, password)
      File "/usr/local/lib/python3.7/site-packages/paramiko/transport.py", line 1509, in auth_password
        return self.auth_handler.wait_for_response(my_event)
      File "/usr/local/lib/python3.7/site-packages/paramiko/auth_handler.py", line 250, in wait_for_response
        raise e
    paramiko.ssh_exception.BadAuthenticationType: Bad authentication type; allowed types: ['publickey']

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/code/webssh/handler.py", line 503, in post
        worker = yield future
      File "/usr/local/lib/python3.7/site-packages/tornado/gen.py", line 735, in run
        value = future.result()
      File "/usr/local/lib/python3.7/concurrent/futures/_base.py", line 428, in result
        return self.__get_result()
      File "/usr/local/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
        raise self._exception
      File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
        result = self.fn(*self.args, **self.kwargs)
      File "/code/webssh/handler.py", line 449, in ssh_connect
        raise ValueError('Bad authentication type.')
    ValueError: Bad authentication type.

Steps to Reproduce:

Use OpenSSH_9.2p1 on the target host.

Expected Behavior:

The SSH connection should be established successfully using OpenSSH_9.2p1.

Actual Behavior:

Authentication fails with the error described above.

benoit-scnd commented 8 months ago

This issue cannot append if you use the version 1.6.2.