maven 是 "unable to find valid certification path to requested target" - letsencrypt ssl 证书

maven is "unable to find valid certification path to requested target" - letsencrypt ssl certificate

我最近为我的 Maven 存储库(Apache 代理背后的 Artifactory)切换到 letsencrypt 证书。通过浏览器访问 Repo 工作正常,显示证书没有问题(下面的屏幕截图)。

如果我import the certificate manually into the java keystore也有效。

但是根据这个SO问题,

我总是遇到这个异常:

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"

终于想通了,3个月后...

maven artifactory 存储库前面的 apache 服务器未配置为提供链中的中间证书。

我下载了中间证书 - Let’s Encrypt Authority X3 (IdenTrust cross-signed) - 并配置了 apache 来提供它。

实际上,domain.crt 文件同时包含域和中间证书,对于我所有的测试浏览器来说,这一直都足够好。但是那台机器上的 eclipse/maven 设置无法处理它。

SSL Labs check 告诉我证书链不完整(尽管似乎没有浏览器关心)后,我才开始查看 apache 配置。

之前:

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

之后:

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