我在使用 GlobalSign 颁发的证书在 nginx/1.6.2 上设置 OCSP 时遇到了问题。我阅读了许多相关文章,但找到的解决方案都不起作用。当我连接到服务器时,OCSP 不起作用
> openssl s_client -connect cawi.kondeor.at:443 -tls1 -tlsextdebug -status
[...] .
OCSP response: no response sent
depth=2 C = BE, O = GlobalSign nv-sa, OU = Root CA, CN = GlobalSign Root CA
verify return:1
depth=1 C = BE, O = GlobalSign nv-sa, CN = GlobalSign Domain Validation CA - SHA256 - G2
verify return:1
depth=0 OU = Domain Control Validated, CN = cawi.kondeor.at
verify return:1
---
Certificate chain
0 s:/OU=Domain Control Validated/CN=cawi.kondeor.at
i:/C=BE/O=GlobalSign nv-sa/CN=GlobalSign Domain Validation CA - SHA256 - G2
1 s:/C=BE/O=GlobalSign nv-sa/CN=GlobalSign Domain Validation CA - SHA256 - G2
i:/C=BE/O=GlobalSign nv-sa/OU=Root CA/CN=GlobalSign Root CA
---
Server certificate
-----BEGIN CERTIFICATE-----
[...]
-----END CERTIFICATE-----
subject=/OU=Domain Control Validated/CN=cawi.kondeor.at
issuer=/C=BE/O=GlobalSign nv-sa/CN=GlobalSign Domain Validation CA - SHA256 - G2
---
No client certificate CA names sent
---
SSL handshake has read 2944 bytes and written 372 bytes
---
[...]
---
并且 nginx 日志显示以下错误:
[error] 10646#0: OCSP_basic_verify() failed (SSL: error:27069065:OCSP routines:OCSP_basic_verify:certificate verify error:Verify error:unable to get issuer certificate) while requesting certificate status, responder: ocsp2.globalsign.com
我发现的所有其他帖子都与该错误有关,Verify error:unable to get LOCAL issuer certificate
该错误已通过修复证书链得到解决。我的证书链似乎没问题,因为openssl ocsp
命令有效(但前提是我使用-header "HOST" "ocsp2.globalsign.com"
CDN 带来的参数):
> openssl ocsp -issuer root_ca_and_intermediate.pem -cert signed_cert_and_intermediate.pem -url http://ocsp2.globalsign.com/gsdomainvalsha2g2 -CAfile root_ca_and_intermediate.pem -header "HOST" "ocsp2.globalsign.com" -resp_text
OCSP Response Data:
OCSP Response Status: successful (0x0)
Response Type: Basic OCSP Response
Version: 1 (0x0)
Responder Id: 32B1CE1488C41C77C67D0B2DAEFE569D3A5F4E69
Produced At: Sep 12 20:46:48 2016 GMT
Responses:
Certificate ID:
Hash Algorithm: sha1
Issuer Name Hash: D1F1B576F9EEC0C10F7AFC7C3124A9C3625D7C61
Issuer Key Hash: EA4E7CD4802DE5158186268C826DC098A4CF970F
Serial Number: 1121CD2E68A5AE7FEF7A719EDD4AE4034F8B
Cert Status: good
[...]
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
14:dd:f1:f0:75:30:57:18:61:ec:c0:2c
Signature Algorithm: sha256WithRSAEncryption
Issuer: C=BE, O=GlobalSign nv-sa, CN=GlobalSign Domain Validation CA - SHA256 - G2
Validity
Not Before: Jul 25 03:28:41 2016 GMT
Not After : Oct 25 03:28:41 2016 GMT
Subject: C=BE, O=GlobalSign nv-sa/serialNumber=201607251137, CN=GlobalSign Domain Validation CA - SHA256 - G2 - OCSP Responder
[...]
-----BEGIN CERTIFICATE-----
[...]
-----END CERTIFICATE-----
Response verify OK
signed_cert_and_intermediate.pem: good
This Update: Sep 12 20:46:48 2016 GMT
Next Update: Sep 16 20:46:48 2016 GMT
您可以在此处找到我的 nginx 配置的清理版本:http://pastebin.com/KYujwSgS
这可能是 Cloudflare 的问题,还是我忽略了什么?任何帮助都非常感谢!
答案1
感谢大家的评论!这让我再次仔细查看了证书链,我注意到我没有将根 CA 证书放入文件中root_ca_and_intermediate.pem
,而是将中间证书放入了两次。
因此,现在的工作设置是,文件signed_cert_and_intermediate.pem
包含网站的实际证书(第一个)和用于签署实际证书的中间证书(第二个)。文件root_ca_and_intermediate.pem
包含中间证书(第一个)和用于签署中间证书的根 CA 证书(第二个)。