我正在尝试设置gpg代理转发,以便通过ssh使用通行证(https://www.passwordstore.org)。
本地和远程主机上的gpg版本2.2.9,按说明安装: https://gist.github.com/vt0r/a2f8c0bcb1400131ff51
extra-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程序存在一些问题。在Google中找不到对我有用的东西。
试图将pinentry-program /usr/bin/pinentry-tty
添加到gpg-agent.conf,新错误:
gpg: public key decryption failed: Invalid IPC response
gpg: decryption failed: No secret key
答案 0 :(得分:3)
当GPG混淆了从何处读取输入内容时,就会发生这种情况。只需配置它以从tty(连接到标准输入的终端)中寻找输入即可解决该问题:
export GPG_TTY=$(tty)
答案 1 :(得分:2)
This method在LXC容器中时不起作用。而是将其添加到~/.gnupg/gpg.conf
:
use-agent
pinentry-mode loopback
然后将其添加到~/.gnupg/gpg-agent.conf
allow-loopback-pinentry
然后使用echo RELOADAGENT | gpg-connect-agent
重新启动代理。
(source)