更新 RabbitMQ 加密密碼
當使用安裝程式安裝 ThingWorx Flow 時,會加密 RabbitMQ 密碼。欲變更 RabbitMQ 加密密碼,請完成下列步驟:
1. <ThingWorx_Flow_Install_Location>\modules\RabbitMQ\definitions.json 檔案中,將 password 參數的值更新為新密碼。
2. 完成下列步驟以將 QUEUE.ADAPTERS.AMQP.CONFIG.credentials 參數修改為更新後的 RabbitMQ 密碼:
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 參數,將顯示在 ThingWorx Flow 使用者名稱之後的值修改為更新後的 RabbitMQ 密碼。
例如:"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 keystore 中的 encrypt.queue.password 值。
4. 重新啟動 RabbitMQThingWorx-FlowThingWorx-Foundation 服務。