无法在Jenkins配置中添加SSH密钥 [英] Not able to add SSH Key in Jenkins Configuration

查看:1785
本文介绍了无法在Jenkins配置中添加SSH密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Jenkins中安装了通过SSH发布"插件,并希望在每次构建后将少量文件传输到SSH服务器.

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

我已使用puttygen和密码生成了私钥,并在SSH服务器的'authorization_keys'中提供了OpenSSH公钥.

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

使用生成的私钥和密码,我可以通过PuTTY登录SSH服务器.

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

但是在Jenkins中,我无法添加SSH密钥.出现以下错误.

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

jenkins.plugins.publish_over.BapPublisherException:无法添加SSH密钥.消息[密码'aes256-cbc'是必需的,但它不可用.

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

推荐答案

大多数工具(包括Jenkins)都支持OpenSSH格式(使用ssh-keygen生成)而不是PuTTY格式(使用PuTTYgen生成)的密钥.使用ssh-keygen生成新密钥,或将PPK转换为OpenSSH格式.

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.

我在SO文档中写了以下信息.

I wrote the following information in the SO Documentation.

您可能会从您的对等私钥收到PPK格式,这似乎在OpenSSH中不起作用(命令行ssh).由于 OpenSSH错误,客户端将要求输入密码.. >

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:

您需要使用PuTTYgen(命令行版本)将密钥转换为OpenSSH格式:

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

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

或在GUI版本中:

  • 打开PuttyGen
  • 点击加载
  • 加载您的私钥
  • 转到转化-> 导出OpenSSH 并导出您的私钥
  • 将您的私钥复制到~/.ssh/id_rsa
  • 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

来源: SO答案 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆