Jenkins SSH server showing mentioned error Algorithm negotiation fail while trying to set up with over the SSH plugin when trying to connect over ssh to a local server (Linux Container). I am able to connect using ssh on the terminal.
jenkins.plugins.publish_over.BapPublisherException: Failed to connect and initialize SSH connection. Message: [Failed to connect session for config [anisbleHOST]. Message [Algorithm negotiation fail]]
Ubuntu machine - auth.log Unable to negotiate with xx.xx.xx.x port 39866: no matching host key type found. Their offer: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521 [preauth]
tried with the mentioned below sshd_config values but no luck.
HostKeyAlgorithms ssh-ed25519-cert-v01@openssh.com,ssh-ed25519
KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
To resolve the above-mentioned issue first I made changes to /etc/ssh/sshd_config and regenerated RSA keys using ssh-keygen. Jenkins doesn't support keys generated using ed25519.
HostKeyAlgorithms ssh-rsa-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa
HostKey /etc/ssh/ssh_host_key
HostKey /etc/ssh/ssh_host_rsa_key
HostCertificate /etc/ssh/ssh_host_key-cert.pub
KexAlgorithms diffie-hellman-group14-sha1,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,ecdh-sha2-nistp256,ecdh-sha2-nistp384
PubkeyAcceptedKeyTypes ssh-rsa,ssh-rsa-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ssh-ed25519
TrustedUserCAkeys /etc/ssh/ssh_user_ca.pub
PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM yes
PrintMotd no
AcceptEnv LANG LC_*
Subsystem sftp /usr/lib/openssh/sftp-server
LogLevel DEBUG
Please UPVOTE if it helps you :)