AWS Elastic Load Balancer 的 SSL 证书配置错误

Misconfiguration of SSL Certificate for AWS Elastic Load Balancer

我正在尝试配置 SSL 证书以通过 AWS ELB 支持 HTTPS。我已配置好所有内容:

1) 在 AWS ELB 中配置的 GoDaddy SSL 证书(包括证书链)。
2) 让 ELB 监听器看起来像这样:
客户端 ---> HTTPS --> ELB 端口 443 --> HTTP ---> 服务器端口 80
3) 在 GoDaddy 中,创建一个 CNAME 条目,如下所示:
service.acme.com CNAME 到 aws-some-region.elb.amazonaws.com
4) 如果我 curl -kv https://service.acme.com/

*   Trying 52.6.xxx.xx...
* Connected to service.acme.com (52.6.xxx.xxx) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate: pixxeen.com
* Server certificate: Go Daddy Secure Certificate Authority - G2
* Server certificate: Go Daddy Root Certificate Authority - G2
> GET / HTTP/1.1
> Host: service.acme.com
> User-Agent: curl/7.43.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Content-Type: text/html
< Date: Mon, 22 Feb 2016 14:06:08 GMT 
< ETag: W/"154-1455797592000"
< Last-Modified: Thu, 18 Feb 2016 12:13:12 GMT
< Server: Apache-Coyote/1.1
< Content-Length: 154
< Connection: keep-alive
< 
<html>
  <head>
    <title>Acme Service Application</title>
  </head>
  <body bgcolor=white>
      <p>Acme Service Application</p>
  </body>
* Connection #0 to host service.acme.com left intact

HTML 是我为 ELB 部署的一个 index.html 页面,用于请求确认 EC2 实例已启动并且 运行。

但是,我 运行 遇到的问题是,如果任何移动客户端框架命中 service.acme.com 服务端点(okhttp 或 AFNetworking),我将看到以下内容(这是一个 okhttp 调用) :

02-22 08:52:10.513 2564-2564/com.acme W/System.err: javax.net.ssl.SSLPeerUnverifiedException: Hostname service.acme.com not verified:
02-22 08:52:10.513 2564-2564/com.acme W/System.err:     certificate: sha1/+axZF3Oyaatuoio5rsmNhUUhOZE=
02-22 08:52:10.513 2564-2564/com.acme W/System.err:     DN: CN=acme.com,OU=Domain Control Validated
02-22 08:52:10.513 2564-2564/com.acme W/System.err:     subjectAltNames: [acme.com, www.acme.com]

那么,有人知道我哪里出错了吗?

我绕过 Whosebug 和 运行 进入这个 post(我见过的最详细的之一): 它似乎证实了我所做的所有步骤。

您的证书对 service.acme.com 域名无效。

它仅对确切的主机 acme.comwww 有效。 acme.com.

如果您省略 curl-k(不安全)选项(这不是一个好的测试标志,因为它有意忽略了大多数 SSL 问题),您会清楚地看到此错误

附加到 ELB 的证书将根据 cname 而不是 ELB 名称本身进行验证。如果您已将证书 x.y.z.com 附加到 ELB ,那么您的 cname 应该匹配 x.y.z.com 而不是 ELB cname。

如果你有通配符证书 *.x.y.z.com ,那么你的 cname 可以是任何东西。x.y.z.com 是合规的。