FiloSottile / yubikey-agent

yubikey-agent is a seamless ssh-agent for YubiKeys.
https://filippo.io/yubikey-agent
BSD 3-Clause "New" or "Revised" License
2.68k stars 132 forks source link

PR to support console-based `pinentry` clients? #92

Open tomeon opened 3 years ago

tomeon commented 3 years ago

I recently ran into an issue attempting to use console-based pinentry clients (pinentry-tty and pinentry-curses) with yubikey-agent. The details are in this issue comment in the gopasspw/gopass repo; in brief, the problem is that pinentry doesn't know the correct TTY to use for obtaining the PIN, defaults to using something that's not a TTY (its own stdin, which is a pipe set up by gopasspw/pinentry), and crashes:

$ ssh somehost
sign_and_send_pubkey: signing failed for ECDSA "YubiKey #99999999 PIV Slot 9a" from agent: agent refused operation
myuser@somehost: Permission denied (publickey).

With yubikey-agent showing:

2021/07/15 12:00:00 agent 13: pin prompt: unexpected response: YubiKey serial number: 99999999 (3 tries remaining)

Would you be willing to consider a PR introducing one or both of the following?:

Thanks!

FiloSottile commented 3 years ago

Hmm, I see the issue. yubikey-agent is kind of designed with the idea of being used with a global graphical pinentry.

I would like the complexity of dealing with TTYs to be outside yubikey-agent. Here's an idea: add to contrib/ a command that when invoked with -update updates the TTY, and when invoked otherwise runs the pinentry on that TTY. Then you can use that as the pinentry for yubikey-agent, which stays oblivious of how it all works.

rHermes commented 3 years ago

I'm being hit with the same problem. @tomeon how are you able to specify which pinentry program that should be invoked. This worked for me for multiple days, but this morning I got the same error message.

Note, I'm trying to use a graphical pinentry backend, but it appears no to be working

supermarin commented 1 year ago

Ran into this issue as well. Think the UX is suboptimal at the moment: there's no proper error message, and there's a need of maintaining gpg-agent conf even if you don't want to use gpg anymore. age-plugin-yubikey handles PIN inputs in TTY, and experience is inconsistent between the two. Think it might be a good time to revisit this decision.