ProxyJump
"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
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?
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
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
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
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
Workaround: ProxyCommand ssh -W %h:%p jump_host will also work on Windows meanwhile.
Any idea when this will be fixed? It's very irritating to have to run a find-replace every time I copy a SSH configuration from a Linux setup.
After the 1809 update, the workaround is now also no longer working for me.
PS C:\> systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name: Microsoft Windows 10 Home
OS Version: 10.0.17763 N/A Build 17763
PS C:\> ssh myexample
CreateProcessW failed error:2
posix_spawn: No such file or directory
In my ~/.ssh/config I have this:
Host myjumphost
[...]
Host myexample
[...]
ProxyCommand ssh -W %h:%p myjumphost
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
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.
Can you try if this private works: ssh.zip
@manojampalam
Private fix works for me.
My testenvironment is 3 windows and one CentOS machines. One 2016 1607 and a Centos7 as my adminservers that I'm connecting from. One 2016 1607 as jumphost. One 2016 1607 that I'm connecting to. It's also a DC with DNS.
All windows machines are running OpenSSH_for_Windows_7.9p1
Running the command ssh -J [email protected] [email protected] with the old SSH.exe it gives the known failure. With the new ssh.exe it works as expected and I get my remote shell
Can confirm @manojampalam patched copy fixes the issue.
@manojampalam thanks for providing a workaround 🎉! However, I feel dicey to trust the authenticity of your private patched build... Can it be pushed as a PR so we can review the changes made which fix the issue?
@manojampalam I agree with @kumarharsh and am also hesitant to download and execute a binary that is not from a known trusted source. Considering it has been tested and confirmed to be working by more than one party, when can we expect a new official release to be available including this patch?
Change in PR referenced. Next release should be out towards end of Feb.
The issue persists with the build OpenSSH_for_Windows_7.9p1, LibreSSL 2.6.5
@Zetanova Correct, the patch to this has not been released yet. A link to a version with just the patch can be found earlier in the through. My builds also include the change:
https://github.com/NoMoreFood/openssh-portable/releases/tag/v7.9-merge-3
@NoMoreFood thx, but still the issue persists. it does not contain simple PR https://github.com/PowerShell/openssh-portable/pull/373 that would fix the issue.
@Zetanova I apologize, I thought that fix had been merged into master but it has not so my builds do not have it. You are correct. That said, are you seeing the private build mentioned earlier also doesn't fix the issue?