Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to add SSH Key in Jenkins Configuration

Tags:

ssh

jenkins

I Have installed 'Publish Over SSH' plugin in Jenkins and would like to transfer few files to SSH Server after each Build .

I have generated the private key using puttygen with passphrase and have given the OpenSSH Public Key in 'authorization_keys' in SSH Server.

Using the generated private key and passphrase , I'm able to login to the SSH Server through PuTTY.

But in Jenkins I'm not able to add the SSH Key. Getting the below Error.

jenkins.plugins.publish_over.BapPublisherException: Failed to add SSH key. Message [The cipher 'aes256-cbc' is required, but it is not available.

Jenkins Configuration

like image 861
jeevan s Avatar asked Nov 15 '16 07:11

jeevan s


Video Answer


1 Answers

Most of the tools (including Jenkins) support keys in OpenSSH format (generated using ssh-keygen), not in the PuTTY format (generated using PuTTYgen). Generate a new key using ssh-keygen or convert the PPK to OpenSSH format.

I wrote the following information in the SO Documentation.


Convert PPK (PuTTY key) to OpenSSH format

You might receive from your peer private key in PPK format, which seems it does not work in OpenSSH (command-line ssh). The client will be asking for the passphrase, because of OpenSSH bug.

$ ssh -i mykey.ppk example.com
Enter passphrase for mykey.ppk:

You need to convert the key to OpenSSH format using PuTTYgen (command-line version):

puttygen mykey.ppk -o mykey.key -O private-openssh

Or in GUI version:

  • Open PuttyGen
  • Click Load
  • Load your private key
  • Go to Conversions->Export OpenSSH and export your private key
  • Copy your private key to ~/.ssh/id_rsa

Source: SO answer, Unix SE answer

like image 89
Jakuje Avatar answered Oct 17 '22 18:10

Jakuje