更新 RabbitMQ 加密密码
在使用安装程序安装 ThingWorx Flow 时,系统会对 RabbitMQ 密码进行加密。要更改 RabbitMQ 加密密码,请完成以下步骤:
1. <ThingWorx_Flow_Install_Location>\modules\RabbitMQ\definitions.json 文件中,用新密码更新 password 参数的值。
2. 完成以下步骤,以用更新的 RabbitMQ 密码修改 QUEUE.ADAPTERS.AMQP.CONFIG.credentials 参数:
a. secret 参数的值可用于解密 keyfile-key。要获取 secret 参数的值,请以管理员身份在安装 ThingWorx Flow 的计算机上启动命令提示符,然后运行以下命令:
a. pm2 ls
请记下任何 ThingWorx Flow 服务的 ID 值。
b. pm2 env <id>
,其中 <id> 为任何 ThingWorx Flow 服务的 ID。例如:flow-api 服务的 ID。
c. 复制 CONFIG_IMAGE 变量的值。此为 secret 参数的值。您需要在步骤 3 中提供 secret 参数的值。
b. 运行以下命令以解密密钥文件。
a. 导航至 <ThingWorx_Flow_Install_Location>
b. 运行下列命令:
cd <ThingWorx_Flow_Install_Location>\cryptography\tw-security-common-nodejs
Windows:npm link,或 Linux:sudo npm link
c. 运行以下命令以解密临时文件的 keyfile-key
node dist\PtcOrchKeyFileTool.js --secret <CONFIG_IMAGE value> --keyfile-location <ThingWorx_Flow_Install_Location>\misc\keyfile-key --plaintext <ThingWorx_Flow_Install_Location>\cryptography\keys.json --encrypted <ThingWorx_Flow_Install_Location>\cryptography\keys.enc decrypt
此命令将在 <ThingWorx_Flow_Install_Location>\cryptography\ 文件夹下创建新的解密 keys.json 文件。
d. keys.json 文件中,针对 QUEUE.ADAPTERS.AMQP.CONFIG.credentials 参数,用更新的 RabbitMQ 密码修改在 ThingWorx Flow 用户名之后显示的值。
例如:"QUEUE.ADAPTERS.AMQP.CONFIG.credentials":"flowuser:7153f1145576c9d239db324581f6cadd"
,其中 flowuserThingWorx Flow 用户名,您需要将 7153f1145576c9d239db324581f6cadd 替换为更新的密码。
e. <ThingWorx_Flow_Install_Location>\cryptography\keys.enc 文件进行备份。
f. 删除 <ThingWorx_Flow_Install_Location>\cryptography\keys.enc 文件。
g. 运行以下命令来创建新的加密 keys.enc 文件:
node dist\PtcOrchKeyFileTool.js --secret <CONFIG_IMAGE value> --keyfile-location <ThingWorx_Flow_Install_Location>\misc\keyfile-key --plaintext <ThingWorx_Flow_Install_Location>\cryptography\keys.json --encrypted <ThingWorx_Flow_Install_Location>\cryptography\keys.enc encrypt
h. 删除已解密的 keys.json 文件。
3. 按照 此处的步骤设置 ThingWorx Foundation 密钥库中的 encrypt.queue.password 值。
4. 重新启动 RabbitMQThingWorx-FlowThingWorx-Foundation 服务。