OCSP 응답자가 없습니까?


13

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이 왜 로컬 발급자 인증서를 얻을 수 없습니다 '라는 오류가 발생합니까?

좋아, 구글과 다시 시도하십시오. 동일한 루틴, 인증서 캡처, 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 서버가 더 이상 중요하지 않다고 생각합니까?


openssl ocsp에 -noverify를 추가하려고 했습니까?

-noverify는 첫 번째 경우에 작동하지만 질문 1의 오류를 설명하지는 않지만 제거합니다. 로컬 발급자 인증서를 찾을 수없는 이유를 여전히 이해하지 못합니다.
Robert Weaver

답변:


6

1)에 대하여

OCSP에는 응답을 인증하는 데 사용되는 "응답 서명 키 / 인증서 쌍"이 있습니다. 이 인증서는 다음에 대한 응답으로 제공됩니다.

$ openssl ocsp -issuer chain.pem -cert wikipedia.pem -url http://ocsp2.globalsign.com/gsorganizationvalsha2g2 -header "HOST" "ocsp2.globalsign.com" -resp_text
-----BEGIN CERTIFICATE-----
[...]
UMiqxBNugzQ=
-----END CERTIFICATE-----

서명을 signcert.pem에 저장하고 무슨 일이 일어나는지 봅시다 :

$ openssl ocsp -issuer chain_wikipedia.pem -cert wikipedia.pem -url http://ocsp2.globalsign.com/gsorganizationvalsha2g2 -header "HOST" "ocsp2.globalsign.com" -resp_text | sed -n '/-----BEGIN/,/-----END/p' > signcert.pem
$ openssl verify signcert.pem
signcert.pem: C = BE, O = GlobalSign nv-sa, CN = GlobalSign OV CA - SHA256 - G2 OCSP responder - 2, serialNumber = 20150914163800
error 20 at 0 depth lookup:unable to get local issuer certificate

알았어 ... 중간체가 빠진 것 같아?

$ openssl x509 -noout -text -in signcert.pem  | grep -e 'Issuer:' -e '.crt'
Issuer: C=BE, O=GlobalSign nv-sa, CN=GlobalSign Organization Validation CA - SHA256 - G2

좋아, 발급자 URI 필드가 없습니다 ... 더럽습니다. CA에서 가져 와서 체인을 만들어 봅시다.

$ curl https://secure.globalsign.com/cacert/gsorganizationvalsha2g2r1.crt | openssl x509 -inform der -outform pem >> signcert.pem

좋아, 이것은 ... :

$ openssl ocsp -VAfile signcert.pem -issuer chain_wikipedia.pem -cert wikipedia.pem -url http://ocsp2.globalsign.com/gsorganizationvalsha2g2 -header "HOST" "ocsp2.globalsign.com" -resp_text
[...]
-----BEGIN CERTIFICATE-----
[...]
/TiSgNCpgNg=
-----END CERTIFICATE-----
Response Verify Failure

... WTF ?! 오, 다른 서명 증명서?!

$ cat >> signcert.pem
-----BEGIN CERTIFICATE-----
MIID9DCCAtygAwIBAgISESEjxqkycL2lZt0CfS9OgUN2MA0GCSqGSIb3DQEBCwUA
MGYxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMTwwOgYD
VQQDEzNHbG9iYWxTaWduIE9yZ2FuaXphdGlvbiBWYWxpZGF0aW9uIENBIC0gU0hB
MjU2IC0gRzIwHhcNMTUwODIwMTgxOTQxWhcNMTUxMTIwMTgxOTQxWjB9MQswCQYD
VQQGEwJCRTEZMBcGA1UEChMQR2xvYmFsU2lnbiBudi1zYTE6MDgGA1UEAxMxR2xv
YmFsU2lnbiBPViBDQSAtIFNIQTI1NiAtIEcyIE9DU1AgcmVzcG9uZGVyIC0gMTEX
MBUGA1UEBRMOMjAxNTA4MjAyMDE4MDAwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
ggEKAoIBAQC+8xxGkIda/04pKK3AXuLz8S8EH4qouLbP/lrd+DFY1oI8fU4kosO+
WjvBPMeK1ZvvR6YjcNhIRsoYsDWdvhMv8/qvu1GQBrs1oC2910lg3fGIR48LR6TR
+XYC1jFv0IHaF5vp+e2nu3diJi7FKHMbP5jVdd1e6cuEcrq+pEW7WkPDQnhzh6U/
GGdhxbH8uk4KPH42Os0Rf6la99EyXzJZ8zccy0ySGnIOF5Km1efXg0qwx3PEk3MQ
fbFG3n4zE7lwBsrEgACI+V9K50tWfJIAm8Ll/xpGhvqF+6swCr0WExMcqaNpdVsf
hiHFD18k8v4R6t7ht+cWx1YvSSA+/hz3AgMBAAGjgYQwgYEwCQYDVR0TBAIwADAO
BgNVHQ8BAf8EBAMCB4AwEwYDVR0lBAwwCgYIKwYBBQUHAwkwDwYJKwYBBQUHMAEF
BAIFADAdBgNVHQ4EFgQU8haQnheoUW3t3+j0OaxZMUgEjIkwHwYDVR0jBBgwFoAU
lt5h8b0cFilTHMDMfTuDAEDmGnwwDQYJKoZIhvcNAQELBQADggEBAH0MXy5hmHXc
G88ntZ2YcM3C6AAVqpfZ2+KYwL06cjmAFvNx6nWUN2w5MD59fiQC3DENCvlEGe29
d9+zsPM4hwEVRGKBIDueXycI0BNRAViacaks4OqRcc8gi1SBE5j94yt1kfp6VBhc
yQBU4Cg5UBy4OA3SsnYdt/Ur1Xm+BDlpi5WWROM1O5UECquLU3/P1prxF78EkTdv
OSGtP1VLMS47hk5v+sUC3hnfwUyKnr2oiVV6CvxxLOipdeDGl68dVisauNf7Dp9H
YvO8OLkN9es+R2AV5iFIzLWHjsQxLOrY18bi6N0zMP7tuZIRSVpil+b49KJ8T/e1
/TiSgNCpgNg=
-----END CERTIFICATE-----
^D

손가락이 넘어 ...

$ openssl ocsp -VAfile signcert.pem -issuer chain_wikipedia.pem -cert wikipedia.pem -url http://ocsp2.globalsign.com/gsorganizationvalsha2g2 -header "HOST" "ocsp2.globalsign.com"
Response verify OK
wikipedia.pem: good
        This Update: Sep 15 17:01:20 2015 GMT
        Next Update: Sep 16 05:01:20 2015 GMT

그럼 당연하지!

당사 사이트를 사용함과 동시에 당사의 쿠키 정책개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.