从 Wildfly 访问密钥库时出现证书问题

问题描述

在 docker 镜像 jboss/wildfly:21.0.0 上运行。最终此代码生成证书问题:

ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder()
                .clientId(System.getenv("AZURE_CLIENT_ID"))
                .clientSecret(System.getenv("AZURE_CLIENT_SECRET"))
                .tenantId(System.getenv("AZURE_TENANT_ID"))
                .build();

        // Azure SDK client builders accept the credential as a parameter
        SecretClient secretClient = new SecretClientBuilder()
                .vaultUrl("....")
                .credential(clientSecretCredential)
                .buildClient();

异常:

sun.security.validator.ValidatorException:PKIX 路径构建失败: sun.security.provider.certpath.SunCertPathBuilderException:无法 找到到请求目标的有效认证路径

我已经从我使用的密钥库和 login.microsoftonline.com 使用以下导入了证书:

RUN echo -n | openssl s_client -connect [mykeyavult_host]:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > \
/opt/jboss/wildfly/standalone/configuration/kv.cert

RUN echo -n | openssl s_client -connect login.microsoftonline.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > \
/opt/jboss/wildfly/standalone/configuration/ms-login.cert

。 . .

#Add kv cert to keystore

RUN echo yes | keytool -importcert -alias lsl-kv -keystore /opt/jboss/wildfly/standalone/configuration/store.jks \
-storepass this_is_no_secret -file /opt/jboss/wildfly/standalone/configuration/kv.cert

#Add ms-login cert to keystore
RUN echo yes | keytool -importcert -alias ms-login -keystore /opt/jboss/wildfly/standalone/configuration/store.jks \
-storepass this_is_no_secret -file /opt/jboss/wildfly/standalone/configuration/ms-login.cert

在 docker 外运行 wildfly 我设法摆脱了证书问题。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...