5.9.2. 在配置文件中加密密码

以下示例演示了如何屏蔽 broker.xml 配置文件中的 cluster-password 值。

步骤

  1. 在命令提示符中,使用 mask 工具加密密码:

    $ <broker_instance_dir>/bin/artemis mask <password>
    result: 3a34fd21b82bf2a822fa49a8d8fa115d
  2. 打开 <broker_instance_dir>/etc/broker.xml 配置文件,其中包含您要屏蔽的纯文本密码:

    <cluster-password>
      <password>
    </cluster-password>
  3. 使用加密值替换 plain-text 密码:

    <cluster-password>
      3a34fd21b82bf2a822fa49a8d8fa115d
    </cluster-password>
  4. 使用标识符 ENC() 结束加密的值:

    <cluster-password>
      ENC(3a34fd21b82bf2a822fa49a8d8fa115d)
    </cluster-password>

该配置文件现在包含加密密码。因为密码被打包成 ENC() 标识符,AMQ Broker 会在使用前对其进行解密。

其他资源