blink icon indicating copy to clipboard operation
blink copied to clipboard

iOS17 check: Blink on iPadOS w/ Yubikey 5c fails to connect to server

Open jac-cbi opened this issue 2 years ago • 10 comments

Checklist

Configuration

iPad OS 16.4.1 (iPad Pro 11-inch, A1980) Blink v16.1.7.748

Describe the bug

I setup my Yubikey as a Security Key as described in Secure Keys. In Config -> Hosts -> hostA, I selected the Key I just configured.

blink> ssh -vv hostA
# ...
Trying publickey...
ssh_agent_get_ident_count: Answer type: 12, expected answer: 12
ssh_agent_get_ident_count: Agent count: 1
ssh_userauth_agent: Trying identity Yubikey 07
ssh_key_type_to_hash: Digest algorithm to be used with key type 15 is not defined
ssh_key_algorithm_allowed: Checking [email protected] with list <[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss>
packet_send2: packet: wrote [type=50, len=240, padding_size=13, comp=226, payload=226]
ssh_packet_socket_callback: packet: read type 60 [len=192,padding=6,comp=185,payload=185]
ssh_packet_process: Dispatching handler for packet type 60
ssh_userauth_agent: Public key of Yubikey 07 accepted by server
ssh_key_type_to_hash: Digest algorithm to be used with key type 15 is not defined
ssh_key_algorithm_allowed: Checking [email protected] with list <[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss>
# process hangs here ...

And on the server side at DEBUG2

Apr 28 18:24:08 hostA sshd[9511]: debug1: /home/user/.ssh/authorized_keys:5: matching key found: ECDSA-SK SHA256:### Hash elided ###
Apr 28 18:24:08 hostA sshd[9511]: debug1: /home/user/.ssh/authorized_keys:5: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
Apr 28 18:24:08 hostA sshd[9511]: Accepted key ECDSA-SK SHA256:### Hash elided ### found at /home/user/.ssh/authorized_keys:5
Apr 28 18:24:08 hostA sshd[9511]: debug2: auth_check_authkeys_file: /home/user/.ssh/authorized_keys: processed 5/7 lines
Apr 28 18:24:08 hostA sshd[9511]: debug1: restore_uid: 0/0
Apr 28 18:24:08 hostA sshd[9511]: debug2: userauth_pubkey: authenticated 0 pkalg [email protected] [preauth]
Apr 28 18:24:08 hostA sshd[9511]: Postponed publickey for user from 1.2.3.4 port 49641 ssh2 [preauth]

I think I've done everything correctly. But I've no idea why I'm not getting the popup from iPadOS for the key.

jac-cbi avatar Apr 28 '23 18:04 jac-cbi

I had a heads up from Reddit on this and I need to check it from my side. Last time I tried with Ubuntu and everything was smooth. Need to check my notes because honestly, I think I remember running into this while testing, but don't remember what was provoking it. I won't have time until next week though.

What OS and OpenSSH version are you running? Have you tried other locations?

carloscabanero avatar Apr 28 '23 19:04 carloscabanero

The Server is Gentoo, updated daily. OpenSSH 9.3_p1.

I've not tried other locations. This is my primary server, that I completely control. So I usually test there first.

I just tried ssh'ing into my MacBook Pro, same error / result. Ventura 13.3.1, 13-inch 2020.

jac-cbi avatar Apr 28 '23 21:04 jac-cbi

Same issue, but different error message:

socket_callback_connected: Socket connection callback: 1 (0)
ssh_known_hosts_read_entries: Failed to open the known_hosts file '/etc/ssh/ssh_known_hosts': No such file or directory
ssh_packet_userauth_failure: Access denied for 'none'. Authentication that can continue: publickey
ssh_agent_get_ident_count: Answer type: 12, expected answer: 12
ssh_key_type_to_hash: Digest algorithm to be used with key type 15 is not defined
ssh_key_type_to_hash: Digest algorithm to be used with key type 15 is not defined

Blink: v16.1.7.748

iPadOS: 16.4.1 (a)

iPad Pro 12.9 2022 (A2436)

I have this error for key type [email protected] both for Passkey and Security Key (Yubico YubiKey 5C NFC).

ssh-rsa key works fine.

Also, [email protected] key generated on macOS (YubiKey) works fine.

Tested on my own server and fresh ec2 Debian installation.

firolunis avatar May 11 '23 18:05 firolunis

I get the same message as @firolunis. It worked fine few months ago to connect to the same server (though, I applied some minor updates on the server side). On the client side I installed at least 21 emoji, so it must be a pretty big update (currently on 16.4.1 (a) 20E772520a). Yubikey still works fine (I can log in with it to GitHub).

Trying publickey...
ssh_agent_get_ident_count: Answer type: 12, expected answer: 12
ssh_key_type_to_hash: Digest algorithm to be used with key type 15 is not defined
ssh_key_type_to_hash: Digest algorithm to be used with key type 15 is not defined

alnsn avatar May 29 '23 20:05 alnsn

Trying publickey...
agent_talk: Request length: 1
ssh_agent_get_ident_count: Answer type: 12, expected answer: 12
ssh_agent_get_ident_count: Agent count: 1
ssh_userauth_agent: Trying identity yubikey5ci
ssh_key_type_to_hash: Digest algorithm to be used with key type 15 is not defined
ssh_key_algorithm_allowed: Checking [email protected] with list <[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss>
packet_send2: packet: wrote [type=50, len=240, padding_size=13, comp=226, payload=226]
ssh_packet_socket_callback: packet: read type 60 [len=192,padding=6,comp=185,payload=185]
ssh_packet_process: Dispatching handler for packet type 60
ssh_packet_userauth_pk_ok: Received SSH_USERAUTH_PK_OK/INFO_REQUEST/GSSAPI_RESPONSE
ssh_packet_userauth_pk_ok: Assuming SSH_USERAUTH_PK_OK
ssh_userauth_agent: Public key of yubikey5ci accepted by server
ssh_key_type_to_hash: Digest algorithm to be used with key type 15 is not defined
ssh_key_algorithm_allowed: Checking [email protected] with list <[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss>
agent_talk: Request length: 417

alnsn avatar May 29 '23 20:05 alnsn

I just received my TestFlight credentials, and one of the first things I tried to do was setup FIDO2 & PassKey authentication. Neither of which is working due to this bug. This bug may more accurately be called:

Blink on iPadOS w/ [email protected] fails to connect to server
  • Blink v17.0.0.837 (Test Flight)
  • iPadOS v16.6.1

I used -vvv and got identical results to the log above

And, note re:

  • https://github.com/blinksh/blink/issues/635#issuecomment-1289589918

I am using HomeBrew OpenSSH_9.4, OpenSSL 3.1.2 1 Aug 2023

danielzen avatar Sep 19 '23 19:09 danielzen

I am able to get the popup for PassKey by explicitly setting:

AllowAgentForwarding yes # or no. Either makes the popup appear

But I'm still not logged in.

danielzen avatar Sep 20 '23 18:09 danielzen

Thanks for testing from your side and for dropping the note. I want to get on this in this iteration in September. One important thing here is to make sure the server allows for webauthn signatures.

My goal is to see if we can rewrite this to use the regular sk key and not the webauthn one. If that is not possible then we will figure out how to continue extending with webauthn. Up until now supporting libfido was not possible and the Yubico SDK was very limited. WebAuthn was giving a good experience on both iPhone and iPad, something that other terminals were not able to do. But support for WebAuthn on OpenSSH is still catching up. Will see what we can do..

carloscabanero avatar Sep 20 '23 18:09 carloscabanero

I did a big review of Security Keys so we can decide what the next steps may be. I will link to a longer discussion here later.

On Webauthn keys, I tested and everything is still working as expected. All problems here are because although WebAuthn keys are still considered sk-ecdsa keys, the signature they produce is webauthn-sk-ecdsa (basically a WebAuthn signature instead of a U2F signature). You can find out about the protocol here. Just make sure your OpenSSH returns webauthn as one of the accepted signatures.

Unfortunately, there is no way for us to produce a U2F signature. Yubikey does not support U2F on its keys over USB through their SDK (more on that later). They only support it over NFC and MFI (lightning).

But, I think I have a couple of ideas on how we could solve this from our side. I will need your feedback though as solutions may require a good amount of work and need to make sure we arrive to more solid ground.

carloscabanero avatar Sep 29 '23 18:09 carloscabanero

The whole story:

  • https://github.com/blinksh/blink/discussions/1875

Please please leave your comments there. I need to know that there is real interest to solve this. Otherwise we won't know if it may be worth our time.

carloscabanero avatar Sep 29 '23 20:09 carloscabanero