Search code examples
visual-studio-codevscode-remote-sshcyber-ark

VS Code remote-ssh connection via CyberArk not working


I am using VS Code and remote-ssh extension to manage files on remote servers. VS Code is on my Windows 10, same Laptop is used for both scenarios explained below.

What works:

  • No problems when using VSC and remote-ssh and connecting directly to remote Linux server running REHL 7,8 and 9. By direct connection I mean, no CyberArk involvement.

What does not work:

  • I am unable to set up vscode-server for remote-ssh on target host (same hosts as in scenario 1 above) when the connection is proxied via CyberArk.
  • I have tried most if not all of the tricks other posts suggest... kill the remote ssh server, no help.
  • I have removed the .vscode-server directory from remote server and tried to connect again, no help.
  • I have installed vscode-server manually as suggested here I have installed vscode-server based on the commit I have found in my logs, which is... https://update.code.visualstudio.com/commit:863d2581ecda6849923a2118d93a088b0745d9d6/server-linux-x64/stable It seems that after this install, VSC on my laptop still tries to install the vscode-server on the remote host.
  • Also, absolute path for my ssh config has been set as per the suggestion here, no help.
  • We have also added SCP connector to CyberArk, no help.

Below are the logs from VS code after attempting to connect to one of the servers via CyberArk. Not all the logs are shown for security reasons. The error message is identical each time I attempt to connect to the remote server.

  • yes, ssh is actually established from my Windows machine to remote server via VSC remote-ssh extension.
  • on the remote server I can see .vscode-server directory is created after successful login but it IS EMPTY.
  • Based on the logs below, I am assuming some script is ran which contain Windows-style line-end characters?
[22:10:30.538] > cb7fa75ea92b: running
[22:10:30.569] > bash: line 178: syntax error: unexpected end of file
[22:10:31.895] "install" terminal command done
[22:10:31.896] Install terminal quit with output: bash: line 178: syntax error: unexpected end of file
[22:10:31.896] Received install output: bash: line 178: syntax error: unexpected end of file
[22:10:31.896] Failed to parse remote port from server output
[22:10:31.898] Resolver error: Error: 
    at g.Create (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.109.0\out\extension.js:2:499734)
    at t.handleInstallOutput (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.109.0\out\extension.js:2:497056)
    at t.tryInstall (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.109.0\out\extension.js:2:620589)
    at async c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.109.0\out\extension.js:2:580447
    at async t.withShowDetailsEvent (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.109.0\out\extension.js:2:583753)
    at async k (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.109.0\out\extension.js:2:577412)
    at async t.resolve (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.109.0\out\extension.js:2:581124)
    at async c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.109.0\out\extension.js:2:847283
[22:10:31.905]

Solution

  • There is a feature request in the backlog:

    https://github.com/microsoft/vscode-remote-release/issues/5906