benpye / wsl-ssh-pageant

A Pageant -> TCP bridge for use with WSL, allowing for Pageant to be used as an ssh-ageant within the WSL environment.
BSD 2-Clause "Simplified" License
612 stars 40 forks source link

Win32-SSH Not connecting to SSH-Pageant Pipe #43

Closed Awbmilne closed 3 years ago

Awbmilne commented 3 years ago

Ive been trying to setup up wsl-ssh-pageant for Using GPG-Agent with the built in OpenSSH of Windows.

The primary reasons for this:

I have followed the intructions layed out in the Readme.md, but havent had any luck.

Environment Variable: image

CMD wsl-ssh-pageant call: image

SSH Call:

C:\Users\Will>ssh [User]@[Server IP] -v
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug1: Reading configuration data [User Home]/.ssh/config
debug1: Connecting to [Server IP] [[Server IP]] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file [User Home]/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file [User Home]/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file [User Home]/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file [User Home]/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file [User Home]/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file [User Home]/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file [User Home]/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file [User Home]/.ssh/id_ed25519-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file [User Home]/.ssh/id_xmss type -1
debug1: key_load_public: No such file or directory
debug1: identity file [User Home]/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.7
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.9p1 [Server Type]
debug1: match: OpenSSH_7.9p1 [Server Type] pat OpenSSH* compat 0x04000000
debug1: Authenticating to [Server IP]:22 as 'pi'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:[Server Public Key]
debug1: Host '[Server IP]' is known and matches the ECDSA host key.
debug1: Found key in [User Home]/.ssh/known_hosts:17
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: [User Home]/.ssh/id_rsa
debug1: Trying private key: [User Home]/.ssh/id_dsa
debug1: Trying private key: [User Home]/.ssh/id_ecdsa
debug1: Trying private key: [User Home]/.ssh/id_ed25519
debug1: Trying private key: [User Home]/.ssh/id_xmss
debug1: No more authentication methods to try.
[User]@[Server IP]: Permission denied (publickey).

Troubleshooting

It seems to me (Since there is never output from the --verbose wsl-ssh-pageant call... That the OpenSSH agent is never accessing the pipe.

I checked if the pipe existed and if the Environment variable existed with:

type %SSH_AGENT_SOCK%

Leading to the Output: image

This leads to an output from the --verbose call: image

BUT: \ Alas, still not working... Is there some weird thing im missing?

(Im also 100% sure GPG-Agent is running since Putty/Plink work, and that it isnt some other Pageant agent, as the GPG authentication [Yubikey] works when ssh is tested with Putty\Plink)

Thanks for the great tool!\ Really Hope I can get it working!

Awbmilne commented 3 years ago

Turns out Im dumb....

SSH_AGENT_SOCK is not the correct Environment Variable SSH_AUTH_SOCK is the correct one

Replacing this fixed the issue. Sorry for the Post.