Pipe of tar or other commands through PSMP fails
Symptom
When trying to use the tar command piped through a ssh command through the PSM for SSH proxy, the command fails.
For example
tar cvf - dirToSend | ssh vaultuser@user@target@psmp "cd /tmp; tar xvf -"
The command does not transfer the file as expected and an error is received.
The issue can also occur when copying files through an ansible playbook using cp. In this instance the file may be copied, but the ansible playbook is stuck.
Environment
10.9;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.2 Privileged Access Manager (PAM, self-hosted);Privilege Cloud PSMP
PSM for SSH using the Plink client from version 10.9
PSM for SSH using the ssh client from version 11.5
Cause
Sanitization of data transferred in PSM for SSH sessions was added as a security feature, The sanitation changes how the data is received on the target. This causes the tar file to be received incorrectly, and can cause similar problems piping other commands.
Resolution
The ability to configure the PSM for SSH to disable the Sanitization that causes the issue and allow piping was added in version 11.7
In order to allow piping through PSM for SSH there are two options:
1. Disable the input sanitation entirely.
- This can be done by adding The parameters 'SanitizeInput' and 'SanitizeOutput', both with a value of 'no' in:
Connection Components -> PSMP-SSH -> Target Settings -> Client Specific
2. Change the default value of the regex used to skip sanitation for specific commands, in order to recognize and not sanitize the desired command.
- The default regex (which PSM for SSH uses when no configuration is found) is: '(.*WinSCP: this is end-of-file.*|^[\0]{1}$)'
- this is in order to recognize WINSCP
- In order to support your usage, you can add the parameter 'SkipInputSanitizationRegex' under 'Client Specific' with your preferred value, for example to add tar:
'(.*WinSCP: this is end-of-file.*|^[\0]{1}$)|(tar xvf -)'
Please note that this change can be applied on a specific platform, as well as on the Connection Component level in the PVWA configuration.
After changing your preferred configuration, restart the PSMP service and retry to initiate your piping session.