HTTPS 调用未为相应站点引用正确的 SSL 证书
HTTPS call not referring the correct SSL certificate for the corresponding site
我有两个在 Apache Web 服务器上运行的 coldfusion 应用程序
两者都有自己的 SSL 证书,并在 httpd-ssl.conf
文件中配置,每个站点都使用基于名称的虚拟主机。
当我进行从 Site1.com 到 Site2.com 的 HTTPS 调用时,
httpService = new http();
httpService.setMethod("get");
httpService.setUrl("https://site2.com/comp.cfc?method=amethod&ID=12");
result = httpService.send().getPrefix();
它给出以下错误
I/O Exception: hostname in certificate didn't match: <site2.com> != <site1.com>
其实应该使用site2的SSL证书。但不确定为什么它使用 Site1 的 SSL 证书并给出错误。
您需要将 SSL 证书导入 ColdFusion/Java 密钥库。如果这没有帮助,请在 jvm.config 中为 ColdFusion 添加 -Djavax.net.debug=all。这将需要重新启动 CF 服务。然后尝试 SSL 调用。
这看起来像是服务器名称指示 (SNI) 问题。 SNI 是一个 TLS 扩展,允许在同一台服务器上托管多个 HTTPS 服务器。
您可以使用以下方式确认此问题:
echo "" | openssl s_client -connect site2.com:443 | openssl x509 -noout -subject
如果您看到类似 CN=site1.com
的内容,试试这个:
echo "" | openssl s_client -connect site2.com:443 -servername site2.com | openssl x509 -noout -subject
如果你得到 CN=site2.com
,这是一个 SNI 问题。
你可以看看这个bug,更具体地说这个评论:
The SNI support has been added in ColdFusion 11. The change required for supporting this is quite big and therefore it can't be backported to ColdFusion 10.
其他解决方法可能是在 2 台单独的服务器上托管您的 2 个 HTTPS 站点,以设置一个对两个名称均有效的唯一 SSL 证书(使用 X509 SubjectAltName 扩展名)或 禁用证书 CN 验证(如果可能)。
我有两个在 Apache Web 服务器上运行的 coldfusion 应用程序
两者都有自己的 SSL 证书,并在 httpd-ssl.conf
文件中配置,每个站点都使用基于名称的虚拟主机。
当我进行从 Site1.com 到 Site2.com 的 HTTPS 调用时,
httpService = new http();
httpService.setMethod("get");
httpService.setUrl("https://site2.com/comp.cfc?method=amethod&ID=12");
result = httpService.send().getPrefix();
它给出以下错误
I/O Exception: hostname in certificate didn't match: <site2.com> != <site1.com>
其实应该使用site2的SSL证书。但不确定为什么它使用 Site1 的 SSL 证书并给出错误。
您需要将 SSL 证书导入 ColdFusion/Java 密钥库。如果这没有帮助,请在 jvm.config 中为 ColdFusion 添加 -Djavax.net.debug=all。这将需要重新启动 CF 服务。然后尝试 SSL 调用。
这看起来像是服务器名称指示 (SNI) 问题。 SNI 是一个 TLS 扩展,允许在同一台服务器上托管多个 HTTPS 服务器。
您可以使用以下方式确认此问题:
echo "" | openssl s_client -connect site2.com:443 | openssl x509 -noout -subject
如果您看到类似 CN=site1.com
的内容,试试这个:
echo "" | openssl s_client -connect site2.com:443 -servername site2.com | openssl x509 -noout -subject
如果你得到 CN=site2.com
,这是一个 SNI 问题。
你可以看看这个bug,更具体地说这个评论:
The SNI support has been added in ColdFusion 11. The change required for supporting this is quite big and therefore it can't be backported to ColdFusion 10.
其他解决方法可能是在 2 台单独的服务器上托管您的 2 个 HTTPS 站点,以设置一个对两个名称均有效的唯一 SSL 证书(使用 X509 SubjectAltName 扩展名)或 禁用证书 CN 验证(如果可能)。