ThingWorx Flow > 安裝與組態 > 配置 ThingWorx Flow > 為 Windchill 雙向 SSL 連線設定 ThingWorx 與 ThingWorx Flow (僅限 9.0)
為 Windchill 雙向 SSL 連線設定 ThingWorx 與 ThingWorx Flow (僅限 9.0)
* 
如果您使用的是 ThingWorx Flow 9.0.2 及更新版本,此主題無效。
PTC 建議針對生產環境使用安全通訊端層 (SSL) 協定。ThingWorx 使用 SSL 來相互驗證伺服器,並保護伺服器之間的通訊。
HTTPS 的組態需要使用授權憑證。ThingWorx要求該憑證必須受 Java 信任。如果您使用 Java 不信任的憑證,則必須將 Java 配置為信任此憑證。由協力廠商提供的憑證,例如 Verisign 與 Thawte,是 Java 信任的授權憑證。
* 
此文件提供的步驟可讓您在為安裝實行 HTTPS 時花費最少的力氣。它不是 SSL 組態中所有可用選項的完整清單。
先決條件
在您為 Windchill 雙向 SSL 連線設定 ThingWorxThingWorx Flow 之前,請確保您符合下列先決條件:
Windchill 使用下列憑證配置 (只有當 Windchill 憑證是自簽署的憑證時才需要):
Windchill 憑證
此文件假設 Windchill 憑證儲存在 server.crt 檔案中。
會建立使用該 Windchill 憑證的 CA 憑證。
此文件假設 CA 憑證儲存在 rootCA.crt 檔案中。
請務必將 JAVA_HOME/bin 新增至您的 PATH 環境變數。
步驟
以下是流程的主要步驟:
* 
如果您已針對 ThingWorx Navigate,為 ThingWorx 的相同實例設定 SSL,請略過此步驟。
步驟 1:針對 Windchill 雙向 SSL 連線配置 ThingWorx ThingWorx
欲為 Windchill 雙向 SSL 連線配置 ThingWorx,您必須產生一個 KeyStore 檔案,以使用自簽署憑證接受 SSL 連線。欲完成此設定,請完成下列步驟:
1. 以管理員身份啟動指令提示,並瀏覽至您要儲存 KeyStore 檔案的位置。
2. 建立 Java KeyStore (JKS) 檔案、thingworx.jks 並使用別名產生初始公開與私人金鑰配對,thingworx
keytool -genkey -alias thingworx -keyalg rsa -dname "CN=<ThingWorx 伺服器的完整網域名稱>" -keystore thingworx.jks -storetype JKS
出現提示時,輸入 KeyStore 檔案與私密金鑰的相同密碼。
請確保密碼僅包含字母與數字。特殊字元不受支援。PTC 不對您產生的憑證與 KeyStore 和信任倉庫檔案的安全性負責。
* 
如果您不以管理員身份啟動指令提示,可能會收到下列錯誤:
keytool error: java.io.FileNotFoundException: thingworx.jks (Access is denied)
3. 針對索引鍵產生自簽署憑證:
keytool -selfcert -alias thingworx -validity 1825 -keystore thingworx.jks -storetype JKS
當提示您輸入 KeyStore 密碼時,請輸入您為前述指令輸入的密碼。
4. 為新的自簽署憑證匯出公開金鑰:
keytool -export -alias thingworx -file thingworx.cer -rfc -keystore thingworx.jks -storetype JKS
步驟 2:針對 Windchill 雙向 SSL 連線配置 ThingWorx Flow
A 部份 - 取得與 thingworx.jks KeyStore 相關聯的憑證與私人金鑰
1. 下載並安裝 KeyStore 檔案總管
2. 在 KeyStore 檔案總管中,開啟 thingworx.jks,即您在步驟 1 中建立的 Thingworx KeyStore。
出現提示時,輸入 KeyStore 的正確密碼。
3. thingworx 上按一下滑鼠右鍵,然後按一下「匯出」 > 「匯出憑證鏈」,以匯出與 thingworx.jks KeyStore 相關聯的憑證:
4. 在「從輸入匯出憑證鏈」'thingworx' 視窗中,執行下列操作:
a. 針對「匯出長度」,選取「僅限頭」
b. 針對「匯出格式」,選取 X.509
c. 選取 PEM 核取方塊。
d. 「匯出檔案」欄位中,按一下「瀏覽」以瀏覽至您要儲存已匯出憑證的位置。例如:thingworx
e. 按一下「匯出」
5. thingworx 上按一下滑鼠右鍵,然後按一下「匯出」 > 「匯出私人金鑰」,以匯出與 thingworx.jks KeyStore 相關聯的私人金鑰:
6. 在「匯出私人金鑰類型」視窗中,選取 PKCS#8,然後按一下「確定」
7. 在「從 KeyStore 輸入中將私人金鑰匯出為 PKCS#8」'thingworx' 視窗中,執行下列操作:
a. 清除「加密」核取方塊。
b. 選取 PEM 核取方塊。
c. 「匯出檔案」欄位中,按一下「瀏覽」以瀏覽至您要儲存已匯出私人金鑰的位置。例如:thingworx.key
d. 按一下「匯出」
零件 B - 將 ThingWorx 與 Windchill 憑證新增至 ThingWorx Flow 信任倉庫
1. secret 參數的值可用來解密信任倉庫。欲取得 secret 參數的值,請在您安裝 ThingWorx Flow 的電腦上以管理員身份啟動指令提示,並執行下列指令:
a. pm2 ls
請記下任何 ThingWorx Flow 服務的 ID 值。
b. pm2 env <ID>
,其中 <ID> 是任何 ThingWorx Flow 服務的 ID。例如:flow-api 服務的 ID。
c. 複製 CONFIG_IMAGE 變數的值。這是 secret 參數的值。
2. 執行下列指令:
<ThingWorx Flow 安裝目錄>\cryptography\tw-security-common-nodejs npm link
3. 執行下列指令,將 thingworx.crt 憑證檔案新增至信任倉庫:
PtcOrchKeyFileTool set --keyName thingworx-crt --keyPath <thingworx.crt 的路徑> --configPath <<何 Flow 服務的 config.json 檔案絕對路徑> --secret <解密信任倉庫的密碼>
請勿變更 keyName 參數的值。必須將其設定為 thingworx-crt
4. 執行下列指令,將 thingworx.key 私人金鑰檔案新增至信任倉庫:
PtcOrchKeyFileTool set --keyName thingworx-key --keyPath <thingworx.key 的路徑> --configPath <任何 Flow 服務之 config.json 檔案的絕對路徑> --secret <用來解密 TrustStore 的密碼>
請勿變更 keyName 參數的值。必須將其設定為 thingworx-key
5. 如果您的 Windchill 憑證是自簽署憑證,請執行下列操作:
a. 建立新檔案,ca.crt
b. rootCA.crtserver.crt 檔案的內容貼到 ca.crt 檔案中。
c. 執行下列指令,將 Windchill 憑證新增至信任倉庫:
PtcOrchKeyFileTool set --keyName <Windchill-crt>--keyPath <ca.crt 檔案的路徑> --configPath <任何 Flow 服務之 config.json 檔案的絕對路徑> --secret <用來解密 TrustStore 的密碼>
對於此指令,您可以變更 keyName 參數的值。針對多個 Windchill 伺服器,請確保為 keyName 參數設定不同的值。
6. 重新啟動 ThingWorxThingWorx Flow 伺服器。
您已成功為 Windchill 雙向 SSL 連線設定 ThingWorxThingWorx Flow
您現在可以為任何 Windchill 動作新增 Windchill 雙向 SSL 連線。如需詳細資訊,請參閱新增 Windchill 雙向 SSL 連線
這是否有幫助?