apache - 从外部应用程序到 apache httpd Web 服务器的 httpS 调用问题
问题描述
我们的应用程序 API 部署在 jboss 容器中,并通过 apache httpd Web 服务器(2.4.48)启用访问。外部应用程序正在通过 Web 服务器访问我们的 API。
使用以下配置通过 https 启用 Web 服务器访问
<VirtualHost {SystemIP}:{somePort}>
ServerName abc.org.com
ErrorLog /www/home/logs/error_log
SSLEngine on
SSLCertificateFile /home/apache/http/ssl/server.crt
SSLCertificateKeyFile /home/apache/http/ssl/server.key
SSLCertificateChainFile /home/apache/http/ssl/ca-bundle.crt
...
</VirtualHost>
server.key包含私钥,server.crt包含 CA 签名的服务器证书,ca-bundle.crt包含根证书和中间证书以及由外部应用程序团队共享的外部服务器证书。
当他们尝试通过 https ( https://abc.org.com )访问我们的 API 时,客户端应用程序的PKIX 路径构建失败
从我们的 apache 服务器 ssl 日志显示以下错误
[Mon Sep 06 05:34:54.321808 2021] [ssl:info] [pid 111:tid 12345] [client 160.82.161.2:46108] AH02008: SSL library error 1 in handshake (server ...)
[Mon Sep 06 05:34:54.321860 2021] [ssl:info] [pid 111:tid 140138261788416] SSL Library Error: error:14094416:SSL routines:ssl3_read_bytes:sslv3 alert certificate unknown (SSL alert number 46)
但是我们可以从浏览器访问https://abc.org.com并且证书工作正常。
我们在这里缺少什么?在哪里将外部应用程序证书添加到 Web 服务器?
客户端 SSL 日志
***
%% Invalidated: [Session-6, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384]
ExternalApplication-1, SEND TLSv1.2 ALERT: fatal, description = certificate_unknown
ExternalApplication-1, WRITE: TLSv1.2 Alert, length = 2
[Raw write]: length = 7
0000: 15 03 03 00 02 02 2E .......
ExternalApplication-1, called closeSocket()
ExternalApplication-1, handling exception: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
2021-09-02 14:57:00.944 ERROR [ExternalApplication-1] c.d.p.AccountHolder - Error while processing AccountHolder serviceI/O error on POST request for "abc.com/apiPath": sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
解决方案
正如 ezra-s 正确指出的那样,客户端应用程序中的证书加载存在问题。正确导入证书后,问题已解决。
推荐阅读
- xml - 带有命名空间的不相交的 xml 文件
- ethereum - 保护关于solidity的敏感信息的最佳实践?
- python - Python 3.9:从日期时间(元组)的错误时区偏移
- php - wordpress首页的分页问题
- chainlink - 在构建 Chainlink.Request 时,Chainlink 中的 path 和 copyPath 有什么区别?
- javascript - 获取 TypeError:“路径”未定义:使用 JavaScript 为 Windows 执行串行端口程序时未定义
- javascript - Mongodb连接不上
- haskell - 堆栈似乎没有应用包修订
- javascript - 在 c# 中将对象作为函数参数传递,就像在 javascript 中一样
- angular - 我可以更改离子搜索栏角度的样式吗?