Repository navigation
Proper SSH agent forwarding #66418
BirknerAlex
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Body
I use SSH remote development with agent forwarding so I can git push on the remote with a YubiKey (gpg-agent) on my workstation (MacOS).
The current recommendation (#29438) is
-Ain args orForwardAgent yesin~/.ssh/config. That works initially but I ran into three cases where it doesnt:1. Reconnect: the remote server is a long-running process that keeps SSH_AUTH_SOCK from the session that started it. After a reconnect (network drop, laptop sleep), that socket path is gone because the environment Zed captured on the remote still contains the old path and overrides the new one.
2. Existing ControlMaster: if I already have my own ssh session to the host open (ControlMaster auto), Zed reuses it (#45271). ssh then ignores -A because that session wasn’t opened with forwarding, so the agent is silently not forwarded.
3. IdentityAgent: my ssh config uses 1Password as IdentityAgent for this host. With ForwardAgent yes, ssh forwards the 1Password agent, not my SSH_AUTH_SOCK (gpg-agent/YubiKey).
I built a fix and tested it against my own box:
-o ForwardAgent="<local SSH_AUTH_SOCK>", using the path which fixes case 3.SSH_AUTH_SOCKset to that symlink. This fixes case 1.Branch: https://github.com/BirknerAlex/zed/tree/ssh-auth-sock-forwarding
Would you take this as a PR?
All reactions