Skip to content

Port forwarding to unix socket or named pipe to Windows #2321

Closed
@RailWar

Description

@RailWar

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Steps to reproduce

I try a tcp port 22222 forward to unix socket or named pipe on same windows (localhost). I use application witten on c++ as unix socket server and pipes server. sshd_config is original, unmodified.

Expected behavior

unix socket
--------------
us_serer.exe (my test program)
ssh -N -vvv -L localhost:22222:/Users/RailWar/AppData/Local/Temp/my_unix.sock localhost
putty as raw client to port 22222

pipe
------------
pipe_server.exe (my test program)
ssh -N -vvv -L localhost:22222://./pipe/my_pipe localhost
putty as raw client to port 22222

Actual behavior

unix sockets server sees the connection, but does not receive the message and immediately closes. 
pipes server does not see any clients.
I get errors in the file c:\ProgramData\ssh\logs\sshd-session.log

Error details

c:\ProgramData\ssh\logs\sshd-session.log (last messages with errors)

unix socket
-----------
13520 2025-01-01 07:11:11.234 debug1: server_request_direct_streamlocal: originator 127.0.0.1 port 55629, target /Users/RailWar/AppData/Local/Temp/my_unix.sock
13520 2025-01-01 07:11:11.234 debug1: connect_next: start for host /Users/RailWar/AppData/Local/Temp/my_unix.sock ([unix]:/Users/RailWar/AppData/Local/Temp/my_unix.sock)
13520 2025-01-01 07:11:11.234 debug2: fd 11 setting O_NONBLOCK
13520 2025-01-01 07:11:11.234 debug3: unable to connect to pipe /Users/RailWar/AppData/Local/Temp/my_unix.sock, error: 1920
13520 2025-01-01 07:11:11.234 debug1: connect_next: host /Users/RailWar/AppData/Local/Temp/my_unix.sock ([unix]:/Users/RailWar/AppData/Local/Temp/my_unix.sock): Unknown error
13520 2025-01-01 07:11:11.234 error: connect to /Users/RailWar/AppData/Local/Temp/my_unix.sock port -2 failed: Unknown error
13520 2025-01-01 07:11:11.234 debug1: server_input_channel_open: failure [email protected]
13520 2025-01-01 07:11:11.234 debug3: send packet: type 92

named pipe
----------
11808 2025-01-01 07:14:17.874 debug1: server_request_direct_streamlocal: originator 127.0.0.1 port 55699, target //./pipe/my_pipe
11808 2025-01-01 07:14:17.874 debug1: connect_next: start for host //./pipe/my_pipe ([unix]://./pipe/my_pipe)
11808 2025-01-01 07:14:17.874 debug2: fd 11 setting O_NONBLOCK
11808 2025-01-01 07:14:17.874 debug1: connect_next: connect host //./pipe/my_pipe ([unix]://./pipe/my_pipe) in progress, fd=11
11808 2025-01-01 07:14:17.874 debug3: fd 11 is O_NONBLOCK
11808 2025-01-01 07:14:17.874 debug3: fd 11 is O_NONBLOCK
11808 2025-01-01 07:14:17.874 debug1: channel 0: new [email protected] [direct-streamlocal] (inactive timeout: 0)
11808 2025-01-01 07:14:17.874 debug1: server_input_channel_open: confirm [email protected]
11808 2025-01-01 07:14:17.874 debug3: channel 0: waiting for connection
11808 2025-01-01 07:14:17.874 debug3: w32_getsockopt ERROR: not sock :2
11808 2025-01-01 07:14:17.874 error: getsockopt SO_ERROR failed
11808 2025-01-01 07:14:17.874 debug1: channel 0: connection failed: Not a socket
11808 2025-01-01 07:14:17.874 error: connect_to //./pipe/my_pipe port -2: failed.
11808 2025-01-01 07:14:17.874 debug3: send packet: type 92
11808 2025-01-01 07:14:17.874 debug2: channel 0: zombie
11808 2025-01-01 07:14:17.874 debug2: channel 0: garbage collecting
11808 2025-01-01 07:14:17.874 debug1: channel 0: free: direct-streamlocal, nchannels 1

Environment data

PSVersion                      5.1.22621.2506
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.2506
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version

OpenSSH_for_Windows_9.8p1 Win32-OpenSSH-GitHub, LibreSSL 3.9.2

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions