从Jenkins的凭据.xml中提取密码短语 [英] Extract passphrase from Jenkins' credentials.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屋!