【发布时间】:2019-07-07 12:47:54
【问题描述】:
我们使用 Spring Integration 连接到 https/ssl 外部系统。使用外部主机和端口 443 添加证书后,从端口检索。证书存在。
但应用程序总是失败
> ERROR 2886 --- [ebContainer : 1] c.i.w.w.servlet.ServletWrapper : SRVE0014E: Uncaught service() exception root cause
> dispatcherServlet:
> org.springframework.web.util.NestedServletException: Request
> processing failed; nested exception is
> org.springframework.ws.client.WebServiceIOException: I/O error:
> com.ibm.jsse2.util.h: PKIX path building failed:
> java.security.cert.CertPathBuilderException: PKIXCertPathBuilderImpl
> could not build a valid CertPath.; internal cause is:
> java.security.cert.CertPathValidatorException: The certificate issued by CN=ODC somest Root CA - G1, O=ODC sonst, C=TR is
> not trusted; internal cause is:
> java.security.cert.CertPathValidatorException: Certificate chaining error; nested exception is
> javax.net.ssl.SSLHandshakeException: com.ibm.jsse2.util.h: PKIX path
> building failed: java.security.cert.CertPathBuilderException:
> PKIXCertPathBuilderImpl could not build a valid CertPath.; internal
> cause is:
> java.security.cert.CertPathValidatorException: The certificate issued by CN=ODC somest Root CA - G1, O=ODC sonst, C=PR is
> not trusted; internal cause is:
> java.security.cert.CertPathValidatorException: Certificate chaining error
如果我运行 keytool 并将证书导入 cacert,则应用程序可以工作。但是这个解决方案不被维护团队接受,因为它没有出现在 websphere 控制台中。 在春季集成请求中有什么可以改变的吗 那么我可以请任何人帮助我了解问题和解决方法吗?
更新
/srv/opt/IBM/WebSphere/AppServer/java/bin/keytool -list -v -keystore /srv/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/config/cells/K1Node01Cell/nodes/K1Node01/trust.p12 -storepass WebAS -storetype PKCS12
显示证书条目...不确定如何确认它是否完整或不正确
问题:
是否应该从端口更新 cacert 文件中检索? cacert 在 websphere jre security 中,而 trust.p12 在 profile/../nodes 中
更新 2:
我已启用跟踪并查看以下日志。是 spring 试图调查 cacerts...还是正常,因为它是 WebSphere 使用的 JRE 的一部分
> [18-2-19 13:44:59:154 ] 00000063 SystemOut O 2019-02-18
> 13:44:59.153 INFO 30426 --- [ver.startup : 0]
> pertySourcedRequestMappingHandlerMapping : Mapped URL path
> [/v2/api-docs] onto method [public
> org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json>
> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)]
> [18-2-19 13:44:59:826 ] 00000063 SystemOut O keyStore is:
> /srv/opt/IBM/WebSphere/AppServer/java/8.0/jre/lib/security/cacerts
> [18-2-19 13:44:59:826 ] 00000063 SystemOut O keyStore type is: jks
> [18-2-19 13:44:59:827 ] 00000063 SystemOut O keyStore provider is:
> [18-2-19 13:44:59:827 ] 00000063 SystemOut O init keystore
> [18-2-19 13:44:59:906 ] 00000063 SystemOut O SSLContextImpl:
> Using X509ExtendedKeyManager com.ibm.jsse2.ay [18-2-19 13:44:59:908 ]
> 00000063 SystemOut O trustStore is:
> /srv/opt/IBM/WebSphere/AppServer/java/8.0/jre/lib/security/cacerts
【问题讨论】:
-
为了确定,您确实执行了节点同步并重新启动了应用程序部署到的服务器,对吗?我认为这是应用程序在信任库中获取新证书所必需的。
-
不知道节点同步,但是重启了很多次[每次小改动后]
-
您是否还添加了 CA 的根证书和中间证书?
-
既然您在谈论控制台,我认为这是传统的 WAS 而不是 Liberty?该错误中提到的证书 是 您在 WebSphere 信任存储签名者证书中看到的证书吗?您检索到哪个信任库?我的猜测是,您将其检索到的不是正在检查的那个;我以前见过这种情况。
-
如果在您将证书添加到 cacerts 时它可以工作,那么您可能错误地创建了 SSL 连接,覆盖了 WebSphere 的默认设置。确保您的应用程序中没有类似
Security.setProperty("javax.net.ssl.trustStore", "cacerts.jks");的代码。还要确保如果证书不是自签名证书,则您已将所有父证书添加到信任库中。
标签: ssl websphere spring-integration truststore