t-8ch / pinentry-bemenu

Pinentry based on bemenu
GNU General Public License v3.0
49 stars 3 forks source link

CLI fallback #12

Closed ammgws closed 2 years ago

ammgws commented 2 years ago

After setting this as the pinentry program in gpg-agent.conf, I can no longer enter my passphrase when connected over SSH (it's probably failing here: https://github.com/t-8ch/pinentry-bemenu/blob/d6314c56a8a2871d6e496c621b375ac3d956414c/pinentry_bemenu.c#L112). Previously I was using pinentry-gnome3 which has a text fallback (I believe it is pinentry-curses) in this situation. Just wondering if such a fallback is out of scope for this project, or if you otherwise know of a workaround? As far as I know there is no way to dynamically change the pinentry program...

t-8ch commented 2 years ago

Thanks for the report!

I now improved the error handling, if the bemenu library is not usable (for example when no display is active) pinentry-bemenu will exit with the returncode 15. You can handle this in a custom wrapper script that falls back to another pinentry implementation.

ammgws commented 2 years ago

Ah, I forgot about just making a wrapper script for it, thanks!

I already have some env vars I set when the shell detects it is a SSH session, so I just created a wrapper that uses PINENTRY_USER_DATA like in this guide: https://gist.github.com/kevinoid/189a0168ef4ceae76ed669cd696eaa37 and everything is working again.

I will use your new exist status code to add a fallback to the wrapper script just in case as well.

Thanks!