An agent with forwards SSH Agent Auth requests from an WSL2 instance to the PuTTY authentification agent. It acts as a bridge between WSL2 and the PuTTY Agent.
- PageantRelayNamedPipe -> Connects to the PuTTY Authentification Agent via a named pipe
- PageantRelaySocket -> Connects to the PuTTY Authentification Agent via a UNIX socket
-
An Folder C:\Users\<MyProfile>\.ssh (replace with your Profilename)
-
Use the latest Version of PuTTY CAC
-
For PageantRelayNamedPipe (.NET Framework 4 Application), the PuTTY Agent must be started with the --openssh-config C:\Users\%UserName%\.ssh\pageant.conf (Path is hardcoded, replace %UserName% with your User/Profilename)
-
For PageantRelaySocket (.NET Core Application), the PuTTY Agent must be started with the --unix C:\Users\%UserName%\.ssh\agent.sock (Path is hardcoded, replace %UserName% with your User/Profilename)
-
Copy the PageantRelayNamedPipe.exe or extract PageantRelaySocket.7z to C:\Users\%UserName%\.ssh\
-
Start the Putty Agent and load keys
Start your WSL instance (Here also: replace with your User/Profilename). In this example socat is starting in foreground. Test it and if the test succeeds append a & at the of the command line and it move to background.
wsl -d Debian
export SSH_AUTH_SOCK="/home/$USER/.ssh/agent.sock"
socat UNIX-LISTEN:"$SSH_AUTH_SOCK,fork" EXEC:"/mnt/c/Users/$USER/.ssh/PageantRelayNamedPipe.exe"
Start your WSL instance (Here also: replace with your Profilename). Example
wsl -d Debian
export SSH_AUTH_SOCK="/home/$USER/.ssh/agent.sock"
rm $SSH_AUTH_SOCK
socat UNIX-LISTEN:"$SSH_AUTH_SOCK,fork" EXEC:"/mnt/c/Users/$USER/.ssh/PageantRelaySocket.exe"
export SSH_AUTH_SOCK="/home/$USER/.ssh/agent.sock"
ssh michael@debdev.myDomain.local