我正在尝试设置 gpg-agent 转发以便通过 ssh使用 pass ( https://www.passwordstore.org )。
本地和远程主机上的 gpg 版本 2.2.9,按说明安装: https ://gist.github.com/vt0r/a2f8c0bcb1400131ff51
在本地机器上
$HOME/.gnupg/gpg-agent.confextra-socket /home/mickey/.gnupg/S.gpg-agent.remote
echo RELOADAGENT | gpg-connect-agent
gpg --export -a mickey > mickey.gpg
echo "test" | gpg2 --encrypt -r mickey > out.gpg
scp *.gpg REMOTE_HOST:
ssh -R /run/user/1002/gnupg/S.gpg-agent:/home/mickey/.gnupg/S.gpg-agent.remote -o "StreamLocalBindUnlink=yes" REMOTE_HOST
在远程机器上
导入公钥gpg --import mickey.gpg
gpg --edit-key mickey
trust 5 quit
gpg --decrypt -v out.gpg
gpg: public key is FED6243A3325C554
gpg: connection to agent is in restricted mode
gpg: using subkey FED6243A3325C554 instead of primary key 9E2ED69A02554504
gpg: using subkey FED6243A3325C554 instead of primary key 9E2ED69A02554504
gpg: encrypted with 2048-bit RSA key, ID FED6243A3325C554, created 2018-07-23
"mickey"
gpg: public key decryption failed: Inappropriate ioctl for device
gpg: decryption failed: No secret key
因此,代理套接字转发正在工作,似乎 pinentry 程序存在一些问题。在谷歌中找不到任何对我有用的东西。
UPD
试图添加pinentry-program /usr/bin/pinentry-tty
到 gpg-agent.conf,新错误:
gpg: public key decryption failed: Invalid IPC response
gpg: decryption failed: No secret key