Skip to content

Can't connect through jumpbox #18

Closed

Description

@Stephen9s

Some users may leverage ~/.ssh/config to set up ProxyJump and ProxyCommands to get to their endpoints. Currently, it appears that VSCode Remote only supports a direct connection.

Activity

  1. added
    feature-request
    ssh
    on May 2, 2019
  2. tralston commented on May 3, 2019

    @tralston

    I'm able to connect to a JumpHost endpoint. Mine are configured in my config file. The only thing I had to do was copy my SSH key to the remote endpoint (and jump hosts). For example, if my config was:
    local -> jump1 -> jump2 -> server
    Then I'd have to run "ssh-copy-id" for jump1, then for jump2, then for server. After that, VSCode connected just fine.

  3. Stephen9s commented on May 3, 2019

    @Stephen9s
    Author

    I am able to do the same, but what I found was that I could do the following:

    local -> server = OK
    local -> jump1 -> server = able to authenticate, but unable to connect.

    I do know that when VSC connects to the remote server, it attempts to install or run a service. My suspicion is that by jumping through from X to Y to Z, the service ends up installing on Y and not X. Perhaps maybe there’s a better way to pivot using JumpHost as you said rather than ProxyCommand.

    I’ll give ProxyJump a shot.

  4. tralston commented on May 3, 2019

    @tralston

    @TheStoof for what it's worth, here's an excerpt from my config file (sanitized):

    host jump1-alias
      HostName jump1
      User myUser
      Port 2202
    
    host server-alias
      HostName server
      User myUser
      Port 2202
      ProxyCommand ssh -W %h:%p jump1-alias
    
  5. tralston commented on May 3, 2019

    @tralston

    @TheStoof I just attempted the same connection, but from a Windows 10 machine with WSL, and it didn't work (same problem as #34). It did work though from my Mac.

  6. msalvaris commented on May 7, 2019

    @msalvaris

    Yea, tried various options and nothing succesful to far. I was able to connect once by creating a tunnel in WSL and pointing the Hostname and Port to the tunnel but wasn't able to repeat.

  7. pd93 commented on May 9, 2019

    @pd93

    Ran into this issue while trialing Remote SSH as an alternative to local development. Connecting from a Windows 10 machine to a remote box works, but only when connecting directly. We cannot connect to any hosts via a jumpbox. In other words:

    • local -> jumpbox works
    • local -> jumpbox -> remote doesn't work

    Here's my (sanitized) config:

    Host jumpbox
        HostName    12.34.56.78
        Port        22
        User        user
    
    Host remote
        Hostname    172.16.0.1
        Port        22
        User        user
        ProxyJump   jumpbox

    There is no way for us to SSH into a remote machine without tunneling through a jumpbox, so this functionality it absolutely necessary for us to use Remote - SSH.

  8. LeuisKen commented on May 10, 2019

    @LeuisKen

    I'm trying to solve this issue by writing a new RemoteAuthorityResolver, which the Remote SSH and Remote Container based on. But there is no document about this API...

  9. suanrong commented on May 20, 2019

    @suanrong

    Anyone solve this issue?

  10. msalvaris commented on May 20, 2019

    @msalvaris

    xuanrong yao (@suanrong)

    Anyone solve this issue?

    I was able to overcome the issue by using this method
    #117

    I create the proxy in wsl and simply make sure that my ssh config points to localhost and the correct port.

  11. pd93 commented on May 30, 2019

    @pd93

    I decided to try SSHing (with the same config as above) to my remote boxes via Powershell today. This should use the same version of SSH as the Remote - SSH extension (rather than the WSL version of SSH).

    Unsurprisingly, I got exactly the same result, but a better error message

    • local -> jumpbox works
    • local -> jumpbox -> remote fails with the error:
    CreateProcessW failed error:2
    posix_spawn: No such file or directory
    

    A quick search of the error found PowerShell/Win32-OpenSSH#1185.
    Not 100% sure if related, but that issue was fixed in Jan which implies that if that issue is the problem, this would be fixed in 1903. Unfortunately, we're still on 1809 at work, so I can't test.

    A bit more searching also found PowerShell/Win32-OpenSSH#1172. This issue seems more relevant than 1185, but is still open 😢

  12. changed the title [-]Offer ability to tunnel through to endpoint[/-] [+]Can't connect through jumpbox[/+] on May 30, 2019
  13. axiqia commented on May 31, 2019

    @axiqia

    I have copyed my SSH key to the remote endpoint and jump hosts as Taylor Ralston (@tralston) suggested. But I still met the issue like Pete Davison (@pd93) . I added more information.

    My config:

    Host jumpbox
        HostName example.edu.cn
        User U
        Port xxx
        IdentityFile xxx.id_rsa
    
    
    Host remote
        HostName remote
        User U
        Port xx
        ProxyCommand ssh -q -W %h:%p jumpbox
    

    On Git Bash(windows)

    $ ssh -V                                                                         
    OpenSSH_7.9p1, OpenSSL 1.1.1a  20 Nov 2018
    
    • local -> jumpbox works
    ssh jumpbox
    
    • local -> jumpbox -> remote works
    ssh remote
    

    On Powershell:

    ssh -V
    OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
    
    • local -> jumpbox works
    ssh jumpbox
    
    • local -> jumpbox -> remote fails with the error:
    ssh remote
    CreateProcessW failed error:2
    posix_spawn: No such file or directory
    

    On VS Code:

    • local -> jumpbox works
    • local -> jumpbox -> remote fails with the error:
    Picking SSH host
    Selected remote
    Confirming that remote is a valid reachable host
    Running type "C:\Users\xxx\AppData\Local\Temp\vscode-linux-multi-line-command-remote.sh" | ssh  "remote" bash to confirm the host platform
    > 
    > CreateProcessW failed error:2
    > posix_spawn: No such file or directory
    > 
    "uname" terminal command done
    remote: unreachable or not Linux x86_64. (posix_spawn: No such file or directory)
    
  14. johnymachine commented on Jun 7, 2019

    @johnymachine

    Maybe this could help:

    ProxyCommand C:\Windows\System32\OpenSSH\ssh.exe jumphost netcat -w 120 %h %p

    https://serverfault.com/questions/956613/windows-10-ssh-proxycommand-posix-spawn-no-such-file-or-directory

    It worked as expected on Windows 10 1809 but there is probably bug in 1903 and this worked for me.

  15. 32 remaining items

  16. eromoe commented on Jun 1, 2020

    @eromoe

    I patched windows 10 before.
    After upgrading to Windows 10 2004(20H1) .

    C:\Users\xxxx>ssh -vvv dc42
    OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
    debug1: Reading configuration data C:\\Users\\xxxx/.ssh/config
    debug1: C:\\Users\\xxxx/.ssh/config line 1: Applying options for *
    debug1: C:\\Users\\xxxx/.ssh/config line 152: Applying options for dc42
    debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
    debug1: Executing proxy command: exec ssh dc_entry -W dc42:22
    debug3: spawning "C:\\Windows\\System32\\OpenSSH\\ssh dc_entry -W dc42:22"
    CreateProcessW failed error:2
    posix_spawn: No such file or directory
    

    Is this a new but or not ?

  17. pd93 commented on Jun 1, 2020

    @pd93

    eromoe Unfortunately, that's still version 7.7 which does not contain the fix. You'll need to manually update to v8.0+ or use one of the other workarounds mentioned above.

    It has been confirmed in another issue that v8.1 will be released in an update later this year, but is not included in Windows 10 2004 (20H1):

    v8.1 goes into the next release (not into win10 version 2004) available during fall time.

  18. anji993 commented on Jun 7, 2020

    @anji993

    eromoe Pete Davison (@pd93) Did you solve the problem after upgrading to Windows 10 2004 by patching it again. I meet the same problem after I upgrade to Windows 10 2004. But patching manually updating to v8.0+ does not solve this problem.

  19. eromoe commented on Jun 8, 2020

    @eromoe

    anji993 Patching does sovle my problem , may be something wrong with previllage ?

  20. susguzman commented on Jun 17, 2020

    @susguzman

    For me worked the following: [on Win10, w/ w/o WSL]

    As for my ssh-key login:
    For both hosts, I needed to specify my id_rsa_vscode file. That I needed to do regardless of proxying or not.

    Host *
       IdentityFile C:\Users\<username>\.ssh\id_rsa_vscode
    
    [...]
    

    And I needed to copy my keys with ssh-copy-id to the remote hosts. I also needed to specify -f because I used different id_rsa files for normal ssh login in WSL and for VSCode, and without -f it would not copy the second VSCode ssh key. (That was neccessary because VSCode could not work with ssh-agent or password protected ssh identity files - as far as I know - without always typing the remote ssh passwords on each (re-)connect.)

    It worked for me :)
    Thank you

  21. nicolaipre commented on Sep 15, 2020

    @nicolaipre

    FWIW: For anyone wanting password authentication only, this config works on Linux for jump-hosts:

    Host <alias>
        HostName <hostname/ip-addr>
        Port 22
        User <user>
        ProxyCommand ssh -W %h:%p -q <user>@<jump-host-ip>
    
  22. tysonite commented on Oct 24, 2020

    @tysonite

    Have anyone seen #3857 that with jump server too?

  23. pd93 commented on Oct 29, 2020

    @pd93

    A quick update for anyone following this issue. MSFT currently have a pinned issue explaining why OpenSSH was not included in the 20H2 release. I've updated my workaround comment above to reflect this.

  24. plevold commented on Dec 11, 2020

    @plevold

    The manual fix by Pete Davison (@pd93) worked like a charm for me, but a Windows update seems to have overwritten the updated ssh.exe. Rather than potentially having to replace the executable after future updates I simply extracted the zip to a different location and added it to the systems PATH. My steps:

    • Download OpenSSH v8.1.0.0 .zip
    • Extract to a suitable location, e.g. C:\bin\OpenSSH-Win64
    • Open Edit the system environmental variables (found in the control panel or start menu)
    • Edit the Path variable and add C:\bin\OpenSSH-Win64
    • Make sure that the new entry is above the entry %SYSTEMROOT%\System32\OpenSSH\
    • Restart VSCode

    Note that I had to edit PATH for the whole system, not my user. In the latter case the entry will be added after the system version giving it precedence.

    Beware that sometime in the future this solution could cause problems if the system OpenSSH version is updated to a more recent version than the manually installed one...

  25. matijagrcic commented on Dec 15, 2020

    @matijagrcic

    Manual Fix

    • Download the v8.1.0.0 release .zip.
    • Extract the .zip file
    • Copy and replace the extracted ssh.exe binary into your C:\Windows\System32\OpenSSH folder.
    • Done! You can now use "Remote Development - SSH" with ProxyJump in the expected way.

    If you get a permissions error then this may be because there is system protection in place on the existing ssh.exe binary. This can be removed by setting yourself as the owner of the file (requires admin) and granting yourself "full control". To do this, follow these steps:

    • Right-click on the existing file C:/Windows/System32/OpenSSH/ssh.exe and select Properties.
    • Open the Security tab and click on Advanced.
    • Click the button to change the owner and change it from TrustedOwner to your Windows username.
    • Type your username and click the Check Names button (This should autofill with your full username/email).
    • Apply the settings and then close the properties window and reopen it.
    • Navigate back to the Security tab and click on Edit.
    • Select the Users group and give the group Full Control.
    • Click Apply and exit.
    • Now go back and try patching the file again.

    Worked without any issues. I've used MobaXterm for a long time to first setup the tunnel and then just connect to the destination, but now it's not needed anymore with ProxyJump working correctly.

  26. AdorableYoyo commented on Aug 16, 2021

    @AdorableYoyo

    For me worked the following: [on Win10, w/ w/o WSL]

    As for my ssh-key login:
    For both hosts, I needed to specify my id_rsa_vscode file. That I needed to do regardless of proxying or not.

    Host *
       IdentityFile C:\Users\<username>\.ssh\id_rsa_vscode
    
    [...]
    

    And I needed to copy my keys with ssh-copy-id to the remote hosts. I also needed to specify -f because I used different id_rsa files for normal ssh login in WSL and for VSCode, and without -f it would not copy the second VSCode ssh key. (That was neccessary because VSCode could not work with ssh-agent or password protected ssh identity files - as far as I know - without always typing the remote ssh passwords on each (re-)connect.)

    life saving!!! I had to log in to appreciate your share! Got mine solved! thanks!

  27. pd93 commented on Aug 16, 2021

    @pd93

    roblourens I believe this can be closed now. This was never a VSCode issue and it should now be resolved anyway as a newer (and working) version of OpenSSH is now included in the latest version of Windows.

    Anyone on older versions of Windows (and therefore OpenSSH) can follow the manual steps I outlined earlier in this issue in order to update.

  28. roblourens commented on Aug 23, 2021

    @roblourens
    Member

    Thanks for pointing that out Pete Davison (@pd93)

  29. locked and limited conversation to collaborators on Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestsshupstreamwindows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions