windows: Implement ssh
using NamedPipe
#20586
Draft
+498
−41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #ISSUE
Recently, I've been trying to implement the
remote ssh
feature for Windows. Due to my coursework, progress was slow, but anyway...Given Zed’s current
remote ssh
implementation, here are two main issues that arise on Windows:The current implementation uses
UnixSocket
for inter-process communication, facilitating password entry betweenssh
andzed
. However, Windows added support forAF_UNIX
in the 2018 Fall Update of Windows 10, and even then, the support remains limited, as explained here: https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/.Additionally, the current implementation leverages
UnixSocket
and theControlPath
option for SSH connection multiplexing, but this is unsupported on Windows. You can find more details here: ControlPath in ssh_config fails v0.0.3.0 PowerShell/Win32-OpenSSH#405 and https://github.com/PowerShell/Win32-OpenSSH/wiki/Project-Scope.After testing several approaches, I’ve narrowed it down to two possible solutions. These differ only in how they handle the first issue:
Solution 1 (This PR)
For the inter-process communication issue, this solution uses
NamedPipe
, which is recommended by Microsoft, to emulateUnixSocket
functionality.Solution 2 (#20587)
In this solution, I utilize the newly introduced
UnixSocket
on Windows for inter-process communication. However, due to its limited support, an auxiliary programaskpass_helper.exe
is required to play theaskpass.sh
script’s role.windows_net
crate.For the second issue, since Windows doesn’t support connection multiplexing, my approach is to use a
password_helper.cmd
script to avoid prompting the user repeatedly for their password. The script relies onSharedMemory
to retrieve thessh
password.Currently, I’m not sure which solution to go with, so I’d love to hear Zed team’s thoughts.
Any feedback on these is welcome!
Some demo:
Screen.Recording.2024-11-13.192447.mp4
Screen.Recording.2024-11-13.193933.mp4
Release Notes: