Skip to content

Race666/wsl2-to-pageant-forwarder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

WSL2 SSH Authentication agent forwarding of PuTTY Agent

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.

There are two forwarders in this project

  • PageantRelayNamedPipe -> Connects to the PuTTY Authentification Agent via a named pipe
  • PageantRelaySocket -> Connects to the PuTTY Authentification Agent via a UNIX socket

Requierments

  • 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

  • Usage Putty Agent NamedPipe

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"

Usage Putty Agent socket

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"

Then connect to your host

export SSH_AUTH_SOCK="/home/$USER/.ssh/agent.sock"
ssh michael@debdev.myDomain.local

About

An agent which forwards SSH Agent Auth requests from a WSL2 instance to the PuTTY authentification agent

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages