Failed to connect to the target. Contact your system administrator error via PSMP-SSH
Symptom
In some pCloud env, customer have installed PSMP server in Amazon Linux OS. The error when using MFA caching output as below:
ssh -vvv -i key.openssh adUser@domain.com@a-UserAD#domain.com@10.x.x.x@psmpip
...
Authorized uses only. All activity may be monitored and reported.
...
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Offering public key: key.openssh RSA SHA256:uFMzb0o8MlHqTnKYVAi660pprcITPzdHRx6X6X0jIwI explicit
...
debug1: Authentications that can continue: publickey,keyboard-interactive
debug2: we did not send a packet, disable method
...
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
..
debug2: we sent a keyboard-interactive packet, wait for reply
..
Failed to connect to the target. Contact your system administrator
...
Received disconnect from 10.x.x.x port 22: Too many authentication failures
Disconnected from 10.x.x.x. port 22
Environment
14.0 Privilege Cloud PSMP PSMP Networking & Connectivity
Cause
This issue usually happens on Amazon linux which deployed with openssh v7.4. According to CyberArk doc:
- To use MFA caching, OpenSSH 7.8 and above is required on the PSM for SSH machine. RHEL 7.9 includes an earlier version of OpenSSH. If you are using RHEL 7.9, we recommend that you upgrade to RHEL version 8, which has OpenSSH version 7.8 out of the box to support MFA caching.
refer to https://docs.cyberark.com/pam-self-hosted/latest/en/content/pasimp/configuring-ssh-key-authentication-to-target-systems.htm?Highlight=RSA
Resolution
1) rpm -qa|grep openssh to verify the openssh package version
2) Check /etc/ssh/sshd_config file to see if there is any setting ie: additional AuthorizedKeysCommand line which is outside of the PSMP Section/Block, it can be also found from /var/log/secure log, if the output in the secure log indicates AuthorizedKeysCommand other than /opt/CARKpsmp/bin/psshkeys_runner.sh, comment out those lines which is outside of PSMP Block (We need to force sshd run the psmp sshkey command inside the Match Group PSMConnectUsers section).
3) If current openssh version is not support MFA caching, upgrade the openssh package to 7.8 and above (except for 9.9) We have verified v9.2 works but 9.9 breaks the function. You can use #yum update/upgrade openssh to update the packages or refer to vendor doc.