Skip to content

ProxyJump #1172

Closed
Closed

Description

@cw789

"OpenSSH for Windows" version
7.6.0.1

Client OperatingSystem
Windows 10 Pro

What is failing
If I use ProxyJump within SSH URI Usage within my config, I'll get:
Bad stdio forwarding specification ''[192.168.0.1]:22''
Seems like it is doubled escaped.

Host jump_host
  HostName 10.0.0.1
  User root

Host destination_host
  ProxyJump jump_host
  HostName 192.168.0.1
  User root

Activity

  1. manojampalam commented on Jun 4, 2018

    @manojampalam
    Contributor

    Can you add some more details on how to do this in a simple setup? Perhaps using the local sshd endpoint as a proxyjump onto itself?

  2. cw789 commented on Jun 5, 2018

    @cw789
    Author

    Of course. I've seen it generally concerns ProxyJump. So it doesn't depend on the ssh_config.

    You can reproduce it simple by running ssh -J localhost localhost.

    Output:

    Bad stdio forwarding specification ''[localhost]:22''
    ssh_exchange_identification: Connection closed by remote host
    
  3. gobbedy commented on Jun 22, 2018

    @gobbedy

    I get the same error

    I use OpenSSH_for_Windows_7.6p1, and Windows 10 Education

    ssh -J user1@jumphost user2@server

    Bad stdio forwarding specification ''[server]:22''
    ssh_exchange_identification: Connection closed by remote host

  4. TheLinuxNinja commented on Oct 10, 2018

    @TheLinuxNinja

    Just decided to try the native ssh in Windows 10 - and found this bug immediately. I can't access anything since the ProxyJump is required to specify the bastion to jump through. How can I help troubleshoot this?

    Windows 10 Enterprise 1803 Build 17134.320
    OpenSSH_for_Windows_7.6p1, LibreSSL 2.6.4

  5. oscarvdl commented on Dec 21, 2018

    @oscarvdl

    Have the same issue on Microsoft Windows [Version 10.0.17134.471]

    Bad stdio forwarding specification ''[example.com]:22''
    ssh_exchange_identification: Connection closed by remote host

  6. cw789 commented on Dec 22, 2018

    @cw789
    Author

    Workaround: ProxyCommand ssh -W %h:%p jump_host will also work on Windows meanwhile.

  7. tats-u commented on Jan 18, 2019

    @tats-u

    I'm bothered by this issue. (10 Pro 1809)

    PS C:\Users\tatsu> ssh -vvv lab-dpc-tun
    OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
    debug1: Reading configuration data C:\\Users\\tatsu/.ssh/config
    debug1: C:\\Users\\tatsu/.ssh/config line 65: Applying options for lab-*-tun
    debug1: C:\\Users\\tatsu/.ssh/config line 68: Applying options for lab-dpc-tun
    debug1: C:\\Users\\tatsu/.ssh/config line 70: Applying options for lab-*
    debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
    debug2: resolve_canonicalize: hostname 192.168.10.2 is address
    debug1: Setting implicit ProxyCommand from ProxyJump: ssh -vvv -W '[%h]:%p' lab-dns
    debug1: Executing proxy command: exec ssh -vvv -W '[192.168.10.2]:22' lab-dns
    debug3: spawning "C:\\WINDOWS\\System32\\OpenSSH\\ssh -vvv -W '[192.168.10.2]:22' lab-dns"
    CreateProcessW failed error:2
    posix_spawn: No such file or directory
    

    Latest OpenSSH:

    PS C:\Users\tatsu> scoop install win32-openssh
    Installing 'win32-openssh' (7.9.0.0p1-Beta) [64bit]
    Loading OpenSSH-Win64.zip from cache
    Checking hash of OpenSSH-Win64.zip ... ok.
    Extracting OpenSSH-Win64.zip ... done.
    Linking ~\scoop\apps\win32-openssh\current => ~\scoop\apps\win32-openssh\7.9.0.0p1-Beta
    Creating shim for 'scp'.
    Creating shim for 'sftp'.
    Creating shim for 'sftp-server'.
    Creating shim for 'ssh-add'.
    Creating shim for 'ssh-agent'.
    Creating shim for 'ssh-keygen'.
    Creating shim for 'ssh-keyscan'.
    Creating shim for 'ssh-shellhost'.
    Creating shim for 'ssh'.
    Creating shim for 'sshd'.
    'win32-openssh' (7.9.0.0p1-Beta) was installed successfully!
    Notes
    -----
    This is a pre-release (non-production ready)
    Run 'sudo C:\Users\tatsu\scoop\apps\win32-openssh\current\install-sshd.ps1' to install sshd and ssh-agent as a service.
    Run 'sudo C:\Users\tatsu\scoop\apps\win32-openssh\current\uninstall-sshd.ps1' them service.
    PS C:\Users\tatsu> C:\Users\tatsu\scoop\apps\win32-openssh\7.9.0.0p1-Beta\ssh.exe -vvv lab-dpc-tun
    OpenSSH_for_Windows_7.9p1, LibreSSL 2.6.5
    debug1: Reading configuration data C:\\Users\\tatsu/.ssh/config
    debug1: C:\\Users\\tatsu/.ssh/config line 65: Applying options for lab-*-tun
    debug1: C:\\Users\\tatsu/.ssh/config line 68: Applying options for lab-dpc-tun
    debug1: C:\\Users\\tatsu/.ssh/config line 70: Applying options for lab-*
    debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
    debug2: resolve_canonicalize: hostname 192.168.10.2 is address
    debug1: Setting implicit ProxyCommand from ProxyJump: C:\\Users\\tatsu\\scoop\\apps\\win32-openssh\\7.9.0.0p1-Beta\\ssh.exe -vvv -W '[%h]:%p' lab-dns
    debug1: Executing proxy command: exec C:\\Users\\tatsu\\scoop\\apps\\win32-openssh\\7.9.0.0p1-Beta\\ssh.exe -vvv -W '[192.168.10.2]:22' lab-dns
    debug3: spawning "C:\\Users\\tatsu\\scoop\\apps\\win32-openssh\\7.9.0.0p1-Beta\\ssh.exe -vvv -W '[192.168.10.2]:22' lab-dns"
    debug3: spawning C:\\Users\\tatsu\\scoop\\apps\\win32-openssh\\7.9.0.0p1-Beta\\ssh.exe -vvv -W '[192.168.10.2]:22' lab-dns
    debug3: w32_getpeername ERROR: not sock :2
    debug1: identity file C:\\Users\\tatsu/.ssh/id_ed25519_lab type 3
    debug3: Failed to open file:C:/Users/tatsu/.ssh/id_ed25519_lab-cert error:2
    debug3: Failed to open file:C:/Users/tatsu/.ssh/id_ed25519_lab-cert.pub error:2
    debug1: identity file C:\\Users\\tatsu/.ssh/id_ed25519_lab-cert type -1
    debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.9
    Bad stdio forwarding specification ''[192.168.10.2]:22''
    ssh_exchange_identification: Connection closed by remote host
    

    Without using jump host (successfully connected):

    PS C:\Users\tatsu> .\scoop\apps\win32-openssh\7.9.0.0p1-Beta\ssh.exe -vvv lab-dpc -N
    OpenSSH_for_Windows_7.9p1, LibreSSL 2.6.5
    debug1: Reading configuration data C:\\Users\\tatsu/.ssh/config
    debug1: C:\\Users\\tatsu/.ssh/config line 51: Applying options for lab-dpc
    debug1: C:\\Users\\tatsu/.ssh/config line 70: Applying options for lab-*
    debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
    debug2: resolve_canonicalize: hostname 192.168.10.2 is address
    debug2: ssh_connect_direct
    debug1: Connecting to 192.168.10.2 [192.168.10.2] port 22.
    debug1: Connection established.
    debug1: identity file C:\\Users\\tatsu/.ssh/id_ed25519_lab type 3
    debug3: Failed to open file:C:/Users/tatsu/.ssh/id_ed25519_lab-cert error:2
    debug3: Failed to open file:C:/Users/tatsu/.ssh/id_ed25519_lab-cert.pub error:2
    debug1: identity file C:\\Users\\tatsu/.ssh/id_ed25519_lab-cert type -1
    debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.9
    debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6p1 Ubuntu-4ubuntu0.1
    debug1: match: OpenSSH_7.6p1 Ubuntu-4ubuntu0.1 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
    debug2: fd 3 setting O_NONBLOCK
    debug1: Authenticating to 192.168.10.2:22 as 'tatsu16'
    debug3: hostkeys_foreach: reading file "C:\\Users\\tatsu/.ssh/known_hosts"
    debug3: record_hostkey: found key type ECDSA in file C:\\Users\\tatsu/.ssh/known_hosts:16
    debug3: load_hostkeys: loaded 1 keys from 192.168.10.2
    debug3: Failed to open file:C:/Users/tatsu/.ssh/known_hosts2 error:2
    debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts error:2
    debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts2 error:2
    debug3: order_hostkeyalgs: prefer hostkeyalgs: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
    debug3: send packet: type 20
    debug1: SSH2_MSG_KEXINIT sent
    debug3: receive packet: type 20
    debug1: SSH2_MSG_KEXINIT received
    debug2: local client KEXINIT proposal
    debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
    debug2: host key algorithms: [email protected],[email protected],[email protected],ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],[email protected],[email protected],ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
    debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
    debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
    debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
    debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
    debug2: compression ctos: none
    debug2: compression stoc: none
    debug2: languages ctos:
    debug2: languages stoc:
    debug2: first_kex_follows 0
    debug2: reserved 0
    debug2: peer server KEXINIT proposal
    debug2: KEX algorithms: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
    debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
    debug2: ciphers ctos: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
    debug2: ciphers stoc: [email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]
    debug2: MACs ctos: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
    debug2: MACs stoc: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1
    debug2: compression ctos: none,[email protected]
    debug2: compression stoc: none,[email protected]
    debug2: languages ctos:
    debug2: languages stoc:
    debug2: first_kex_follows 0
    debug2: reserved 0
    debug1: kex: algorithm: curve25519-sha256
    debug1: kex: host key algorithm: ecdsa-sha2-nistp256
    debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
    debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
    debug3: send packet: type 30
    debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
    debug3: receive packet: type 31
    debug1: Server host key: ecdsa-sha2-nistp256 SHA256:[Host key]
    debug3: hostkeys_foreach: reading file "C:\\Users\\tatsu/.ssh/known_hosts"
    debug3: record_hostkey: found key type ECDSA in file C:\\Users\\tatsu/.ssh/known_hosts:16
    debug3: load_hostkeys: loaded 1 keys from 192.168.10.2
    debug3: Failed to open file:C:/Users/tatsu/.ssh/known_hosts2 error:2
    debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts error:2
    debug3: Failed to open file:C:/ProgramData/ssh/ssh_known_hosts2 error:2
    debug1: Host '192.168.10.2' is known and matches the ECDSA host key.
    debug1: Found key in C:\\Users\\tatsu/.ssh/known_hosts:16
    debug3: send packet: type 21
    debug2: set_newkeys: mode 1
    debug1: rekey after 134217728 blocks
    debug1: SSH2_MSG_NEWKEYS sent
    debug1: expecting SSH2_MSG_NEWKEYS
    debug3: receive packet: type 21
    debug1: SSH2_MSG_NEWKEYS received
    debug2: set_newkeys: mode 0
    debug1: rekey after 134217728 blocks
    debug3: unable to connect to pipe \\\\.\\pipe\\openssh-ssh-agent, error: 2
    debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
    debug1: Will attempt key: C:\\Users\\tatsu/.ssh/id_ed25519_lab ED25519 SHA256:[My key] explicit
    debug2: pubkey_prepare: done
    debug3: send packet: type 5
    debug3: receive packet: type 7
    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>
    debug3: receive packet: type 6
    debug2: service_accept: ssh-userauth
    debug1: SSH2_MSG_SERVICE_ACCEPT received
    debug3: send packet: type 50
    debug3: receive packet: type 51
    debug1: Authentications that can continue: publickey,password
    debug3: start over, passed a different list publickey,password
    debug3: preferred publickey,keyboard-interactive,password
    debug3: authmethod_lookup publickey
    debug3: remaining preferred: keyboard-interactive,password
    debug3: authmethod_is_enabled publickey
    debug1: Next authentication method: publickey
    debug1: Offering public key: C:\\Users\\tatsu/.ssh/id_ed25519_lab ED25519 SHA256:[My key] explicit
    debug3: send packet: type 50
    debug2: we sent a publickey packet, wait for reply
    debug3: receive packet: type 60
    debug1: Server accepts key: C:\\Users\\tatsu/.ssh/id_ed25519_lab ED25519 SHA256:[My key] explicit
    debug3: sign_and_send_pubkey: ED25519 SHA256:[My key]
    debug3: sign_and_send_pubkey: signing using ssh-ed25519
    debug3: send packet: type 50
    debug3: receive packet: type 52
    debug1: Authentication succeeded (publickey).
    Authenticated to 192.168.10.2 ([192.168.10.2]:22).
    debug2: fd 3 setting TCP_NODELAY
    debug1: Requesting [email protected]
    debug3: send packet: type 80
    debug1: Entering interactive session.
    debug1: pledge: network
    debug3: receive packet: type 80
    debug1: client_input_global_request: rtype [email protected] want_reply 0
    
  8. jaketyo commented on Jan 21, 2019

    @jaketyo

    I am also suffering from this issue. Does anyone have an update?

    PS C:\WINDOWS\system32>  ssh -v HOSTNAME
    OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
    debug1: Reading configuration data __PROGRAMDATA__\\ssh/ssh_config
    debug1: __PROGRAMDATA__\\ssh/ssh_config line 1: Applying options for *
    debug1: __PROGRAMDATA__\\ssh/ssh_config line 15: Applying options for artifacts
    debug1: Executing proxy command: exec ssh BASTION_HOST -W HOSTNAME:22
    CreateProcessW failed error:2
    posix_spawn: No such file or directory
    

    I redacted the hostnames. However, they are correct.

  9. 24 remaining items

  10. manojampalam commented on Jul 11, 2019

    @manojampalam
    Contributor

    This was fixed as part of #1185. Try v7.9 or later

  11. quoniammm commented on Oct 19, 2019

    @quoniammm

    I use this config on my windows 10 machine.it is successful!!!!!!!

    Host jump
        HostName xxx
        User xxx
        Port xxx
    
    Host your_machine
        HostName xxxx
        User xxx
        ProxyCommand c:/Windows\System32\OpenSSH/ssh.exe jump -W %h:%p
  12. vrastil commented on Oct 30, 2019

    @vrastil

    I use this config on my windows 10 machine.it is successful!!!!!!!

    Host jump
        HostName xxx
        User xxx
        Port xxx
    
    Host your_machine
        HostName xxxx
        User xxx
        ProxyCommand c:/Windows\System32\OpenSSH/ssh.exe jump -W %h:%p

    Works! For me the ProxyCommand could use only generic ssh executable instead of specifying exact path:

    ProxyCommand ssh jump -W %h:%p
  13. niklasholm commented on Mar 16, 2020

    @niklasholm

    Pretty embarrassing that a simple issue such as this that was patched over a year ago hasn't made it to release yet. This is why people dislike Windows so much.

  14. tats-u commented on Mar 16, 2020

    @tats-u

    Niklas Holm (@niklasholm)
    Try choco instal openssh. (Install via Chocolatey) Version 8.0 is available.
    The pre-installed version in Windows is too late to be updated.

  15. ttimasdf commented on Apr 5, 2020

    @ttimasdf

    I use this config on my windows 10 machine.it is successful!!!!!!!

    Host jump
        HostName xxx
        User xxx
        Port xxx
    
    Host your_machine
        HostName xxxx
        User xxx
        ProxyCommand c:/Windows\System32\OpenSSH/ssh.exe jump -W %h:%p

    It works. But it hardcoded the ssh command as well as parameters. If I want to refer ssh_config from other locations like ssh -F C:/my/wsl/distribution/ssh_config, (cases when using VSCode Remote) I'll need to write everything inside ProxyCommand string as well. In the contrary, ProxyJump could build the command line automatically, but as said in this issue, it didn't add ssh.exe executable path correctly.

  16. filviu commented on Apr 7, 2020

    @filviu

    Windows 1909 and this still doesn't work. Full path is not an option as I use this config file inside wsl as well.

  17. pd93 commented on Apr 7, 2020

    @pd93

    @silviuvulcan If you can't wait for this to be released into Windows (I know I couldn't), you could always patch it yourself.

  18. DiamondDemon669 commented on Jun 23, 2020

    @DiamondDemon669

    same issue

  19. Cuberick-Orion commented on Dec 23, 2020

    @Cuberick-Orion

    I'm on 20H2 and the issue persists. Can confirm that the full-path workaround is effective.

    Took me a long time to figure this out...

  20. sgugler commented on Dec 23, 2020

    @sgugler

    I use this config on my windows 10 machine.it is successful!!!!!!!

    Host jump
        HostName xxx
        User xxx
        Port xxx
    
    Host your_machine
        HostName xxxx
        User xxx
        ProxyCommand c:/Windows\System32\OpenSSH/ssh.exe jump -W %h:%p

    Works! For me the ProxyCommand could use only generic ssh executable instead of specifying exact path:

    ProxyCommand ssh jump -W %h:%p

    Both worked for me; took me a day to solve that issue. Since it wasn't patched since a while, the paper trail on the web is pretty long, which doesn't make debugging easier.

  21. alshdavid commented on Feb 1, 2021

    @alshdavid

    Updating to the latest beta version on the releases page fixed it for me. I am running version OpenSSH_for_Windows_8.1p1, LibreSSL 2.9.2.

    I assume we have to wait for Windows to update via Windows update. I recommend managing the version yourself.

    You can also use Choco to install via command line

  22. pd93 commented on Feb 3, 2021

    @pd93

    I assume we have to wait for Windows to update via Windows update

    David Alsh (@alshdavid) The omission of an up-to-date version of OpenSSH in the latest Windows 10 release was addressed by Microsoft in #1693. You can track this problem there.

    I'm hoping that they will add it via a servicing update, but no news yet.

  23. wangwanjie commented on Jun 18, 2022

    @wangwanjie

    I use this config on my windows 10 machine.it is successful!!!!!!!

    Host jump
        HostName xxx
        User xxx
        Port xxx
    
    Host your_machine
        HostName xxxx
        User xxx
        ProxyCommand c:/Windows\System32\OpenSSH/ssh.exe jump -W %h:%p

    Works! For me the ProxyCommand could use only generic ssh executable instead of specifying exact path:

    ProxyCommand ssh jump -W %h:%p

    Both worked for me; took me a day to solve that issue. Since it wasn't patched since a while, the paper trail on the web is pretty long, which doesn't make debugging easier.

    感谢回复答案,你解决了我的问题。但答案不严谨, ssh 的绝对路径每个人的不同,可以先运行 where ssh 查看,再替换

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions