Skip to content

Instantly share code, notes, and snippets.

@MartinBrugnara
Last active December 31, 2020 12:22
Show Gist options
  • Save MartinBrugnara/271824d98e975d145b888043f3248bb9 to your computer and use it in GitHub Desktop.
Save MartinBrugnara/271824d98e975d145b888043f3248bb9 to your computer and use it in GitHub Desktop.
Windows native & WSL2 SSH with gpg cards support (e.g. yubikey)
Windows & WSL1 & WSL 2 SSH with gpg cards support
>> Windows & WSL1
Based upon:
- https://www.antirandom.com/2020/03/ssh-on-windows-with-private-key-on-yubikey/
- https://github.com/benpye/wsl-ssh-pageant
Requirements:
- [win] gpg4win
* Edit %APPDATA%\gnupg\gpg-agent.conf to have
enable-putty-support
* Download WSL-SSH-Pageant (https://github.com/benpye/wsl-ssh-pageant/releases)
and install it somewhere e.g. C:\tools\wsl-ssh-pageant
Testing:
- Start bridge
C:\tools\wsl-ssh-pageant\wsl-ssh-pageant-amd64.exe -systray -verbose
-wsl C:\tools\wsl-ssh-pageant\wsl-ssh-agent.sock
--winssh win-ssh-pageant
- Kill if active and start gpg
gpgconf --kill gpg-agent
& "C:\Program Files (x86)\GnuPG\bin\gpg-connect-agent.exe" /bye
- Set windows env
$env:SSH_AUTH_SOCK="\\.\pipe\win-ssh-pageant"
- Test windows (should show keys in smarcard)
ssh-add -L
- Set wsl env
export SSH_AUTH_SOCK=/mnt/c/tools/wsl-ssh-pageant/wsl-ssh-agent.sock
-- see first resource for env automation and windows daemons.
>> WSL2
https://github.com/BlackReloaded/wsl2-ssh-pageant
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment