I can use the ssh configuration file to enable the forwarding of ssh keys added to ssh-agent. How can I do the same with gpg keys?
SSH is only capable of forwarding tcp connections within the tunnel.
You can, however, use a program like
Test if it works out with
Now hopefully all you need is a way to run all this automatically!
I had to do the same, and based my script on the solution by b0fh, with a few tiny modifications: It traps exits and kills background processes, and it uses the "fork" and "reuseaddr" options to socat, which saves you the loop (and makes the background socat cleanly kill-able).
The whole thing sets up all forwards in one go, so it probably comes closer to an automated setup.
Note that on the remote host, you will need:
I believe there's also a solution that involves just one SSH command invocation (connecting back from the remote host to the local one) using
OpenSSH's new Unix Domain Socket Forwarding can do this directly starting with version 6.7.
You should be able to something like: