VSCode remote workspaces with PSM for SSH proxy

VSCode remote workspaces with PSM for SSH proxy

123
Created On 11/10/26 10:54 AM - Last Modified 11/10/26 15:56 PM


Objective


PSM for SSH (PSMP) can be configured to support remote SSH VSCode extension. All supported versions of PSMP can be used, but starting with PSMP 14.2 it is possible to define multiple ports for tunneling. This is useful when multiple sessions are connecting to the same target machine.



Environment


14.2 Privileged Access Manager (PAM, self-hosted) PSMP

Procedure


Setup

To set up PSMP for remote SSH workspaces, the following configurations are necessary:

Note that PSM for SSH server restart may be required to apply the changes below.

PSM for SSH server settings

Edit the PVWA global options or local PSM for SSH server configuration based on Idira documentation

TunnelingServerEnable

Make sure that TunnelingServerEnable is set to Yes to enable tunneling in PSM for SSH server.

TunnelingServerPorts

Depends on the version of PSMP, set TunnelingServerPort or TunnelingServerPorts. It's possible to setup a remote workspace with just one port, but for multiple user access it's recommended to specify more ports.

In the examples below we will assume that the tunneling ports are defined as:

  • 55555 for PSMP supporting only a single port (TunnelingServerPort setting in PSM for SSH prior 14.2)
  • 55555-55564 for PSMP supporting multiple ports (TunnelingServerPorts setting in PSM for SSH 14.2 and newer)

Platform settings

Edit the platform to enable SSH Tunneling for accounts assigned to the platform. Detailed instructions can be found in the Idira documentation.

Commands Access Control does not allow to run ssh commands in at least PSM for SSH 14.4 and older, so it's not possible to use the remote SSH workspace with accounts in platforms where CAC is enabled.

EnableSSHTunneling

Make sure that EnableSSHTunneling is set to Yes to enable tunneling for accounts assigned to the platform.

TunnelingPorts

Include tunneling ports defined on the server level with TunnelingServerPort or TunnelingServerPorts. The port list can be wider to allow different ports to be forwarded.

AllowTunnelOnSSHCommand

Make sure AllowTunnelOnSSHCommand flag is set as VSCode uses commands for tunneling.

SSH Configuration

Below are examples of hostname definitions for the ~/.ssh/config file. Ensure that the port numbers match those defined in the PSMP platform settings.

Host remote_workspace_with_single_port
  HostName psmp_address
  User vault_user@target_user@target_address#22#55555
Host remote_workspace_with_multiple_ports
  HostName psmp_address
  User +vault_user@target_user@target_address+fp+55555+fp+55556+fp+55557+fp+55558+fp+55559+fp+55560+fp+55561+fp+55562+fp+55563+fp+55564

VSCode Settings

Server port range

In VSCode we have to specify allowed port range for a given ssh target, e.g.

"remote.SSH.serverPickPortsFromRange": {
  "remote_workspace_with_single_port": "55555-55555",
  "remote_workspace_with_multiple_ports": "55555-55564"
}

 

Make note that "remote.SSH.serverPickPortsFromRange" works as a suggested range, and if all ports from the stated range are already in use, the remote SSH extension may try to allocate a different port. Such situation may occur e.g. if old VSCode session has not been cleared yet by the remote server. In the case of PSM for SSH connections, it will lead to errors, as forwarding to ports out of the configured range will be blocked. It may result in logs similar to:

    stderr> channel 3: open failed: connect failed: Connection refused
    stderr> channel 4: open failed: connect failed: Connection refused

It is recommended to check VSCode's "Remote - SSH" logs for the port number used by the extension and compare them with ports used on the target machine and ones allowed in the PSM for SSH configuration in case of connection issues:

    [HH:MM:SS.sss] Remote server is listening on port PORT_NUMBER

The PORT_NUMBER should be within the allowed range. If it is not, it may mean that other processes occupy all allowed ports on the target machine.

Remote platform

VSCode server uses a session without allocated ppty, which is not fully supported by PSMP. To workaround it, it is required to define a platform for the targets in VSCode settings:

    "remote.SSH.remotePlatform": {
        "remote_workspace_with_single_port": "linux",
        "remote_workspace_with_multiple_ports": "linux"
    },

Local server

It's recommended to enable useLocalServer setting as it will limit the number of allocated ports on the target machine making it accessible for more users.



Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA1hj000000101BCAQ&lang=en_US&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail