Ubuntu 16.04, curl
버전 7.47.0 사용
SSL 인증서 문제를 디버깅하려고 하는데 curl
. 방금 실행했을 때:
ubuntu@ip-172-30-0-81:~$ curl https://myapp.com/hello
curl: (51) SSL: certificate subject name (cloud.mynameserver.com) does not match target host name 'myapp.com'
그러나 플래그를 부착하면 다음과 같습니다 -v
.
ubuntu@ip-172-30-0-81:~$ curl -v https://myapp.com/hello
* Trying {IP REDACTED}...
* Connected to myapp.com ({IP REDACTED}) port 443 (#0)
* found 173 certificates in /etc/ssl/certs/ca-certificates.crt
* found 692 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_256_GCM_SHA384
* server certificate verification OK
* server certificate status verification SKIPPED
* common name: myapp.com (matched)
* server certificate expiration date OK
* server certificate activation date OK
* certificate public key: RSA
* certificate version: #3
* subject: CN=myapp.com
* start date: Sat, 31 Dec 2016 22:57:00 GMT
* expire date: Fri, 31 Mar 2017 22:57:00 GMT
* issuer: C=US,O=Let's Encrypt,CN=Let's Encrypt Authority X3
* compression: NULL
* ALPN, server accepted to use http/1.1
> GET /hello HTTP/1.1
> Host: myapp.com
> User-Agent: curl/7.47.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: nginx/1.10.0 (Ubuntu)
< Date: Sat, 21 Jan 2017 00:25:15 GMT
< Content-Type: application/json
< Transfer-Encoding: chunked
< Connection: keep-alive
< Strict-Transport-Security: max-age=63072000; includeSubdomains
< X-Frame-Options: DENY
< X-Content-Type-Options: nosniff
<
* Connection #0 to host myapp.com left intact
{"message": "Hello World"}
맨 끝인 은 {"message": "Hello World"}
예상되는 응답입니다.
curl
상세 모드에서 실행할 때 SSL 인증서 세부 정보의 신뢰와 관련하여 다르게 동작하는 이유는 무엇입니까 ? man
내가 알 수 있는 한 이것은 페이지에 지정되어 있지 않습니다 .
답변1
동일한 호스트 이름을 가진 두 개의 서로 다른 A
(또는 IPv6의 경우) 레코드가 있는 것 같습니다 . AAAA
호스트 이름에 대한 레코드가 여러 개인 경우 해당 호스트 이름을 조회할 때마다 다른 IP 주소 라운드 로빈 스타일이 반환됩니다.
상세 모드가 있는 요청과 없는 요청을 번갈아 사용하면 IP 주소도 교대로 바뀌므로 상세 요청이 올바른 IP 주소에 도달하는 반면 상세하지 않은 요청은 잘못된 IP 주소에 도달하게 됩니다. 이것이 바로 인증서에 따라 자세한 주소에 올바른 인증서가 나타나는 이유입니다.
subject: CN=myapp.com
줄, 상세하지 않은 주소에 대한 오류에는 다른 인증서가 제공됩니다.
이에 대한 올바른 수정은 잘못된 A
기록을 제거하여 콘텐츠를 제공하도록 구성된 웹 서버의 주소만 표시하는 것입니다.