为 Ignite 配置 SSL/TLS
使用 ThingWorx HA 群集时,可以为 Ignite 配置 SSL 或 TLS:
配置 Ignite
要运行带有 SSL 的 Ignite,我们需要通过在 Ignite 配置文件中添加密钥存储路径和密码来实例化 SslContextFactory。在以下示例中,我们的密钥存储路径为 /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"
这对您有帮助吗?