PowerShell / Win32-OpenSSH

Win32 port of OpenSSH
7.42k stars 759 forks source link

no-touch-required not working #2043

Open ccy opened 1 year ago

ccy commented 1 year ago

Prerequisites

Steps to reproduce

Here is my environment

I create a new key in Windows 11:

ssh-keygen.exe -t ed25519-sk -O resident -O no-touch-required

I add the public key to ~/.ssh/authorized_keys:

no-touch-required sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1...Do=

When I try to establish a ssh session, I encounter error:

ssh manager@192.168.0.194
sign_and_send_pubkey: signing failed for ED25519-SK "C:\\Users\\engineer/.ssh/id_ed25519_sk": requested feature not supported
manager@192.168.0.194: Permission denied (publickey).

If I don't use -O no-touch-required when create key, the ssh session can start as usual.

Here is the full debug log:

OpenSSH_for_Windows_9.2p1, LibreSSL 3.6.1
debug1: Connecting to 192.168.0.194 [192.168.0.194] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\engineer/.ssh/id_rsa type -1
debug1: identity file C:\\Users\\engineer/.ssh/id_rsa-cert type -1
debug1: identity file C:\\Users\\engineer/.ssh/id_ecdsa type -1
debug1: identity file C:\\Users\\engineer/.ssh/id_ecdsa-cert type -1
debug1: identity file C:\\Users\\engineer/.ssh/id_ecdsa_sk type -1
debug1: identity file C:\\Users\\engineer/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file C:\\Users\\engineer/.ssh/id_ed25519 type -1
debug1: identity file C:\\Users\\engineer/.ssh/id_ed25519-cert type -1
debug1: identity file C:\\Users\\engineer/.ssh/id_ed25519_sk type 12
debug1: identity file C:\\Users\\engineer/.ssh/id_ed25519_sk-cert type -1
debug1: identity file C:\\Users\\engineer/.ssh/id_xmss type -1
debug1: identity file C:\\Users\\engineer/.ssh/id_xmss-cert type -1
debug1: identity file C:\\Users\\engineer/.ssh/id_dsa type -1
debug1: identity file C:\\Users\\engineer/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_9.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.4p1 Debian-5+deb11u1
debug1: compat_banner: match: OpenSSH_8.4p1 Debian-5+deb11u1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.0.194:22 as 'manager'
debug1: load_hostkeys: fopen C:\\Users\\engineer/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
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
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:0zsBobXfjndLeRNgGGIeaqMSGPHw1NUy1K7Z73vqLWU
debug1: load_hostkeys: fopen C:\\Users\\engineer/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen __PROGRAMDATA__\\ssh/ssh_known_hosts2: No such file or directory
debug1: Host '192.168.0.194' is known and matches the ED25519 host key.
debug1: Found key in C:\\Users\\engineer/.ssh/known_hosts:2
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: get_agent_identities: ssh_fetch_identitylist: agent contains no identities
debug1: Will attempt key: C:\\Users\\engineer/.ssh/id_rsa
debug1: Will attempt key: C:\\Users\\engineer/.ssh/id_ecdsa
debug1: Will attempt key: C:\\Users\\engineer/.ssh/id_ecdsa_sk
debug1: Will attempt key: C:\\Users\\engineer/.ssh/id_ed25519
debug1: Will attempt key: C:\\Users\\engineer/.ssh/id_ed25519_sk ED25519-SK SHA256:A5kEAoukCasO+iDri1N98ozIxVdL/aVpiG1kVMGr6NQ authenticator
debug1: Will attempt key: C:\\Users\\engineer/.ssh/id_xmss
debug1: Will attempt key: C:\\Users\\engineer/.ssh/id_dsa
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: C:\\Users\\engineer/.ssh/id_rsa
debug1: Trying private key: C:\\Users\\engineer/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\engineer/.ssh/id_ecdsa_sk
debug1: Trying private key: C:\\Users\\engineer/.ssh/id_ed25519
debug1: Offering public key: C:\\Users\\engineer/.ssh/id_ed25519_sk ED25519-SK SHA256:A5kEAoukCasO+iDri1N98ozIxVdL/aVpiG1kVMGr6NQ authenticator
debug1: Server accepts key: C:\\Users\\engineer/.ssh/id_ed25519_sk ED25519-SK SHA256:A5kEAoukCasO+iDri1N98ozIxVdL/aVpiG1kVMGr6NQ authenticator
debug1: find_helper: using "C:\\Program Files\\OpenSSH\\ssh-sk-helper.exe" as helper
debug1: client_converse: helper returned error -59
debug1: identity_sign: sshkey_sign: requested feature not supported
sign_and_send_pubkey: signing failed for ED25519-SK "C:\\Users\\engineer/.ssh/id_ed25519_sk": requested feature not supported
debug1: Trying private key: C:\\Users\\engineer/.ssh/id_xmss
debug1: Trying private key: C:\\Users\\engineer/.ssh/id_dsa
debug1: No more authentication methods to try.
manager@192.168.0.194: Permission denied (publickey).

Expected behavior

Able to authenticate a SSH session without touching yubikey

Actual behavior

Prompt `requested feature not supported`

Error details

No response

Environment data

- Yubikey 5 firmware is `5.4.3`
- SSH Client: Windows 11 - `OpenSSH_for_Windows_9.2p1, LibreSSL 3.6.1`
- SSH server: Debian bullseye - `OpenSSH_8.4p1 Debian-5+deb11u1, OpenSSL 1.1.1n`

Version

OpenSSH_for_Windows_9.2p1, LibreSSL 3.6.1

Visuals

No response

beachrunner2k commented 1 year ago

On the server you are trying to connect to (the Debian host), do you have the option "no-touch-required" specified before and on the same line as your public key in ~/.ssh/authorized_keys? sshd's default behaviour is to reject no-touch-required keys.

More info here: https://wiki.archlinux.org/title/SSH_keys#:~:text=Additionally%2C,authorized_keys

lucidnx commented 1 year ago

I have tried both, editing ssh config and adding no-touch-required to authorized_keys. none of them worked.

playerla commented 1 year ago

I have the same issue

debug1: identity_sign: sshkey_sign: requested feature not supported
sign_and_send_pubkey: signing failed for ECDSA-SK ".\\id_ecdsa_sk_no-touch-required": requested feature not supported

Using :

ssh-keygen -t ecdsa-sk -O resident -O application=ssh:key-touch-required -O verify-required -O no-touch-required

aubreyshomo commented 10 months ago

Same issue here, any luck?

debug1: Server accepts key: C:\Users\Admin\.ssh\id_ed25519_sk_notouch ED25519-SK SHA256:0ynUvuILoRAERXsWjcDNszAtfTbzCUrF+xmrsHfCZfM explicit authenticator debug1: find_helper: using "C:\Program Files\OpenSSH\ssh-sk-helper.exe" as helper debug1: client_converse: helper returned error -59 debug1: identity_sign: sshkey_sign: requested feature not supported sign_and_send_pubkey: signing failed for ED25519-SK "C:\Users\Admin\.ssh\id_ed25519_sk_notouch": requested feature not supported debug2: we did not send a packet, disable method debug1: No more authentication methods to try. aubrey@localhost: Permission denied (publickey).

Keyinator commented 9 months ago

Same issue still

mkrakowitzer commented 6 months ago

Seems like its the same issue as here: https://bugzilla.mindrot.org/show_bug.cgi?id=3355

woniu7 commented 3 months ago

Same issue still. It works on linux and macos.