I am using https://github.com/mwiede/jsch library to establish ssh tunnel. The key is rsa and the handshake and host key verification is working fine. But the authentication is failing for rsa-sha2 algorithms.
INFO main 2023-10-12T16:13:18.766Z SshUtils$1#log ssh_ecdsa_verify: ecdsa-sha2-nistp256 signature true
INFO main 2023-10-12T16:13:18.790Z SshUtils$1#log Host '[f****.****-staging.com]:2222' is known and matches the ECDSA host key
INFO main 2023-10-12T16:13:18.791Z SshUtils$1#log SSH_MSG_NEWKEYS sent
INFO main 2023-10-12T16:13:18.791Z SshUtils$1#log SSH_MSG_NEWKEYS received
INFO main 2023-10-12T16:13:18.803Z SshUtils$1#log SSH_MSG_SERVICE_REQUEST sent
INFO main 2023-10-12T16:13:18.806Z SshUtils$1#log SSH_MSG_EXT_INFO received
INFO main 2023-10-12T16:13:18.807Z SshUtils$1#log server-sig-algs=<ssh-ed25519,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected]>
INFO main 2023-10-12T16:13:18.809Z SshUtils$1#log SSH_MSG_SERVICE_ACCEPT received
INFO main 2023-10-12T16:13:18.822Z SshUtils$1#log Authentications that can continue: publickey,keyboard-interactive,password
INFO main 2023-10-12T16:13:18.825Z SshUtils$1#log Next authentication method: publickey
INFO main 2023-10-12T16:13:18.856Z SshUtils$1#log PubkeyAcceptedAlgorithms = ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss
INFO main 2023-10-12T16:13:18.857Z SshUtils$1#log PubkeyAcceptedAlgorithms in server-sig-algs = [ssh-ed25519, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521, rsa-sha2-512, rsa-sha2-256, ssh-rsa, ssh-dss]
INFO main 2023-10-12T16:13:18.863Z SshUtils$1#log rsa-sha2-512 preauth success
INFO main 2023-10-12T16:13:19.501Z SshUtils$1#log rsa-sha2-512 auth failure
INFO main 2023-10-12T16:13:19.505Z SshUtils$1#log rsa-sha2-256 preauth success
INFO main 2023-10-12T16:13:19.677Z SshUtils$1#log rsa-sha2-256 auth failure
INFO main 2023-10-12T16:13:19.690Z SshUtils$1#log ssh-rsa preauth failure
INFO main 2023-10-12T16:13:19.690Z SshUtils$1#log Authentications that can continue: password
INFO main 2023-10-12T16:13:19.696Z SshUtils$1#log Next authentication method: password
INFO main 2023-10-12T16:13:19.746Z SshUtils$1#log Disconnecting from f****.****-staging.com port 2222
INFO main 2023-10-12T16:13:19.773Z SshTunnel#createSshTunnel Auth failed
WARNING main 2023-10-12T16:13:19.774Z SshTunnel#<init> Auth Failed
When we add ssh-rsa in pubkeyacceptedalgorithms, it works. But we don't want to do that as we don't want to use Sha1. I am unclear on why sha2 based auth is failing.
sha2 algorithm should work for authentication