- 使用spring boot连接vault(在https上托管)时,我收到以下错误。org. springframework. vault. authentication. VaultLoginException:无法使用org. springframework. web. client登录。资源访问异常:对"www.example.com"的POST请求时出现I/O错误:sun. security. validator.验证器异常:https://10.166.181.83:31975/v1/auth/cert/login安全性提供程序证书路径生成器异常:找不到到请求目标的有效证书路径;嵌套异常是javax.net.ssl.SSLHandshakeException:sun.security.validator.ValidatorException:PKIX路径构建失败:安全性提供程序证书路径生成器异常:无法找到所请求目标的有效证书路径我的pom.xml是www.example.com spring-cloud-starter-vault-config sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested targetMy pom.xml is**org.springframework.cloud spring-cloud-starter-vault-config
While connectiong to localhost vault server which is on http , everything works fine.
Could anyone please help me on this?
**bootstrap.properties is :**
spring.cloud.vault.scheme=https
spring.cloud.vault.kv.enabled=true
spring.cloud.vault.generic.enabled=true
spring.cloud.vault.generic.backend=configuration-server
spring.cloud.vault.generic.default-context=credentials
spring.cloud.vault.connection-timeout=5000
spring.cloud.vault.read-timeout=15000
spring.cloud.vault.config.order=-10
spring.cloud.vault.authentication=CERT
spring.cloud.vault.ssl.cert-auth-path=cert
spring.cloud.vault.ssl.trust-store-location=classpath:vault.jks
spring.cloud.vault.ssl.trust-store-password=ril@12345
management.endpoints.web.exposure.include=*
management.endpoint.env.post.enabled=true
spring.cloud.vault.uri=https://../../../
spring.cloud.vault.token=hvs.XXXXXXXX
1条答案
按热度按时间kokeuurv1#
看起来你正在使用URI中的IP地址连接到https。这会导致SSL错误(因为证书是基于名称而不是IP的)。所以。你可以使用keytool将证书添加到受信任列表中,或者添加代码来忽略证书验证(取决于你如何连接,这将有所不同https://howtodoinjava.com/java/java-security/bypass-ssl-certificate-checking-java/有一些示例,其中一个可能适合)。