TrustStore系统属性价值未与Micronaut生效,OpenJDK 17 - ' Interacsible Trust Store'

发布于 2025-02-04 21:50:50 字数 1103 浏览 3 评论 0 原文

我想使用开放式JDK 17和Micronaut的自定义信托店。

我想访问类似于 - https://gitlab.com/api.com/api/v4/ feature_flags/unusth/42

我已将属于主机的证书添加到自定义信托店。

我尝试使用application.yml以及VM参数来设置自定义信托存储店值。我还在打印GetProperty,以确保在应用程序启动时已更新信托店的值。

这是我设置的两个属性

  1. -javax.net.ssl.truststore
  2. 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 -

  1. javax.net.ssl.trustStore
  2. 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初心 2025-02-11 21:50:50

您应该能够通过Micronaut配置属性配置自定义信任存储。请参阅

eg in application.yaml:

micronaut:
  http:
    client:
      ssl:
        trust-store:
          path: file:/trustedcerts/custom-truststore.p12
          password: 123456
          type: PKCS12

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:

micronaut:
  http:
    client:
      ssl:
        trust-store:
          path: file:/trustedcerts/custom-truststore.p12
          password: 123456
          type: PKCS12

If you use service-clients you can even configure it for each service seperately.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文