jstarks / npiperelay

npiperelay allows you to access Windows named pipes from WSL
MIT License
660 stars 71 forks source link

Not working with ubuntu 22.04 #28

Open xobotyi opened 1 year ago

xobotyi commented 1 year ago

Attempted to use it with fresh ubuntu installation, all packages are upgraded, git installed.

Keys being added to ssh-agent via keepassxc Relay is launched via following script

#!/usr/bin/env sh

export SSH_AUTH_SOCK=/tmp/ssh-agent-$$.tmp

if [ ! -S "$SSH_AUTH_SOCK" ]; then
  exec socat \
    UNIX-LISTEN:${SSH_AUTH_SOCK},umask=007,fork \
    EXEC:'npiperelay.exe -ep -s //./pipe/openssh-ssh-agent',nofork &
fi

If i do ssh-add -l - it properly shows keys - all the same with host. BUT! Attempt to clone repo from remote fails on ssh key validation git@github.com: Permission denied (publickey). (ssh config is empty)

Assuming that host system has same keys - i retried same from host system - everything works fine. If i remove key from agend and add it manually in host system - verification fails. If i stop relay, start local agent and add key there - everything works fine.

mknj commented 1 year ago

i am using the powershell ssh-agent and i get the same results under 22.04

2022/12/12 09:58:24 connecting to //./pipe/openssh-ssh-agent
2022/12/12 09:58:24 connected
2022/12/12 09:58:27 copy from pipe to stdout finished: pipe closed
2022/12/12 09:58:27 socat[4180] E write(5, 0x561f0be6d000, 5): Broken pipe

under 20.04 only the first two lines are printed

2022/12/12 10:06:49 connecting to //./pipe/openssh-ssh-agent
2022/12/12 10:06:49 connected

It is not related to socat. When i copy the old socat and related libs to 22.04 it still does not work It is not related to WSL1 or WSL2. I am using WSL2 with the same WSL-Linux-Kernel in both cases.

works under 20.04

socat -V
socat by Gerhard Rieger and contributors - see www.dest-unreach.org
socat version 1.7.3.3 on Oct 26 2019 17:42:04
   running on Linux version #1 SMP Wed Nov 23 01:01:46 UTC 2022, release 5.15.79.1-microsoft-standard-WSL2, machine x86_64

does not work under 22.04

LD_LIBRARY_PATH=$PWD ./socat -V
socat by Gerhard Rieger and contributors - see www.dest-unreach.org
socat version 1.7.3.3 on Oct 26 2019 17:42:04
   running on Linux version #1 SMP Wed Nov 23 01:01:46 UTC 2022, release 5.15.79.1-microsoft-standard-WSL2, machine x86_64
backlands commented 1 year ago

I was able to resolve this by updating the version of the OpenSSH agent that comes with Windows. There appear to be some new security features that break the backwards compatibility between the prepackaged Windows agent and the one in Ubuntu 22.04. I updated OpenSSH in Windows by using scoop (for the first time). I found this solution in the wsl-ssh-agent repo issues linked below.

https://github.com/rupor-github/wsl-ssh-agent/issues/29?ref=https://githubhelp.com#issuecomment-1107169510

trallnag commented 5 months ago

I am using Microsofts (beta) flavour of OpenSSH and so far it has been working fine for me on Windows 11 22H2 and 23H2 with Ubuntu 22.04