2017-04-11 196 views
2

我遇到了openssl抱怨無法驗證本地頒發的證書,我也有CA鏈。除了LOCAL CA Chain證書(CER,PEM,CRT)之外,我還有本地頒發的證書(PEM和CRT)。根和發行者是相同的服務器。比較兩個證書上的文本,兩者都匹配「issuer:」字段。這是redhat Linux服務器。 我收到錯誤「驗證錯誤:num = 20:無法獲得本地發行者證書」和「驗證返回碼:21(無法驗證第一個證書)」「驗證返回碼:21(無法驗證第一個證書)」

我不知道該找什麼。 ,任何反饋意見。

感謝

喬恩

故障排除步驟

  • 我確實添加了發行人CA證書到Linux上使用證書cerutil的certutil -d的/ etc/PKI/nssdb -A -t「 C ,,「-n DomainA1-Server1CA -i /root/DomainA1-Server1CA.cer

-Ran certutil -d/etc/pki/nss DB-L和我能看到的證書有

Certificate Nickname Trust Attributes 
          SSL,S/MIME,JAR/XPI 
    DomainA1-Server1CA  C,, 
  • 冉的OpenSSL的s_client.First -connect ServerA2:443 -CAfile /root/certs/DomainA1-Server1CA.cer,tried用(.CRT和.PEM) ,上面有2個錯誤。 -Ran openssl s_client -connect ServerA2:443 -CApath/root/certs,嘗試使用(.CRT和.PEM),上面有2個錯誤。

  • ran openssl s_client -connect ServerA2:443。上面有2個錯誤。

頒發證書片斷

Data: 
    Version: 3 (0x2) 
    Serial Number: 
    54:a9:50:a3:00:01:00:00:14:47 
    Signature Algorithm: sha1WithRSAEncryption 
    Issuer: DC=com, DC=domainA1, CN=DomainA1-Server1CA 
    Validity 
    Not Before: April 5 16:45:48 2017 GMT 
    Not After : April 5 16:45:48 2019 GMT 
    Subject: C=US, ST=NY, L=CityA, O=CompanyNAME, OU=IT, 
    CN=ServerB1.DomainA1.com 

CA證書鏈

Data: Version: 3 (0x2) 
    Serial Number: 19:11:eb:af:4c:d5:a9:94:49:ka:2f:41:f2:e1:09:g2 
    Signature Algorithm: sha256WithRSAEncryption 
    Issuer: DC=com, DC=domainA1, CN=DomainA1-Server1CA 
    Validity 
    Not Before: Aug 15 18:41:45 2015 GMT 
    Not After : Aug 15 18:41:45 2025 GMT Subject: DC=com, DC=domainA1,     
    CN=DomainA1-Server1CA Subject Public Key Info: 
    Public Key Algorithm: rsaEncryption Public-Key: (2048 bit) 

     ...C.A 
    X509v3 Key Usage: 
     Digital Signature, Certificate Sign, CRL Sign 
    X509v3 Basic Constraints: critical 
     CA:TRUE 
    X509v3 Subject Key Identifier: 

回答

0

After enabling SSL certificate on Server.

您可以通過波紋管命令來測試。

$ openssl s_client -connect <server name>:443 

輸出:

CONNECTED(00000003) 
depth=0 OU = Domain Control Validated, CN = <server-name> 
verify error:num=20:unable to get local issuer certificate 
verify return:1 
----------- 
----------- 
Start Time: 1492427495 

    Timeout : 300 (sec) 
    Verify return code: 21 (unable to verify the first certificate) 
--- 

如果你有上面的錯誤(返回碼:20 ..或返回代碼21)

添加波紋線的/ etc /的Apache2 /網站/有默認的SSL。的conf文件

SSLCertificateFile  /home/ubuntu/cert/e4720ca1b42c1ebb.crt 
SSLCertificateKeyFile /home/ubuntu/cert/server.key 

SSLCertificateChainFile /home/ubuntu/cert/gd_bundle-g2-g1.crt 

再次運行

$ openssl s_client -connect <server name>:443 

例子:$ openssl s_client -connect google.com:443

輸出:

CONNECTED(00000003) 
depth=3 C = US, O = Equifax, OU = Equifax Secure Certificate Authority 
verify return:1 
depth=2 C = US, O = GeoTrust Inc., CN = GeoTrust Global CA 
verify return:1 
depth=1 C = US, O = Google Inc, CN = Google Internet Authority G2 
verify return:1 
------------ 
------------ 
Start Time: 1492431152 
Timeout : 300 (sec) 
Verify return code: 0 (ok) 

如果仍然剛開g錯誤,您應該重新生成SSL KEY和附加服務器

注意:Apache服務器配置。

希望它會解決這個問題:)

+1

是什麼'e4720ca1b42c1ebb.crt'以及爲什麼要在這個位置添加? –