Сбой взаимной аутентификации Clinet-server при введении промежуточного сертификата для клиента - PullRequest
0 голосов
/ 24 октября 2019

У меня есть клиент с промежуточным сертификатом в самом сертификате клиента. Этот промежуточный сертификат подписан корневым центром сертификации, который хранится в доверенном хранилище сервера.

Теперь я выполняю команду curl: curl -v -X GET -H "Accept: application/json" -H "Accept-Challenge: SW" --cert /opt/store/certificate.pem --key /opt/store/certificate_key.pem --cacert /opt/store/cms-ca.cert -w "%{http_code}" https://127.0.0.1:2443/v1/keys/1234/transfer

Обратите внимание: certificate.pem: содержит сертификат клиента +промежуточный сертификат.

cms-ca-cert: содержит корневой CA, который находится в хранилище доверия серверов.

certficate_key.pem: закрытый ключ клиента.

Вывод:

* Connected to 127.0.0.1 (127.0.0.1) port 2443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /opt/skc/store/cms-ca.cert
  CApath: none
* NSS: client certificate from file
*       subject: CN=skcUser@ngnix
*       start date: Oct 24 05:23:17 2019 GMT
*       expire date: Oct 24 05:23:17 2020 GMT
*       common name: skcUser@ngnix
*       issuer: CN=CMS TLS Client CA,O=INTEL,L=SC,ST=SF,C=US
* NSS error -5938 (PR_END_OF_FILE_ERROR)
* Encountered end of file
* Closing connection 0
curl: (35) Encountered end of file

Я получаю следующую ошибку из журналов сервера:

Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:397) ~[na:1.8.0_191]
        at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:302) ~[na:1.8.0_191]
        at sun.security.validator.Validator.validate(Validator.java:262) ~[na:1.8.0_191]
        at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324) ~[na:1.8.0_191]
        at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:279) ~[na:1.8.0_191]
        at sun.security.ssl.X509TrustManagerImpl.checkClientTrusted(X509TrustManagerImpl.java:130) ~[na:1.8.0_191]
        at sun.security.ssl.ServerHandshaker.clientCertificate(ServerHandshaker.java:1970) ~[na:1.8.0_191]
        ... 12 common frames omitted
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141) ~[na:1.8.0_191]
        at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126) ~[na:1.8.0_191]
        at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280) ~[na:1.8.0_191]
        at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:392) ~[na:1.8.0_191]
        ... 18 common frames omitted

Я не получаю, как решить эту проблему.

...