使用 SSL 进行安全通信
|
本主题适用于配置了 Windchill 身份验证的系统。
|
简介
您的站点可以使用双向 SSL 在 ThingWorx 服务器与 Windchill 应用程序之间提供安全通信。PTC 建议在生产环境中使用 SSL。扩展可以使用 SSL 在服务器之间进行相互身份验证,并保护通信本身。
SSL 连接要求两个系统彼此信任;要达到此目的,必须将 SwaggerConnector 和 ptc-windchill-Odata-connector 配置为引用保存在 ThingWorx 服务器中的 Java KeyStore 和 TrustStore 文件,以提供用于事务处理的密钥。Windchill 服务器上的 HTTP 服务器必须配置为信任这些密钥。
SSL 配置差别很大,本主题并不打算描述 SSL 配置中的所有可用选项。因此,按以下步骤为配置 SSL 过程提供概述。
此过程假定 ThingWorx 和 Windchill 都配置为针对其标准通信使用 SSL。它也依赖于随 PTC HTTP 服务器最新版本提供的配置脚本。最新的 PTC HTTP 服务器包括在 Windchill 11.0 M030 及更高版本中。
|
• 您可以对 Windchill 使用商业可信的通配符证书。
• 您可以在 ThingWorx 与 Windchill 之间使用自签名证书或商业可信通配符证书。
|
配置 ThingWorx 使用 KeyStore 和 TrustStore
ThingWorx 需要 Java KeyStore 和 TrustStore。有关创建此类文件的说明,请参阅
为 ThingWorx Navigate 创建 KeyStore 和 TrustStore 文件主题。
1. 为 ThingWorx 创建 TrustStore 并导入 Windchill SSL 证书。
2. 为 ThingWorx 创建密钥库,并在密钥库中生成密钥对。
3. 将 Windchill 配置为信任 ThingWorx。
4. 在用来将 ThingWorx 连接到要保护的 Windchill 系统的 WindchillConnector 事物模板的配置中,引用上述存储区。
为 Windchill 配置客户端身份验证
在 Windchill 服务器上,在 PTC HTTP 服务器中配置 SSL 身份验证以信任 ThingWorx 密钥和证书。
|
代码示例已重新格式化以便适应页面大小,因此可能包含行号、隐藏的编辑字符 (如制表符和行尾字符) 和额外的空格。在剪切并粘贴代码时,请检查上述字符并将其移除,之后再尝试在您的应用程序中使用此示例。
|
1. 更新 PTC HTTP 服务器配置,以参考 CA 证书文件。
a. 在 <HTTPSERVER_HOME>\conf\ca-bundle.crt 中创建文件。建议使用此位置,但并非必需。
b. 保存 ca-bundle.crt。
c. 在 <HTTPSERVER_HOME>\conf\sslvhostconf.d 中创建 sslclientauth.conf 文件。
d. 将 SSLCACertificateFile 添加到 <PATH_TO>\ca-bundle.crt,使其引用 ca-bundle.crt 文件。例如:
SSLCACertificateFile
<HTTP_Server>\conf\ca-bundle.crt
e. 保存更改。
2. 将 ThingWorx 客户端证书添加到 PTC HTTP 服务器的受信任 CA 证书列表。
a. 编辑您之前在 SSLCACertificateFile 条目中所指向的 ca-bundle.crt 文件。
b. 编辑 ca-bundle.crt 并粘贴 ThingWorx 客户端证书的 PEM 文件内容。
c. 保存更改。
3. 针对 sslClientAuth URL 配置 PTC HTTP 服务器。
a. 在 <windchill-home>/codebase/wt.properties 的 wt.webapp.name 条目中查找 Windchill Web 应用程序名称。
b. 打开 shell 或命令提示符,然后输入以下内容:
cd <HTTPSERVER_HOME>ant -f webAppConfig.xml -DappName=[windchill-web-app] -Dresource=sslClientAuth -DresourceAuthType=sslClientAuth addAuthResource
c. 将 Windchill 配置为信任 ThingWorx 证书。
i. 编辑 <windchill-home>/codebase/WEB-INF/web.xml。
ii. 查找 <filter-name>TrustedSSLAuthFilter</filtername>。
iii. 在现有的 <init-param> 元素后添加另一个这样的元素,其中 [cert-name] 为证书的名称。
以下示例可供参考:
示例 1
|
示例 2
|
<init-param> <param-name>trustedSubjectPattern.1</param-name> <param-value>[cert-name]</param-value> </init-param>
在上面的示例中,将 [cert-name] 替换为证书“主题”中提供的证书名称。例如,如果证书的“主题”是 CN=navigate.domain.com,则将 [cert-name] 替换为 navigate.domain.com。
|
<init-param> <param-name>trustedSubjectPattern.1</param-name> <param-value>.*[cert-name].*</param-value> </init-param>
在上面的示例中,将 [cert-name] 替换为证书“主题”中提供的证书名称。例如,如果证书的“主题”是 CN=navigate.domain.com,则将 [cert-name] 替换为 navigate。
|
d. 保存更改。
e. 重新启动 Windchill 和 PTC HTTP 服务器。