"Unable to negotiate with <IP> port 22: no matching key exchange method found" issue after upgrade psmp
Symptom
While SSH'ing via PSMP to some of the network devices after upgrade PSMP to Version 12.x, users are getting the following error message: This session is being recorded "Unable to negotiate with 10.x.x.x port 22: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1"
Environment
12.0;12.1;12.2;13.0;13.2;14.0;14.2;14.4 Privileged Access Manager (PAM, self-hosted) PSMP PSMP Networking & Connectivity
Cause
Difference in available cryptography algorithms (kexalgorithms) for SSH between the PSMP and the Target System
Resolution
Refer to https://community.cyberark.com/s/article/PSMP-ClientApp-SSH-SSH-Session-errors-with-no-matching-X,
To update the cryptography in use by PSM for SSH; the preferred method is to update the shadow user configuration file, /home/PSMShadowUser/.ssh/config, Here are the steps in detail:
1) Check the permission of the configuration files:
#chmod 770 /home/PSMShadowUser/.ssh
#touch /home/PSMShadowUser/.ssh/config (if the file was not exists)
#chown root:PSMShadowUsers /home/PSMShadowUser/.ssh/config
#chmod 740 /home/PSMShadowUser/.ssh/config
2) Edit the new config file with one of the options:
Option #1 ===Enable for All target hosts===
Host *
KexAlgorithms +diffie-hellman-group14-sha1
Option #2 ===Enable for individual target(s) only, more secure===
Host server1.example.com ipaddress1
HostName ipaddress1
KexAlgorithms +diffie-hellman-group14-sha1
Host server2.example.com ipaddress2
HostName ipaddress2
KexAlgorithms +diffie-hellman-group14-sha1
....
If the error is "no matching host key type found. Their offer: ssh-rsa,ssh-dss" then add 2 lines below and instead of the KexAlgorithms line
Host *
PubkeyAcceptedKeyTypes +ssh-rsa
HostKeyAlgorithms +ssh-rsa,ssh-dss
There is no need to restart sshd services after changing this config file.