我想使用开放式JDK 17和Micronaut的自定义信托店。
我想访问类似于 - https://gitlab.com/api.com/api/v4/ feature_flags/unusth/42
我已将属于主机的证书添加到自定义信托店。
我尝试使用application.yml以及VM参数来设置自定义信托存储店值。我还在打印GetProperty,以确保在应用程序启动时已更新信托店的值。
这是我设置的两个属性
- -javax.net.ssl.truststore
- javax.net.ssl.truststorepassword,
但是当我尝试调用URL时,我会收到错误 -
上找到有效的认证目标
sun.security.Validator.Validatorexception:PKIX PATH构建失败:Sun.Security.Provider.CertPath.CertPath.SuncertPathBuildErexception:无法在启用SSL DEBUG LOGS -
javax.net.ssl|DEBUG|17|restartedMain|2022-06-06 09:07:35.247 EST|TrustStoreManager.java:161|Inaccessible trust store: truststore.jks
javax.net.ssl|DEBUG|17|restartedMain|2021-06-06 09:07:35.248 EST|TrustStoreManager.java:112|trustStore is: C:\Program Files\Java\jdk-17.0.2\lib\security\cacerts
关于如何解决的任何想法?
我如何覆盖TrustStorManager路径?为什么说难以访问的信任商店?
注意:我在Citrix VM机器上,我没有在默认的cacerts中添加证书的权限。
I want to use custom truststore with open jdk 17 and micronaut.
I want to access link similar to - https://gitlab.com/api/v4/feature_flags/unleash/42
I have added certificate belonging to the host to custom truststore.
I tried to setup custom truststore value using application.yml as well as VM arguments. I am also printing getProperty to ensure the truststore value has been updated when application is up.
Here are the 2 properties I am setting -
- javax.net.ssl.trustStore
- javax.net.ssl.trustStorePassword
However when I try to call the URL, I get error -
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
On enabling ssl debug logs, I see lines like below -
javax.net.ssl|DEBUG|17|restartedMain|2022-06-06 09:07:35.247 EST|TrustStoreManager.java:161|Inaccessible trust store: truststore.jks
javax.net.ssl|DEBUG|17|restartedMain|2021-06-06 09:07:35.248 EST|TrustStoreManager.java:112|trustStore is: C:\Program Files\Java\jdk-17.0.2\lib\security\cacerts
Any ideas on how this can be fixed?
How can I override TrustStoreManager path? Why is it saying Inaccessible trust store?
Note: I am on citrix VM machine, where I dont have permissions to add certs to default cacerts.
发布评论
评论(1)
您应该能够通过Micronaut配置属性配置自定义信任存储。请参阅
eg in application.yaml:
If you use service-clients you can even configure it for each service单独。
You should be able to configure your custom trust store via micronaut configuration properties. See https://docs.micronaut.io/latest/guide/configurationreference.html#io.micronaut.http.client.ServiceHttpClientConfiguration.ServiceSslClientConfiguration.DefaultTrustStoreConfiguration
e.g. in application.yaml:
If you use service-clients you can even configure it for each service seperately.