Publish with ssh plugin does not work with openssh key
The publish over ssh plug does not accept a newly generated openssh (7.9-p1)
jenkins@server-two ~ $ ssh-keygen -b 1024 -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/jenkins/.ssh/id_rsa):
/home/jenkins/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/jenkins/.ssh/id_rsa.
Your public key has been saved in /home/jenkins/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:Dxg/hh433DNdQxDGlnWsGMmTjHGT6cEn1dPs0VbczJI jenkins@server-two
The key's randomart image is:
+---[RSA 1024]----+
| .B*@+OB|
| .o^oE+%|
| . o Bo=o|
| * . .o....|
| + S + . |
| . + = o |
| . . |
| |
| |
+----[SHA256]-----+
jenkins@server-two ~ $ cat ~/.ssh/id_rsa -----BEGIN OPENSSH PRIVATE KEY----- b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAlwAAAAdzc2gtcn NhAAAAAwEAAQAAAIEAtEuhS29xJQfHaJMexAlAVLf9wy2dHKh+EbXrD5DmpRq2PABjzZWK xvU/yvfCBpyMHaMLohMLhpUSqyKQd8a7h+6fLRPc51epviFhL6rFX/lqlWy4pnL0wq0a5I 30tGXPjL8Qzc/pqHwRz8yUmA0RLOSdFgSvrBu6YA0jmTxL4ZsAAAIIb8CTnm/Ak54AAAAH c3NoLXJzYQAAAIEAtEuhS29xJQfHaJMexAlAVLf9wy2dHKh+EbXrD5DmpRq2PABjzZWKxv U/yvfCBpyMHaMLohMLhpUSqyKQd8a7h+6fLRPc51epviFhL6rFX/lqlWy4pnL0wq0a5I30 tGXPjL8Qzc/pqHwRz8yUmA0RLOSdFgSvrBu6YA0jmTxL4ZsAAAADAQABAAAAgGj4w79U8i 5aOhrD1ZzTuhXZTjEuRJRj8YrEPUjB19f3FnUW0QTodXVjYzH8UIZi7R1wSZyitAo2jzj+ ldh258XA28b+qFMLPo4X0E6CWevSd6kVsub9I7JxwOeQXf26QgvOAcp3o4TIJIjg8LcVQU VdWBVPBJbebnpiLHCDJDb5AAAAQQCOldoy3U8NdOEXhh5U47BLZeMQT+KXWyfUzZ83uxRS UvKwL60AAc1fCuhi0G50rFBZDO1f4you3ZqYbxdI5CtIAAAAQQDqyDeMZ/0U+53Ox/BFeR Pw58F9KAjhCKYn3RMz9cUAs/NHvAnZP3o/YAANVSjHPpNnLfI7W4rughM8XroOivCPAAAA QQDEltdLfsCuItzcJXkMquojSK7TQlsONEcL7L4bozUWcCrkicjU24sj/U1rTlQpUC74yP out7NQioc/Yi7FmKw1AAAAEmplbmtpbnNAc2VydmVyLXR3bw== -----END OPENSSH PRIVATE KEY-----
Use ssh-copy-id to copy the newly generated ssh key to the desired destination server.
Navigate to Configure Jenkins
Set the passphrase and path to key to blank.
Set the key to the above text
Set ssh server name, hostname, and remote directory as appropriate
Click "Test Configuration".
Expected behavior, the test either works, or tells me that it's unable to authenticate against the target server.
Actual behavior:
I get this message.
Failed to connect or change directory jenkins.plugins.publish_over.BapPublisherException: Failed to add SSH key. Message [invalid privatekey: [B@d8d395a]
Subsequent activation of the "Test Configuration" button give me the same message, but with a different hex code at the end.
Activity
Michael Jones created issue - 2019-05-16 02:54
Hi,
I have the same issue. I generate a key with this method :
ssh-keygen -t rsa -b 4096
And i use ssh-copy-id :
ssh-copy-id -i .ssh/id_rsa.pub jenkins@hakael.secu.loc
If i made an ssh -i id_rsa jenkins@hakael.secu.loc, it's works but if i use the test in the configuration console, it failed, always.