針對 Ignite 配置 SSL/TLS
使用 ThingWorx HA 叢集時,您可針對 Ignite 配置 SSL 或 TLS。
配置 Ignite
欲搭配 SSL 執行 Ignite,我們必須 SslContextFactory 在 Ignite 組態檔案中進行具現化,您可以在其中新增金鑰存放區路徑與密碼。在下列範例中,我們的金鑰存放區路徑為 /ThingworxPlatform/ignite-keystore/ignite.pfx
<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="sslContextFactory">
<bean class="org.apache.ignite.ssl.SslContextFactory">
<property name="keyStoreFilePath" value="/ThingworxPlatform/ignite-keystore/ignite.pfx"/>
<property name="keyStorePassword" value="ptcptc"/>
<property name="trustManagers">
<bean class="org.apache.ignite.ssl.SslContextFactory" factory-method="getDisabledTrustManager"/>
</property>
</bean>
</property>
</bean>
執行 Ignite:
./ignite.sh config/default-config.xml
Ignite 啟動時,主控台會顯示下列文字:Security status [authentication=off, tls/ssl=on]
配置 ThingWorx
現在,您可以在 ThingWorx 中配置 Ignite。Ignite 可作為用戶端或以內嵌方式執行;此組態適用於任一方式。
1. 將 Ignite 憑證複製到您的實例,或確保它們可在 ThingWorx 執行所在的電腦上使用。
2. platform-settings.json 檔案修改為使用中 SSL。此外,也請修改igniteKeyStoreFilePathigniteKeyStorePassword
"cache": {
"init-timeout": "30 seconds",
"provider-type": "com.thingworx.cache.ignite.IgniteCacheProvider",
"cache-mappings": {},
"ignite": {
"instance-name": "twx-core-server",
"client-mode": false,
"address-resolver" : {
"type": "zookeeper",
"connection": "localhost:2181"
},
"ssl-active": true,
"igniteKeyStoreFilePath": "/ThingworxPlatform/ignite-keystore/ignite.pfx",
"igniteKeyStorePassword": "ptcptc"
}
使用 ThingWorx 安全性管理工具加密密碼
如果您要避免將明文密碼插入到 platform-settings.json 檔案中,您可使用安全性工具來加密 twx-keystore 內的密碼。您必須使用 encrypt.ignite.keystore.password 加密密碼。
./security-common-cli keystore.conf set encrypt.ignite.keystore.password "ptcptc"
然後,變更 platform-settings.json 檔案,讓 ThingWorx 從金鑰存放區中挑選密碼:
"ssl-active": true,
"igniteKeyStoreFilePath": "/ThingworxPlatform/ignite-keystore/ignite.pfx",
"igniteKeyStorePassword": "encrypt.ignite.keystore.password"
這是否有幫助?