无法指向 Jenkins 主机上 ~/.ssh 中的 ssh 密钥

Unable to point to ssh keys in ~/.ssh on Jenkins host

我已经安装了 SSH 代理插件以使用 SSH 身份验证提取 Git 存储库。我想使用位于系统文件中的 SSH 密钥(来自 Jenkins master ~/.ssh 选项)。这是从官方插件页面截取的屏幕截图:

很遗憾,我没有看到这个选项。我只能 select "Enter directly"。请查看我的屏幕截图。

我是不是配置有误?

该选项(第一个屏幕)来自 Jenkins | Manage Jenkins | Manage Credentials 全局选项页面。

如果它在 Jenkins 作业中不可见。

您需要至少输入一个命名私钥,才能让作业显示选项:

这是一个相对较新的更改,在安全公告 440 中有解释:https://jenkins.io/security/advisory/2018-06-25/

SECURITY-440 / CVE-2018-1000601 SSH Credentials Plugin allowed the creation of SSH credentials with keys "From a file on Jenkins master". Credentials Binding Plugin 1.13 and newer allows binding SSH credentials to environment variables. In combination, these two features allow users with the permission to configure a job to read arbitrary files on the Jenkins master by creating an SSH credential referencing an arbitrary file on the Jenkins master, and binding it to an environment variable in a job.

SSH Credentials Plugin no longer supports SSH credentials from files on the Jenkins master file system, neither user-specified file paths nor ~/.ssh. Existing SSH credentials of these kinds are migrated to "directly entered" SSH credentials.

我也没有看到 "Manage Credentials" 选项。我还在修修补补.. 见下文

我的当前位置

Jenkins > 凭据 > 系统 > 全局凭据
如何到达这里不是很明显.. 所以,这里有一些技巧/解决方法。

全局凭据 link 不是很明显。请查看屏幕截图或在浏览器中输入以下路径
你的IP:YOURPORT/credentials/store/system/domain/_/

到达位置后:您应该会在侧边栏菜单或 href 文本中看到添加凭据 link "adding some credentials?"

我在这里看到 1 个 SSH 选项。 "SSH with username and Private Key"

将更新结果。