首页 文章

如何在jenkins控制台中隐藏weblogic密码

提问于
浏览
0

我们正在使用Jenkins 1.5的Weblogic Deployer Plugin在Weblogic服务器中通过Jenkins部署战争 . 源,目标和凭据通过default.xml文件进行管理 .

<weblogic-target>
        <name>WeblogicServer</name>
        <host>localhost</host>
        <port>9001</port>
        <login>JenkinsUser</login>
        <password>deploy</password>
        <authMode>BY_LOGIN</authMode>
    </weblogic-target>

但是在Jenkins的控制台输出中,密码显示为纯文本 . 我们已经安装了Mask Password插件并对其进行了配置,但这没有任何帮助 .

有人可以提出任何关于隐藏此密码不出现在Jenkins控制台输出中的想法吗?

2 回答

  • 0

    终于明白了! Weblogic Deployer插件版本2.3以上内置了隐藏密码的功能 . 它使用Weblogic的密码加密功能 . 我不得不像这样修改default.xml:

    <weblogic-target>
                <name>WeblogicServer</name>
                <host>localhost</host>
                <port>9001</port>
                <login>JenkinsUser</login>
                <password>deploy</password>
                <authMode>BY_KEY</authMode>
                <userconfigfile>C:\users\MyUser\Desktop\userconfig</userconfigfile>
                <userkeyfile>C:\users\MyUser\Desktop\userkey</userkeyfile>
     </weblogic-target>
    

    userconfigfile和userkeyfile是属性密钥文件对,可以从WLST脚本或cmd生成 . 为了方便大家,我们提供以下命令:

    转到您的weblogic服务器安装文件夹 - > bin,在该文件夹中打开cmd并键入setWLSEnv enter .

    java weblogic.Admin -adminurl t3:// localhost:9001 -userid userid -password password -userconfigfile "Your designated path to store the file" -userkeyfile "Your designated path to store the file" -STOREUSERCONFIG

    它将要求确认,按Y并输入,将创建这对文件 . 您可以通过以下命令验证此对是否正常工作:

    java weblogic.Admin -adminurl t3:// localhost:9001 -userconfigfile“在上一步中存储配置文件的本地路径”-userkeyfile“在上一步中存储密钥文件的本地路径”-GETSTATE

    如果它显示RUNNING那么文件工作正常!

  • 0

    如果您更喜欢使用Mask Password Plugin,则可以在作业配置中使用正则表达式: -password\s.* .

    MaskPasswordRegEx

相关问题