简体   繁体   English

maven“无法找到所请求目标的有效证书路径” - letsencrypt ssl证书

[英]maven is “unable to find valid certification path to requested target” - letsencrypt ssl certificate

I recently switched to letsencrypt certificates for my maven repo (Artifactory behind Apache proxy). 我最近切换到了我的maven repo的letsencrypt证书(Apache代理背后的Artifactory)。 Repo access via browser works fine, showing no problems with the certificate (screenshot below). 通过浏览器进行回访访问工作正常,证明证书没有问题(下面的截图)。

It also works if I import the certificate manually into the java keystore . 如果我手动将证书导入java密钥库,它也可以工作。

But according to this SO question, Java should accept letsencrypt certificates starting with 8u101 . 但根据这个问题, Java应该接受以8u101开头的letsencrypt证书

I am always getting this exception: 我总是得到这个例外:

sun.security.validator.ValidatorException:
PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target -> [Help 1]

在此输入图像描述

在此输入图像描述

C:\myproject>mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: C:\maven
Java version: 1.8.0_112, vendor: Oracle Corporation
Java home: C:\jdk1.8_win64\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"

Finally figured it out, 3 months later... 终于弄明白了,3个月后......

The apache server in front of the maven artifactory repository was not configured to provide the intermediate certificate in the chain. maven artifactory存储库前面的apache服务器未配置为在链中提供中间证书。

I downloaded the intermediate certificate - Let's Encrypt Authority X3 (IdenTrust cross-signed) - and configured apache to serve it, too. 我下载了中间证书 - 让加密权限X3(IdenTrust交叉签名) - 并配置了apache来提供服务。

Actually, the domain.crt file contains both the domain and the intermediate certificate, and for all of my test browsers that was always good enough. 实际上, domain.crt文件包含域和中间证书,并且对于我的所有测试浏览器来说总是足够好。 But the eclipse/maven setup on that one machine could not handle it. 但是那台机器上的eclipse / maven设置无法处理它。

I only started to look into the apache config after an SSL Labs check told me that the certificate chain was incomplete (even though no browser seemed to care). SSL实验室检查告诉我证书链不完整(即使没有浏览器似乎在乎)之后,我才开始研究apache配置。

Before: 之前:

  SSLEngine On
  SSLCertificateFile "path/to/domain.crt"
  SSLCertificateKeyFile "path/to/domain.key"

After: 后:

  SSLEngine On
  SSLCertificateFile "path/to/domain.crt"
  SSLCertificateKeyFile "path/to/domain.key"
  SSLCertificateChainFile "path/to/letsencrypt-authority-x3-identrust.pem"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM