我正在使用Spring构建微服务,其中配置是使用Spring分发的。配置应用程序已启用SSL。
我希望我的spring引导应用程序通过https与Config服务器通信。问题是,在从bootstrap.yml加载SSL配置之前,应用程序启动对Config的rest调用以获取配置,并在错误的情况下不幸失败:
java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on GET request for "https://host:8888/abcd/development,production": sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; nested exception is javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: 我在bootstrap.yml中配置了一个具有CA证书的信任存储库:
# MicroServices Properties
spring:
application:
name: abcd
profiles:
active: development,production
cloud:
config:
uri: https://<host>:8888
fail-fast: true
password: abc@123
username: user
server:
ssl:
trust-store: D:/Certs/caCert/server.p12
trust-store-password: keystore
key-store-provider: PKCS12任何建议,我应该做什么来创建成功的SSL通信与Config Server?
发布于 2016-10-23 09:05:11
在JRE证书存储区导入CA证书后,问题得到了解决:
keytool -importcert -alias startssl -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit -file ca.der发布于 2016-10-14 13:33:16
看来它在找到cert文件方面有问题。我会尝试这样的方法。
ssl:
trust-store: file:/Certs/caCert/server.p12更好的是,我会使用keytool将我的证书添加到keystore文件中,这样我就可以访问我的keystore文件,比如
ssl:
enabled: true
key-store: file:/Certs/keystore
key-password: keypwdhttps://stackoverflow.com/questions/40044128
复制相似问题