Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Named pipe stops working after a while the system is on #20

Open
maicol07 opened this issue May 24, 2022 · 31 comments
Open

Named pipe stops working after a while the system is on #20

maicol07 opened this issue May 24, 2022 · 31 comments

Comments

@maicol07
Copy link
Contributor

It seems that named pipe stops working after a while the system is on:

PS C:\Users\Maicol> ssh-add -l
Error connecting to agent: No such file or directory
PS C:\Users\Maicol> Get-ChildItem \\.\pipe\|findstr open
------        01/01/1601     01:00              1 openssh-ssh-agent

WSL:

  ~ ❯ ssh-add -l                                                                                              19:43:23
error fetching identities: communication with agent failed

However, Git bash works:

$ ssh-add -l
3072 SHA256:xInBcA48YT6jmmOEWQrXtC+xw+c6V2V2cVgAWT6K9hg id_rsa (RSA)
256 SHA256:ZgvmgA5CNIpEbTZWepclAdXC9fVBFsB1kvmM14Egjm8 id_ed25519 (ED25519)

I've currently tested the named pipe mode and the 1password proxy mode and the two modes are affected.
Do you have any clue?
Thanks

@masahide
Copy link
Owner

masahide commented May 26, 2022

There may be something wrong with the omni-socat process.
When does this occur?
Does it always result in an error?

Create a debug log output mode to check the status.

@masahide
Copy link
Owner

Please ps the socat process startup in WSL.

$ ps axuw|grep socat
masahide 14784  0.0  0.0   6968  1788 ?        Ss   13:43   0:00 socat UNIX-LISTEN:/home/masahide/.ssh/agent.sock,fork EXEC:/home/masahide/omni-socat/omni-socat.exe,nofork

@masahide
Copy link
Owner

https://github.com/masahide/OmniSSHAgent/releases/tag/0.3.1

Added debug log output mode to omni-socat.
Debug mode is enabled by doing the following.
Logs are output to /mnt/c/User/<user_name>/omni-socat.log.

In WSL console, do the following

# kill socat prosess
killall socat 
# remove old omni-socat.exe
rm ~/omni-socat/omni-socat.exe

Rewrite ~/omni-socat/ubuntu-bash.setup.sh

(setsid socat UNIX-LISTEN:$SSH_AUTH_SOCK,fork EXEC:"$OMNISOCATCMD",nofork &) >/dev/null 2>&1

to

(setsid socat UNIX-LISTEN:$SSH_AUTH_SOCK,fork EXEC:"$OMNISOCATCMD -debug",nofork &) >/dev/null 2>&1

Restart WSL console.

# Try ssh-agent communication
ssh-add -l
# cat logfile
cat  /mnt/c/User/<user_name>/omni-socat.log
2022/05/27 21:24:19 npipe2stdin.go:44: Started omni-socat
2022/05/27 21:24:19 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/27 21:24:19 npipe2stdin.go:58: Disconnected. [<nil>]

@maicol07
Copy link
Contributor Author

When does this occur?

There isn't a specific time when this occurs

Does it always result in an error?

Yes, the error of the OP

Please ps the socat process startup in WSL.

This after updating to 0.3.1:

~ ❯ ps axuw|grep socat  12s 15:44:40
maicol07 3558 0.0 0.0 10280 2952 ? Ss 15:10 0:00 socat UNIX-LISTEN:/home/maicol07/.ssh/agent.sock,fork E
XEC:/home/maicol07/omni-socat/omni-socat.exe -debug
maicol07 4837 0.0 0.0 6476 2272 pts/0 S+ 15:44 0:00 grep --color=auto socat

After update the result is:

~ ❯ ssh-add -l                                                                                              15:44:42
error fetching identities: communication with agent failed
~ ❯ cat /mnt/c/Users/Maicol/omni-socat.log                                                                  15:46:17
cat: /mnt/c/Users/Maicol/omni-socat.log: No such file or directory

@masahide
Copy link
Owner

masahide commented May 28, 2022

It seems that /usr/bin/socat and $HOME/omni-socat/omni-socat.exe are not communicating.

Check $SSH_AUTH_SOCK

$ echo $SSH_AUTH_SOCK
/home/masahide/.ssh/agent.sock

Check if omni-socat.exe is executable from WSL.

$ ~/omni-socat/omni-socat.exe -h
Usage of omni-socat.exe:
  -debug
        Output debug log

Manually start socat and check operation

# Kill already activated socat
killall socat
# Start socat
socat UNIX-LISTEN:$HOME/.ssh/agent.sock,fork EXEC:"$HOME/omni-socat/omni-socat.exe -debug"

Start another console to check.

masahide@DESKTOP-BI62AKS:~$ ls -la $SSH_AUTH_SOCK
srwxr-xr-x 1 masahide masahide 0 May 28 16:16 /home/masahide/.ssh/agent.sock
masahide@DESKTOP-BI62AKS:~$ ssh-add -l

@maicol07
Copy link
Contributor Author

First console:

~ ❯ ssh-add -l                                                                                              09:20:12
error fetching identities: communication with agent failed
~ ❯ echo $SSH_AUTH_SOCK                                                                                     09:20:23
/home/maicol07/.ssh/agent.sock
~ ❯ ~/omni-socat/omni-socat.exe -h                                                                          09:20:29
fish: The file '/home/maicol07/omni-socat/omni-socat.exe' is not executable by this user
~ ❯ killall socat                                                                                     ✘ 126 09:20:42
~ ❯ socat UNIX-LISTEN:$HOME/.ssh/agent.sock,fork EXEC:"$HOME/omni-socat/omni-socat.exe -debug"              09:21:07
2022/05/28 09:21:12 socat[855] E "/home/maicol07/.ssh/agent.sock" exists

Second console:

~ ❯ ls -la $SSH_AUTH_SOCK                                                                                   09:21:25
srwxr-xr-x 1 maicol07 maicol07 0 mag 28 09:21 /home/maicol07/.ssh/agent.sock=
~ ❯ ssh-add -l                                                                                              09:21:28
error fetching identities: communication with agent failed

@masahide
Copy link
Owner

masahide commented May 28, 2022

fish: The file '/home/maicol07/omni-socat/omni-socat.exe' is not executable by this user

Perhaps you do not have execute permissions?

Check the permissions on ~/omni-socat/omni-socat.exe

> ls -la ~/omni-socat/omni-socat.exe
-rwxrwxrwx 1 masahide masahide 3675648 May 27 21:16 /home/masahide/omni-socat/omni-socat.exe*

@maicol07
Copy link
Contributor Author

~ ❯ ls -la ~/omni-socat/omni-socat.exe                                                                      11:46:55
-rw-r--r-- 1 maicol07 maicol07 3675648 mag 27 21:16 /home/maicol07/omni-socat/omni-socat.exe

Let me try to chmod it

@maicol07
Copy link
Contributor Author

Chmodded. Now I get:

@masahide
Copy link
Owner

I wonder why... It looks like the file is corrupt.
There may be a problem with the download script.
In the meantime, let's get the file directly with curl and check it out!

$ curl https://github.com/masahide/OmniSSHAgent/releases/latest/download/omni-socat.zip -sLo omni-socat.zip
$ unzip omni-socat.zip
Archive:  omni-socat.zip
  inflating: omni-socat.exe
$ sha1sum  omni-socat.exe
d34e4797eaa493b301356d361a8d5473913b41fb  omni-socat.exe
$ ls -la  omni-socat.exe
-rwxrwxrwx 1 masahide masahide 3675648 May 27 21:16 omni-socat.exe
$ ./omni-socat.exe -h
Usage of omni-socat.exe:
  -debug
        Output debug log
$ uname -a
Linux DESKTOP-BI62AKS 4.19.104-microsoft-standard #1 SMP Wed Feb 19 06:37:35 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

@maicol07
Copy link
Contributor Author

maicol07 commented May 28, 2022

~ ❯ ssh-add -l                                                                                              11:49:18
error fetching identities: communication with agent failed
~ ❯ cd omni-socat/                                                                                  1m 51s 11:51:13
~/omni-socat ❯ curl https://github.com/masahide/OmniSSHAgent/releases/latest/download/omni-socat.zip -sLo omni-socat
.zip
~/omni-socat ❯ unzip omni-socat.zip                                                                         12:26:02
Archive:  omni-socat.zip
replace omni-socat.exe? [y]es, [n]o, [A]ll, [N]one, [r]ename: y
  inflating: omni-socat.exe
~/omni-socat ❯ sha1sum omni-socat.exe                                                                   4s 12:26:17
d34e4797eaa493b301356d361a8d5473913b41fb  omni-socat.exe
~/omni-socat ❯ ls -la omni-socat.exe                                                                        12:26:30
-rwxrwxrwx 1 maicol07 maicol07 3675648 mag 27 14:16 omni-socat.exe*
~/omni-socat ❯ ./omni-socat.exe -h                                                                          12:26:44
Usage of omni-socat.exe:
  -debug
        Output debug log
~/omni-socat ❯ uname -a                                                                                     12:26:52
Linux MAICOL-ROG 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
~/omni-socat ❯ ssh-add -l                                                                                   12:27:02
error fetching identities: communication with agent failed
~/omni-socat ❯ killall socat                                                                                12:27:28
~/omni-socat ❯ socat UNIX-LISTEN:$HOME/.ssh/agent.sock,fork EXEC:"$HOME/omni-socat/omni-socat.exe -debug"   12:27:37
2022/05/28 12:27:44 socat[3705] E "/home/maicol07/.ssh/agent.sock" exists

~/omni-socat ❯ ssh-add -l                                                                                   12:28:00
3072 SHA256:xInBcA48YT6jmmOEWQrXtC+xw+c6V2V2cVgAWT6K9hg id_rsa (RSA)
256 SHA256:ZgvmgA5CNIpEbTZWepclAdXC9fVBFsB1kvmM14Egjm8 id_ed25519 (ED25519)

I don't know redownloading helped, I'll let you know in some days if I get the error again.

@ddrown
Copy link

ddrown commented May 31, 2022

I think I'm seeing the same issue:
image

What's strange is it runs outside of socat:

$ curl https://github.com/masahide/OmniSSHAgent/releases/latest/download/omni-socat.zip -sLo omni-socat.zip
$ unzip omni-socat.zip
Archive:  omni-socat.zip
  inflating: omni-socat.exe
$ ls -l
total 5612
-rwxrwxrwx 1 ddrown ddrown 3675648 May 27 07:16 omni-socat.exe
-rw-rw-r-- 1 ddrown ddrown 2067854 May 31 10:17 omni-socat.zip
$ sha1sum omni-socat.exe
d34e4797eaa493b301356d361a8d5473913b41fb  omni-socat.exe
$ ./omni-socat.exe -h
Usage of omni-socat.exe:
  -debug
        Output debug log
$ socat UNIX-LISTEN:/home/ddrown/.ssh/agent.sock,fork EXEC:"./omni-socat.exe -debug" &
$ ssh-add -l
error fetching identities: communication with agent failed

@ddrown
Copy link

ddrown commented May 31, 2022

It was working on Friday (May 27) but broke between then and today (May 31).

I tried:

  • building omni-socat from source
  • switching to npiperelay
  • switching omni-socat.exe to windows 8 compatability mode

None of those worked

Rebooted my laptop, and it's back to working again 🤷

@masahide
Copy link
Owner

masahide commented Jun 1, 2022

Thank you for your report.
It seems that there is some kind of problem with the linkage between socat and omni-socat.
However, I think the internal implementation of npiperelay is almost the same, so if npiperelay doesn't work either, there may be a problem elsewhere.
I will also investigate.(I haven't been able to reproduce the problem yet, but from there...)

@maicol07
Copy link
Contributor Author

maicol07 commented Jun 2, 2022

@masahide got this again and nothing has been logged

~ ❯ ssh-add -l                                                                                              23:45:45
error fetching identities: communication with agent failed
~ ❯ cat /mnt/c/Users/Maicol/omni-socat.log                                                                  23:45:47
2022/05/28 12:27:59 npipe2stdin.go:44: Started omni-socat
2022/05/28 12:27:59 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/28 12:27:59 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/28 12:28:03 npipe2stdin.go:44: Started omni-socat
2022/05/28 12:28:03 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/28 12:28:03 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/28 12:29:14 npipe2stdin.go:44: Started omni-socat
2022/05/28 12:29:14 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/28 12:29:14 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/28 12:29:44 npipe2stdin.go:44: Started omni-socat
2022/05/28 12:29:44 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/28 12:29:44 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/28 20:53:24 npipe2stdin.go:44: Started omni-socat
2022/05/28 20:53:24 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/28 20:53:28 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/29 01:45:16 npipe2stdin.go:44: Started omni-socat
2022/05/29 01:45:16 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/29 01:45:16 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/29 01:45:19 npipe2stdin.go:44: Started omni-socat
2022/05/29 01:45:19 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/29 01:45:19 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/29 16:28:28 npipe2stdin.go:44: Started omni-socat
2022/05/29 16:28:28 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/29 16:28:33 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/31 12:45:21 npipe2stdin.go:44: Started omni-socat
2022/05/31 12:45:21 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/31 12:45:27 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/31 15:36:39 npipe2stdin.go:44: Started omni-socat
2022/05/31 15:36:39 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/31 15:36:39 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 01:27:35 npipe2stdin.go:44: Started omni-socat
2022/06/01 01:27:35 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 01:27:40 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 13:25:59 npipe2stdin.go:44: Started omni-socat
2022/06/01 13:25:59 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 13:26:03 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 13:45:46 npipe2stdin.go:44: Started omni-socat
2022/06/01 13:45:46 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 13:45:49 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 14:42:04 npipe2stdin.go:44: Started omni-socat
2022/06/01 14:42:04 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 14:42:10 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 14:56:12 npipe2stdin.go:44: Started omni-socat
2022/06/01 14:56:12 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 14:56:12 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 15:10:22 npipe2stdin.go:44: Started omni-socat
2022/06/01 15:10:22 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 15:10:22 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 15:20:15 npipe2stdin.go:44: Started omni-socat
2022/06/01 15:20:15 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 15:20:15 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 15:27:34 npipe2stdin.go:44: Started omni-socat
2022/06/01 15:27:34 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 15:27:34 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 15:40:48 npipe2stdin.go:44: Started omni-socat
2022/06/01 15:40:48 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 15:40:48 npipe2stdin.go:58: Disconnected. [<nil>]
~ ❯ ps axuw|grep socat                                                                                      23:45:51
maicol07   484  0.0  0.0  10276  3008 ?        Ss   15:54   0:00 socat UNIX-LISTEN:/home/maicol07/.ssh/agent.sock,fork EXEC:/home/maicol07/omni-socat/omni-socat.exe -debug
maicol07 11729  0.0  0.0   6476  2248 pts/2    S+   23:46   0:00 grep --color=auto socat

@masahide
Copy link
Owner

masahide commented Jun 3, 2022

Thank you very much.

Do you get help by running /home/maicol07/omni-socat/omni-socat.exe -h?
Also
sha1sum /home/maicol07/omni-socat/omni-socat.exe
and
ls -la $SSH_AUTH_SOCK
please.

@maicol07
Copy link
Contributor Author

maicol07 commented Jun 3, 2022

Rebooted and works... next time!

@maicol07
Copy link
Contributor Author

maicol07 commented Jun 6, 2022

@masahide new case:

  ~ ❯ ssh-add -l                                                                                              17:41:18
error fetching identities: communication with agent failed
  ~ ❯ cat /mnt/c/Users/Maicol/omni-socat.log                                                                  22:10:52
2022/05/28 12:27:59 npipe2stdin.go:44: Started omni-socat
2022/05/28 12:27:59 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/28 12:27:59 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/28 12:28:03 npipe2stdin.go:44: Started omni-socat
2022/05/28 12:28:03 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/28 12:28:03 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/28 12:29:14 npipe2stdin.go:44: Started omni-socat
2022/05/28 12:29:14 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/28 12:29:14 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/28 12:29:44 npipe2stdin.go:44: Started omni-socat
2022/05/28 12:29:44 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/28 12:29:44 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/28 20:53:24 npipe2stdin.go:44: Started omni-socat
2022/05/28 20:53:24 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/28 20:53:28 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/29 01:45:16 npipe2stdin.go:44: Started omni-socat
2022/05/29 01:45:16 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/29 01:45:16 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/29 01:45:19 npipe2stdin.go:44: Started omni-socat
2022/05/29 01:45:19 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/29 01:45:19 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/29 16:28:28 npipe2stdin.go:44: Started omni-socat
2022/05/29 16:28:28 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/29 16:28:33 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/31 12:45:21 npipe2stdin.go:44: Started omni-socat
2022/05/31 12:45:21 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/31 12:45:27 npipe2stdin.go:58: Disconnected. [<nil>]
2022/05/31 15:36:39 npipe2stdin.go:44: Started omni-socat
2022/05/31 15:36:39 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/05/31 15:36:39 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 01:27:35 npipe2stdin.go:44: Started omni-socat
2022/06/01 01:27:35 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 01:27:40 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 13:25:59 npipe2stdin.go:44: Started omni-socat
2022/06/01 13:25:59 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 13:26:03 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 13:45:46 npipe2stdin.go:44: Started omni-socat
2022/06/01 13:45:46 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 13:45:49 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 14:42:04 npipe2stdin.go:44: Started omni-socat
2022/06/01 14:42:04 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 14:42:10 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 14:56:12 npipe2stdin.go:44: Started omni-socat
2022/06/01 14:56:12 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 14:56:12 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 15:10:22 npipe2stdin.go:44: Started omni-socat
2022/06/01 15:10:22 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 15:10:22 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 15:20:15 npipe2stdin.go:44: Started omni-socat
2022/06/01 15:20:15 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 15:20:15 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 15:27:34 npipe2stdin.go:44: Started omni-socat
2022/06/01 15:27:34 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 15:27:34 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/01 15:40:48 npipe2stdin.go:44: Started omni-socat
2022/06/01 15:40:48 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/01 15:40:48 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/03 09:00:37 npipe2stdin.go:44: Started omni-socat
2022/06/03 09:00:37 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/03 09:00:37 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/03 09:01:08 npipe2stdin.go:44: Started omni-socat
2022/06/03 09:01:08 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/03 09:01:08 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/03 09:01:22 npipe2stdin.go:44: Started omni-socat
2022/06/03 09:01:22 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/03 09:01:24 npipe2stdin.go:58: Disconnected. [<nil>]
2022/06/03 15:16:45 npipe2stdin.go:44: Started omni-socat
2022/06/03 15:16:45 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/03 15:16:48 npipe2stdin.go:58: Disconnected. [<nil>]
  ~ ❯ ps axuw|grep socat                                                                                      22:12:16
maicol07   497  0.0  0.0  10276  2964 ?        Ss   10:29   0:00 socat UNIX-LISTEN:/home/maicol07/.ssh/agent.sock,fork EXEC:/home/maicol07/omni-socat/omni-socat.exe -debug
maicol07  2972  0.0  0.0   6476  2328 pts/1    S+   22:12   0:00 grep --color=auto socat
  ~ ❯ /home/maicol07/omni-socat/omni-socat.exe -h                                                             22:12:36
Usage of omni-socat.exe:
  -debug
        Output debug log
  ~ ❯ sha1sum /home/maicol07/omni-socat/omni-socat.exe                                                        22:12:46
d34e4797eaa493b301356d361a8d5473913b41fb  /home/maicol07/omni-socat/omni-socat.exe
  ~ ❯ ls -la $SSH_AUTH_SOCK                                                                                   22:13:01
srwxr-xr-x 1 maicol07 maicol07 0 giu  6 10:29 /home/maicol07/.ssh/agent.sock=

@masahide
Copy link
Owner

masahide commented Jun 7, 2022

Thanks.
From the information you gave us, it looks like the omni-socat.exe is fine and the socat process is causing the problem.

It may be a problem with the combination of socat and WSL2.
microsoft/WSL#7560

I'll look into it some more, but if there's nothing I can do about it. I think I can solve this problem by creating something like socat myself. Please give me some time.

@maicol07
Copy link
Contributor Author

New issue today, but I don't know if it's related:

sign_and_send_pubkey: signing failed for RSA "/home/maicol07/.ssh/id_rsa" from agent: agent refused operation
sign_and_send_pubkey: signing failed for ED25519 "id_ed25519" from agent: agent refused operation
[email protected]: Permission denied (publickey)

Log:

2022/06/10 16:16:59 npipe2stdin.go:44: Started omni-socat
2022/06/10 16:16:59 npipe2stdin.go:51: Opened pipe:[\\.\pipe\openssh-ssh-agent]
2022/06/10 16:16:59 npipe2stdin.go:58: Disconnected. [<nil>]

@maicol07
Copy link
Contributor Author

Useful detail (maybe): restarting 1password when this happens fixes the issue

@masahide
Copy link
Owner

Useful detail (maybe): restarting 1password when this happens fixes the issue

When 1password was restarted, did socat recover without KILL?

@maicol07
Copy link
Contributor Author

Yes, I only restart 1Password. Other things and services are untouched

@masahide
Copy link
Owner

It may be a glitch on 1password's part.
If you get the error again, could you try ssh-add.exe in windows.

Could you try ssh-add -L?

C:\Windows\System32\OpenSSH\ssh-add.exe -L
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIChI8AXMLP3pp1/9++H9Ebh3BiqMGJMIhc5f4Pxtk+By id_ed25519 masahide 20220322

If you get a key list error with ssh-add.exe, it may be a bug on 1password's side.

@maicol07
Copy link
Contributor Author

maicol07 commented Jun 27, 2022

@masahide windows ssh-add never worked for me (in the PC I'm currrently using. On another PC works):

PS C:\Users\Maicol> ssh-add -L
Error connecting to agent: No such file or directory
PS C:\Users\Maicol> ssh-add.exe -L
Error connecting to agent: No such file or directory

I'm not sure whether restarting 1Password fixes the original test (I will try that when I get it), but it fixes this one: #20 (comment)

@masahide
Copy link
Owner

If C:\WindowsSystem32\OpenSSH\ssh-add.exe outputs "Error connecting to agent: No such file or directory", the 1password ssh agent is not functioning properly.

https://developer.1password.com/docs/ssh/agent

@maicol07
Copy link
Contributor Author

I've debugged a bit and it seems Omni overwrites the pipe used by Microsoft OpenSSH:

 Maicol    ~  ﮫ0ms⠀   ssh-add.exe -L                                            pwsh   100  09:24:29 
Error connecting to agent: No such file or directory
 Maicol    ~  ﮫ39ms⠀   echo $env:SSH_AUTH_SOCK                                  pwsh   100  09:24:34 
/c/Users/Maicol/OmniSSHCygwin.sock
 Maicol    ~  ﮫ18ms⠀   $env:SSH_AUTH_SOCK = '\\.\pipe\openssh-ssh-agent'        pwsh   100  09:24:40 
 Maicol    ~  ﮫ2ms⠀   echo $env:SSH_AUTH_SOCK                                   pwsh   100  09:24:44 
\\.\pipe\openssh-ssh-agent
 Maicol    ~  ﮫ30ms⠀   ssh-add.exe -l                                           pwsh   100  09:24:48 
3072 SHA256:xInBcA48YT6jmmOEWQrXtC+xw+c6V2V2cVgAWT6K9hg id_rsa (RSA)
256 SHA256:ZgvmgA5CNIpEbTZWepclAdXC9fVBFsB1kvmM14Egjm8 id_ed25519 (ED25519)

I've checked in env variables and there was a manually added SSH_AUTH_SOCK variable that was causing this issue.

I'll keep you updated if I have the previous issues

@masahide
Copy link
Owner

Sorry, I'm sorry, I'm not sure if you are using Cygwin/MSYS2/Git for windows.
In that case, ssh-add.exe may not work because you have rewritten the environment variable "SSH_AUTH_SOCK" as you indicated.

@maicol07
Copy link
Contributor Author

No, I'm not using Cygwin and the others.

I'm only using WSL2 and rarely Powershell

@ddrown
Copy link

ddrown commented Apr 8, 2023

I've been using this every day since I added my comments, and it's been stable ever since then. I guess something changed, but I don't know what.

@masahide
Copy link
Owner

masahide commented Apr 8, 2023

Thank you for the information.
However, the cause of this particular problem is still unknown and no particular measures have been taken. Maybe there is some underlying timing or combination problem. I will continue to wait for the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants