Cannot use SSH key

Hello, I am running a setup with a WPA8630Pv2, I am on the latest snapshot build I compiled via the guide here, however this also seemed to be an issue on the last stable

While my key has been added, it refuses to accept it at all, while testing the key pair works on other devices. This also is on the latest stable version of OpenWRT

OpenSSH_for_Windows_8.9p1, LibreSSL 3.4.3
debug1: Reading configuration data C:\\Users\\Kastilo/.ssh/config
debug1: C:\\Users\\Kastilo/.ssh/config line 1: Applying options for Aurora
debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
debug2: resolve_canonicalize: hostname 192.168.1.2 is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> 'C:\\Users\\Kastilo/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> 'C:\\Users\\Kastilo/.ssh/known_hosts2'
debug3: ssh_connect_direct: entering
debug1: Connecting to 192.168.1.2 [192.168.1.2] port 21534.
debug1: Connection established.
debug1: identity file C:\\Users\\Kastilo/.ssh/Aurora/Aurora type 3
debug3: Failed to open file:C:/Users/Kastilo/.ssh/Aurora/Aurora-cert error:2
debug3: Failed to open file:C:/Users/Kastilo/.ssh/Aurora/Aurora-cert.pub error:2
debug3: failed to open file:C:/Users/Kastilo/.ssh/Aurora/Aurora-cert error:2
debug1: identity file C:\\Users\\Kastilo/.ssh/Aurora/Aurora-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.9
debug1: Remote protocol version 2.0, remote software version dropbear
debug1: compat_banner: no match: dropbear
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to 192.168.1.2:21534 as 'root'
debug3: put_host_port: [192.168.1.2]:21534
debug3: record_hostkey: found key type RSA in file C:\\Users\\Kastilo/.ssh/known_hosts:1
debug3: load_hostkeys_file: loaded 1 keys from [192.168.1.2]:21534
debug3: Failed to open file:C:/Users/Kastilo/.ssh/known_hosts2 error:2
debug1: load_hostkeys: fopen C:\\Users\\Kastilo/.ssh/known_hosts2: No such file or directory
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts error:2
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts2 error:2
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory
debug3: order_hostkeyalgs: prefer hostkeyalgs: rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,ext-info-c
debug2: host key algorithms: rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com,zlib
debug2: compression stoc: none,zlib@openssh.com,zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,kexguess2@matt.ucc.asn.au
debug2: host key algorithms: rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes256-ctr
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes256-ctr
debug2: MACs ctos: hmac-sha1,hmac-sha2-256
debug2: MACs stoc: hmac-sha1,hmac-sha2-256
debug2: compression ctos: none
debug2: compression stoc: none
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-rsa SHA256:RXTLu4T5rvPClWXxUTBMfaAdh1qd19/dDJH1BCCYzOk
debug3: put_host_port: [192.168.1.2]:21534
debug3: put_host_port: [192.168.1.2]:21534
debug3: record_hostkey: found key type RSA in file C:\\Users\\Kastilo/.ssh/known_hosts:1
debug3: load_hostkeys_file: loaded 1 keys from [192.168.1.2]:21534
debug3: Failed to open file:C:/Users/Kastilo/.ssh/known_hosts2 error:2
debug1: load_hostkeys: fopen C:\\Users\\Kastilo/.ssh/known_hosts2: No such file or directory
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts error:2
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory
debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts2 error:2
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory
debug1: Host '[192.168.1.2]:21534' is known and matches the RSA host key.
debug1: Found key in C:\\Users\\Kastilo/.ssh/known_hosts:1
debug3: send packet: type 21
debug2: ssh_set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: ssh_set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug3: unable to connect to pipe \\\\.\\pipe\\openssh-ssh-agent, error: 2
debug1: get_agent_identities: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: C:\\Users\\Kastilo/.ssh/Aurora/Aurora ED25519 SHA256:PN33J/a6Bm3Hfku5BlwJ0i8nmHGG/K0DzJTRhAu41P0 explicit
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,ssh-rsa>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred publickey,keyboard-interactive
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: C:\\Users\\Kastilo/.ssh/Aurora/Aurora ED25519 SHA256:PN33J/a6Bm3Hfku5BlwJ0i8nmHGG/K0DzJTRhAu41P0 explicit
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
root@192.168.1.2: Permission denied (publickey,password).

this is the output from ssh -vvvv

Are you using ECDSA key? Seems that it is not yet supported as raised here: https://github.com/openwrt/openwrt/issues/7984

2 Likes

Suggest to also post the log from the router when you try to login as that will tell more about the issue.

1 Like

The solution is to update the Dropbear package shipped by OpenWrt. The version currently available is nearly two years old...

Is this still the case?

Dropbear shows my keys as EdDSA, Curve25519 i now use this keys more then 2 years, without any problems.

root@openwrt:~# opkg info dropbear
Package: dropbear
Version: 2020.81-2
Depends: libc
Status: install user installed
Section: net
Architecture: arm_cortex-a15_neon-vfpv4
Size: 98471
Filename: dropbear_2020.81-2_arm_cortex-a15_neon-vfpv4.ipk
Conffiles:
 /etc/dropbear/dropbear_ed25519_host_key e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
 /etc/dropbear/dropbear_ecdsa_host_key e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
 /etc/dropbear/dropbear_rsa_host_key e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
 /etc/config/dropbear 0198dbc97b5a9aac76a5c6233684571ccdcc91fcb735e91c36d2b06a98158589
Description: A small SSH2 server/client designed for small memory environments.
Installed-Time: 1645043350
root@openwrt:~# cat /etc/config/dropbear 
config dropbear
        option Port '22'
        option PasswordAuth 'on'
        option Interface 'lan'

I had no client config for connecting to my openwrt device, and i'm using arch, so my client is up to date.

Edit:
Oh i compile my dropbear instance with
CONFIG_DROPBEAR_ECC=y
maybe this make the difference, but i hope this is the default for current openwrt releases

The host key pair is a completely separate entity from the pubkey authentication key pair. You need to install an ECDSA host key or configure your client to allow RSA legacy methods.

This device was moved in April this year from ath79/generic to ath79/tiny due to space constraints.

Was this the cause of your issue?

You'll need to use key types supported by the dropbear SMALL_FLASH build:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.