mame / wsl2-ssh-agent

A bridge from WSL2 ssh client to Windows ssh-agent.exe service
MIT License
102 stars 6 forks source link

Feature Requests: Is it possible to support named pipes in pageant.exe? #13

Closed naa0yama closed 1 month ago

naa0yama commented 2 months ago

NamedPipe is supported from pageant.exe version 0.77. This means that by keeping pageant.exe resident, the pageant_shm method and OpenSSH (NamedPipe) can coexist.

However, in reality, the implementation generates an Include file for OpenSSH and writes the dynamically generated NamedPipe destination, so it could not be used with wsl2-ssh-agent.

PS> pageant.exe --openssh-config pageant.conf
PS> Get-Content pageant.conf
IdentityAgent "//./pipe/pageant.username.1dd0bd6d8626a420747bc803b28..."

As a workaround, it would be fine to run ssh-agent (Windows) and pageant.exe, but I wanted to reduce the amount of Windows resident software if possible, so I raised this issue.

mame commented 2 months ago

@naa0yama Is it helpful for you if wsl2-ssh-agent allows to specify the name of the named pipe?

wsl2-ssh-agent -namedpipe pageant.username.1dd0bd6d8626a420747bc803b28...

Perhaps you want to retrieve the name from pageant.conf. I think it works like this.

wsl2-ssh-agent -namedpipe $(grep -oP "IdentityAgent \"//\./pipe/\K[^\"]+" /mnt/c/.../pageant.conf)

Note that wsl2-ssh-agent must be started after pageant.conf is generated.

If this is what you want, I will try to implement it when I have time.

naa0yama commented 2 months ago

@mame First of all, thanks for reading Issue.

As you suggested, it would be a great experience for pageant.exe users if -namepipe could be specified.

Perhaps you want to retrieve the name from pageant.conf. I think it works like this.

Yes, that is correct. Many users will probably use a shortcut on Windows with the following settings registered on startup.

“C:\Program Files\PuTTY\pageant.exe” --openssh-config “%USERPROFILE%\.ssh\pageant.conf”

I think I will use grep -oP to pull out namepipe and configure it, as you suggested from this.

If this is what you want, I will try to implement it when I have time.

Thanks for considering it. If implemented, I would love to use it because it is simple to do!

mame commented 1 month ago

@naa0yama Sorry for the delay. I have implemented -pipename command-line argument and released v0.9.5. I think you can now use wsl2-ssh-agent -pipename pageant.username.... If not, let me know.