finch icon indicating copy to clipboard operation
finch copied to clipboard

[Windows] Add ssh-agent interoperability (Windows -> Finch VM)

Open pendo324 opened this issue 1 year ago • 0 comments

What is the problem you're trying to solve?. Windows natively supports OpenSSH, including ssh-agent. However, the way ssh-agent works on Windows is different than how it works on macOS / Linux. It uses a Windows specific service, and uses a named pipe instead of the socket file (located at $SSH_AUTH_SOCK) which it uses on POSIX systems.

Describe the feature you'd like Interoperability between a user's Windows ssh-agent (if configured) to their Finch VM. This should be a togglable feature, since some users may not use Window's ssh-agent, and if its not togglable, it might break any other solution they setup themselves.

Additional context This issue was first noticed when a new test for build --ssh was added to the common-tests package. See the corresponding comment on the Windows PR: https://github.com/runfinch/finch/pull/649/#issuecomment-1879168058.

Since there needs to be a forwarding daemon/long-lived-process running on the Windows side to handle forwarding from the Windows named pipe to a socket, and Finch currently does not have that capability, the most immediate place to add this functionality is to Lima, specifically it's lima-hostagent. I will create a corresponding issue on the Lima repo.

Prior art:

  • https://blog.nimamoh.net/yubi-key-gpg-wsl2/
  • https://stuartleeks.com/posts/wsl-ssh-key-forward-to-windows/
  • https://github.com/jstarks/npiperelay (and the more recent and WinGPG compatible fork: https://github.com/Lexicality/wsl-relay)
  • https://github.com/masahide/OmniSSHAgent

pendo324 avatar Jan 05 '24 19:01 pendo324