How do I access server through CyberArk using VS Code Remote-SSH when asked for password which is managed by CyberArk?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How do I access server through CyberArk using VS Code Remote-SSH when asked for password which is managed by CyberArk?

L1 Bithead

We have a CyberArk setup in which I can open an port-forwarding SSH tunnel to successfully access e.g. a http-server exposed on a port of the remote server, through CyberArk.

My CyberArk access is through an ssh key, daily downloaded from Privilege Cloud.

 

I am now trying to connect VS Code to the server, as it is meant for development. I have followed the CyberArk guide: https://community.cyberark.com/s/article/VSCode-remote-workspaces-with-PSM-for-SSH-proxy

  • Without this access, the development server is useless to our data scientists.

 

When I try to `SSH-Remote: Connect to host` in VS Code, I am asked for a password.

 

It is not the password for the CyberArk openssh key (I've tried that). From the team that setup CyberArk, I know that I should rely on using my on-server-user's password for anything, as it is handled and cycled by CyberArk -- so I don't even know what it is. I can change it, but shouldn't, as it must be in sync with some runningly generated by CyberArk, as far as I understand.

 

  • Have any of you succeeded in connecting VS Code to a dev server through CyberArk?
  • When I can open an ssh tunnel successfully, what steps is the documentation missing for me to connect? Or have I perhaps misunderstood something?

 

I'll gladly provide additional details of what I've tried.

 

*Moderator edit: fixed link.

11 REPLIES 11

L5 Sessionator

Yes you will be asked the password what you use to login in PVWA console. I have done setup and this is how it works. If you have Radius, then auth setup then it will prompt you for MFA codes too.

L1 Bithead

Thank you for replying, @sanjay sah​ !

The PVWA console, it that something I can be sure every user has access to?

I access Privilege Cloud with https://our_thing.cyberark.cloud/privilegecloud/ but https://our_thing.cyberark.cloud/passwordvault/ leads to 404: Page Missing.

Every users will have access to PVWA console but not as an admin. Hence, as an admin you have to set some configuration in PVWA Console too.

 

For 404 Error. Open support case with Cyberark since you are using Pcloud Product not self hosted.

@sanjay sah​ ,

Ok. But I'm not a CyberArk admin, so I can't set stuff up. I'm just a developer trying to get my team's standard workflow with VS Code up and running.

 

Is there any way to connect with VS Code Remote-SSH by only using a CyberArk ssh key? The CyberArk admins have told me that I ever have to use my server password, then I'm doing it wrong.

 

I'll ask around for the PVWA access -- I don't have access to open a case with CyberArk support.

You can generate SSH keys from CyberArk under your own profile and give a try to login in target machine as in our environment everyone uses ssh keys which has particular expiry duration. However, To work with VS Code Remote-SSH it may not work because configuration requires in both Cyberark side as well as client side local machine's Visual studio code and in .ssh folder.

L1 Bithead

@sanjay sah​ , Thanks. I have SSH key access to our servers set up, and can open a local ssh tunnel to an http-server exposed on an open port on the server.

 

Can you tell me what combination Cyberark and local configurations work?

No. Do you have someone who is from Cyberark Admin groups? They can introduce you to about MFA Caching options related to Cyberark. You have to use that keys generated from Cyberark in order to connect to the target using Cyberark PSMP-SSH proxy. I am not talking talking about the keys which you have from Target servers.

 

To answer your question -- What combinations of Cyberark and local configuration works for VSCode WorkSpace?

 

Answer -- The articles you have pasted to configure VSCode Remote workspace are 80% of work related to Cyberark Admins and just rest are yours to do in your .ssh folder and vscode and that's all. Hence, it will work.

L1 Bithead

@sanjay sah​ Again, thank you. I was already referring to a ssh generated with PSM for SSH MFA Caching; with such a key, I can open a tunnel to the development server using the Cyberark PSMP-SSH proxy with a command with syntax like:

 

ssh -i ~/.ssh/key.openssh -L 5008:127.0.0.1:55555 username@our_thing.com@username_on_server@server#22#56001@our_thing.com

 

That works, the tunnel opens, and if I expose a http-server on 56001, I can access that from my local machine.

 

But I'm missing the last 20%: the configuration to get VSCode to connect to the same server, using the ports in a similar way.

 

I've gotten to the point where VSCode can start a vscode-server on the server on port 56002, but "netstat -tunl" shows me that where the http-server will listen on 0.0.0.0:56001, the vscode-server tunnel listens on 127.0.0.1:56002, resulting in a "channel 2: open failed: connect failed: Connection refused" error.

 

Could you please explicitly help me with the last 20% relating to my .ssh folder and the vscode settings? An example of a configuration combination that works?

 

 

20% of the configuration are as follows:

You can try like this in your case. Creating one config file under .ssh file in your windows workstation.

 

Host Research-Developer-VM HostName <PSMPLBAddress> User +user.email@our_thing.com@username_on_server@server#22#56001@our_thing.com+fp+5008+fp+55555

After that do these in VS Code and try.

Edit the VS Code user settings JSON file to add the SSH configuration. It is easily accessed from the VS Code editor by pressing Ctrl+Shift+P and typing Preferences: Open User Settings (JSON). 

"remote.SSH.serverPickPortsFromRange": { "Research-Developer-VM": "5008-55555", }, "remote.SSH.remotePlatform": { "Research-Developer-VM": "linux" },

Lets try how it goes.

Connection Part:

press Ctrl+Shift+P then search for Remote-SSH: Connect to Host…​ (you could also choose Remote-SSH: Connect Current Window to Host…​). Next, select the Research-Developer-VM host. When the notification window pops up that says "Setting up SSH Host Research-Env-VM", click on the "details" link. 

L1 Bithead

@sanjay sah​ ,

This .ssh config setup doesn't work. Previously, I've needed to supply it with an IdentityFile argument so it knows I want to use the ssh key for access.

 

Have you yourself succeeded in getting VSCode Remote-SSH up and running with a Cyberark PSM SSH key? If so, can you share the configuration you have tested and know to work?

Our all users uses ssh keys but researcher who uses vscode workspace do not use ssh key to get into over there and hence, I myself have not tested however you could test poinint key file in that config file

  • 285 Views
  • 11 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!