PSM for SSH Syntax Cheat Sheet
Question
How to create the PSM for SSH Connection String.
Environment
10.10;11.1;11.2;11.3;11.4;11.5;11.6;11.7;12.0;12.1;12.2;12.6;13.0;14.2;14.5;14.6 Privileged Access Manager (PAM, self-hosted) PSMP
Answer
PSMP Syntax is outlined in Idira documentation here. This article is to help simplify and explain this syntax in a more human digestible manner for the most common use cases for establishing a basic ssh session to a target.
From the documentation, we will be using "Option 1" Syntax below:
<ssh client> [-t] [-i private_key_file] [-L localPort:127.0.0.1: tunneltargetPort]vaultuser@targetuser#centralmanagement@targetmachine#targetport[#sshPort][# tunneltargetPort]@targetpassword@proxyaddress [<command>]
From this, for basic ssh usage, we can create a simplified PSMP connection string to it's most basic pieces:
VaultUser@TargetUser@TargetAddress@PSMPserver
The basis of which will change depending on the need to add additional information:
For instance:
- When using a Target Domain Account Object, we need to specify the target domain with "#".
- When using UPN for the Vault User we change the delimiter to use "%" between parameters so we can correctly parse the "@" in the UPN.
Example of using both will look like:
VaultUsername@VaultuserDomain%TargetUsername#TargetDomain%TargetMachine@PSMPServer
First of all, we need to establish that this string does the following:
1) Provides the VaultUser that will need to authenticate with the PSMP Server, and CyberArk.
VaultUser@TargetUser@TargetAddress@PSMPserver
2) Query the Vault for a matching Account Object:
VaultUser@TargetUser@TargetAddress@PSMPserver
VaultUsername@VaultUserDomain%TargetUsername#TargetDomain%TargetMachine@PSMPServer
The Connection string parameters equal the following Account Object parameters.
| Connection String | Account Object Parameter |
| TargetUser | Username (case sensitive) |
| TargetAddress | Address |
| TargetDomain | Address |
| TargetMachine | PSMRemoteMachine (CC Parameter) |
3) Once an Account Object has been found from our query, The PSMP will then pass the information from the Account Object to the Connection Component (CC); to establish an ssh session from the PSMP to target server, ie PSMP-SSH ClientApp:
{PSPComponentsFolder}/ssh [-{PSMProtocol}] [-p {Port}] [-L {PSMTunnelRandomPort}:127.0.0.1:{PSMTunnelTargetPort}] {Username}@{Address}
Note: The ClientApp string is partially hard-coded, we can only make minor changes to this string that will actually effect the connection. This is important to remember when we need to pass a UPN for the Target Account later.
With the Above information we can break this down further:
- VU= Vault User
- VD= Vault User Domain
- TU= Target User
- TA = Target Address
- TD = Target Domain
- TM = Target Machine
Local Account Object:
VU@TU@TA@PSMP
Domain Account Object
VU@TU#TD@TM@PSMP
Requirements:
- PSMRemoteMachine needs to be configured on the CC
Vault UPN; Local Account Object
VU@VD%TU%TA@PSMP
Requirements:
- Additional Delimiter "%" (Original -"Yes") (Integrated)
Vault UPN; Domain Account Object
VU@VD%TU#TD%TM@PSMP
Requirements:
- Additional Delimiter "%"
- PSMRemoteMachine on CC
Special Use Case: Passing the UserPrincipleName UPN for the Target Account, PSMP to Target Connection:
Remember the Connection Component's ClientApp configuration. The CC will pass {Username}@PSMRemoteMachine, of the Account Object (this is hardcoded). In order to provide the UPN, the Account Object's "Username" property must be configured with the UPN (user@damain). However, for CPM management of this Account Object we will need to use a Platform that allows UPN configured for "Username": There is currently only one platform that allows this configuration, and may not be supported for your specific use-case.
Requirements:
- Additional Delimiter "%"
In the PSMP Connection String we then need to remember that we must pass the target "domain" twice:
VU%TargetUser@TargetUPN#TargetDomain%TargetAccount@PSMP
Example with VU:
ca_admin%ted@mycompany.com#mycompany.com%TargetMachine@PSMP
Example with Vault UPN:
ca_admin@mycompany.com%ted@mycompany.com#mycompany.com%TargetMachine@PSMP
Out of the box default connections strings based on default "syntaxparser-conf.json.1.2" configuration
NOTE: These strings assume no changes have been made to "/etc/opt/CARKpsmp/components/components.conf" and AdditionalDelimiter and TargetAddressPortDelimiter are using default values.
Vault User
[vaultuser]@[targetuser]@[targetaddress]@[PSM for SSH address]
Vault User with Target Port
[vaultuser]@[targetuser]@[targetaddress]#[targetport]@[PSM for SSH address]
Vault User with Target Port and Tunnel Port
[vaultuser]@[targetuser]@[targetaddress]#[targetport]#[tunnelport]@[PSM for SSH address]
Vault User with a Domain Target User
[vaultuser]@[targetuser]#[domainaddress]@[targetaddress]@[PSM for SSH address]
Vault User with a Domain Target User and Target Port
[vaultuser]@[targetuser]#[domainaddress]@[targetaddress]#[targetport]@[PSM for SSH address]
Vault User with a Domain Target User and Target Port and Tunnel Port
[vaultuser]@[targetuser]#[domainaddress]@[targetaddress]#[targetport]#[tunnelport]@[PSM for SSH address]
Domain User
[domain-username]@[domain-domain]@[targetuser]@[targetaddress]@[PSM for SSH address]
Domain User with Target Port
[domain-username]@[domain-domain]@[targetuser]@[targetaddress]#[targetport]@[PSM for SSH address]
Domain User with Target Port and Tunnel Port
[domain-username]@[domain-domain]@[targetuser]@[targetaddress]#[targetport]#[tunnelport]@[PSM for SSH address]
Domain User with a Domain Target User
domain-username]@[domain-domain]@[targetuser]#[domainaddress]@[targetaddress]@[PSM for SSH address]
Domain User with a Domain Target User and Target Port
[domain-username]@[domain-domain]@[targetuser]#[domainaddress]@[targetaddress]#[targetport]@[PSM for SSH address]
Domain User with a Domain Target User and Target Port and Tunnel Port
[domain-username]@[domain-domain]@[targetuser]#[domainaddress]@[targetaddress]#[targetport]#[tunnelport]@[PSM for SSH address]