从Jenkins的凭据.xml中提取密码短语 [英] Extract passphrase from Jenkins' credentials.xml

查看:1888
本文介绍了从Jenkins的凭据.xml中提取密码短语的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已向Jenkins添加了SSH凭据.

I have added an SSH credential to Jenkins.

不幸的是,我忘记了SSH密码,现在想从位于${JENKINS_HOME}/credentials.xml的Jenkins凭据档案中获取它.

Unfortunately, I have forgotten the SSH passphrase and would now like to obtain it from Jenkins' credential archive, which is located at ${JENKINS_HOME}/credentials.xml.

该XML文档似乎具有在XML标签<passphrase><password>中加密的凭据.

That XML document seems to have credentials encrypted in XML tags <passphrase> or <password>.

如何检索明文密码短语?

How can I retrieve the plaintext passphrase?

推荐答案

通过访问http(s)://${JENKINS_ADDRESS}/script打开您的Jenkins安装脚本控制台.

Open your Jenkins' installation's script console by visiting http(s)://${JENKINS_ADDRESS}/script.

在那里,执行以下Groovy脚本:

There, execute the following Groovy script:

println( hudson.util.Secret.decrypt("${ENCRYPTED_PASSPHRASE_OR_PASSWORD}") )

其中${ENCRYPTED_PASSPHRASE_OR_PASSWORD}是您要查找的<password><passphrase> XML元素的加密内容.

where ${ENCRYPTED_PASSPHRASE_OR_PASSWORD} is the encrypted content of the <password> or <passphrase> XML element that you are looking for.

这篇关于从Jenkins的凭据.xml中提取密码短语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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