我正在尝试设置OCSP验证例程,因此想先适应环境。在例如OpenSSL上找到了出色的教程:针对OCSP手动验证证书。
出现多个问题,请耐心等待。
自该教程以来,已经进行了一些更改,但是我认为要点是:
1)截取您要验证的证书,例如
openssl s_client -connect wikipedia.org:443 2>&1 < /dev/null | sed -n '/-----BEGIN/,/-----END/p' > wikipedia.pem
2)建立证书链,例如
openssl s_client -connect wikipedia.org:443 -showcerts 2>&1 < /dev/null > chain.pem
然后进行适当的编辑。我发现上面没有提供自签名CA证书GlobalSignRootCA,因此在其中添加了证书。
3)确定ocsp URI,例如
openssl x509 -noout -ocsp_uri -in wikipedia.pem
哪个返回
http://ocsp2.globalsign.com/gsorganizationvalsha2g2
4)调用openssl ocsp客户端,例如
openssl ocsp -issuer chain.pem -cert wikipedia.pem -url http://ocsp2.globalsign.com/gsorganizationvalsha2g2
哪个返回
[woody@oc2042275410 testCerts]$ openssl ocsp -issuer chain.pem -cert wikipedia.pem -url http ://ocsp2.globalsign.com/gsorganizationvalsha2g2
Error querying OCSP responsder
140062843348808:error:27076072:OCSP routines:PARSE_HTTP_LINE1:server response error:ocsp_ht.c:250:Code=403,Reason=Forbidden
(响应者?)
我读到这是由于虚拟化问题造成的,所以
openssl ocsp -issuer chain.pem -cert wikipedia.pem -url http://ocsp2.globalsign.com/gsorganizationvalsha2g2 -header "HOST" "ocsp2.globalsign.com"
产生
Response Verify Failure
140400906352456:error:27069065:OCSP routines:OCSP_basic_verify:certificate verify error:ocsp_vfy.c:126:Verify error:unable to get local issuer certificate
wikipedia.pem: good
This Update: Apr 28 23:10:10 2015 GMT
Next Update: Apr 29 11:10:10 2015 GMT
因此,我得到了OCSP的证明,该证书是好的,但这导致了问题1: 为什么错误“无法获取本地发行者证书”?
好的,再次尝试使用Google。相同的例程,捕获证书,检查OCSP URI:
openssl x509 -noout -ocsp_uri -in google.pem
产量
http://clients1.google.com/ocsp.
很公平:
openssl ocsp -issuer gchain.pem -cert google.pem -url http://clients1.google.com/ocsp
Error querying OCSP responsder
140433209165640:error:27076072:OCSP routines:PARSE_HTTP_LINE1:server response error:ocsp_ht.c:250:Code=404,Reason=Not Found
未找到?这似乎令人惊讶。用wireshark检查:
> POST /ocsp HTTP/1.0
> Content-Type: application/ocsp-request
> Content-Length: 112
> 0n0l0E0C0A0...+..........j.....p.I.#z...(~d...U.. [.5...J:.......l..9.....{6.#0!0...+.....0......].O.9..}d`.L...
< ~HTTP/1.0 404 Not Found
< Content-Type: text/html; charset=UTF-8
< X-Content-Type-Options: nosniff
< Date: Tue, 28 Apr 2015 22:42:40 GMT
< Server: sffe
< Content-Length: 1429
< X-XSS-Protection: 1; mode=block
< Alternate-Protocol: 80:quic,p=1
<
< <!DOCTYPE html>
< <html lang=en>
< <meta charset=utf-8>
< <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
< <title>Error 404 (Not Found)!!1</title>
< <style>
< *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/errors/logo_sm_2.png) no-repeat}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/errors/logo_sm_2_hr.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:55px;width:150px}
< </style>
< <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
< <p><b>404.</b> <ins>That...s an error.</ins>
< <p>The requested URL <code>/ocsp</code> was not found on this server. <ins>That...s all we know.</ins>
这就是问题2:这是否正确,OCSP已移动,并且不在OCSP URI上? 服务器是否已经统一迁移到OCSP装订,并且不再认为OCSP服务器很重要?
您是否尝试将-noverify添加到openssl ocsp?
-noverify在第一种情况下有效,尽管不能解释问题1中的错误,只需将其删除即可。我仍然不明白为什么找不到本地发行者证书。
—
罗伯特·韦弗