AWS 弹性搜索域的 Route53 给出证书错误

Route53 for AWS Elastic Search Domain gives certificate error

我在弗吉尼亚州创建了一个 AWS 弹性搜索域并获得了一个端点 url。

现在我想围绕它配置 Route53 行为,以便调用者可以使用相同的 url,即使在弹性搜索或灾难恢复的情况下有一些变化。

所以,

Virginia Route 53 -- 1 指向 -- Virginia Elastic Search Domain URL 俄勒冈州 53 号公路——2 个指向——俄勒冈州弹性搜索域 URL 53 号干线 -- 3 点到 -- 53 号公路 1 或 2

我已经创建了这些,还创建并上传了带有正确 SAN 条目的 SSL 证书。但是当我执行时,

curl https://mainroute53/health
curl https://virginiaroute53/health
curl https://oregonroute53/health

我收到这个错误,

curl: (51) Unable to communicate securely with peer: requested domain name does not match the server's certificate.

但是当我直接调用 Elastic Search 时 URL 它的工作。所以我知道这是我使用证书的方式的问题。任何帮助表示赞赏。

您的 Elastic Search 端点将始终 return Elastic Search SSL 证书。

因此,当您为其创建 Route 53 "alias" 时,您可能会通过自定义 DNS 条目连接到它,但 Elastic Search 仍将使用 Elastic Search SSL 证书。

由于您使用的 DNS 端点与 SSL 证书不匹配,您会收到该错误。

您可以使用 --insecure curl 标志使其不检查 SSL 证书,但是这样做存在风险。

您可以使用 http 端点而不是 https 一个

curl **http**://mainroute53/health

这解决了 AWS 不允许在其 managed Elastic service

中提供自定义域证书这一事实

您可以通过在 Elasticsearch 域前面设置代理服务器来解决这个问题,尽管这有点愚蠢,因为 Elasticsearch 域中似乎也有一个 ELB。嗯嗯

The domain Amazon ES creates for you includes the nodes in the Elasticsearch cluster and resources from several AWS services. When Amazon ES creates your domain, it launches instances into a service-controlled VPC. Those instances are fronted by Elastic Load Balancing (ELB), and the endpoint for the load balancer is published through Route 53. Requests to the domain pass through the ELB load balancer, which routes them to the domain’s EC2 instances.

https://aws.amazon.com/blogs/database/set-access-control-for-amazon-elasticsearch-service/

使用自定义域名访问 Elasticsearch 的一种方法是使用 API 网关作为 HTTP 代理。但是随后您必须处理身份验证部分,因为 ES 的 Cognito cookie 将指向原始域 (*.es.amazonaws.com)。

根据我的经验,这是可行的,您应该能够使用 API 网关(加上自定义域名和 Route 53)来实现您想要的(在 ES 上拥有自定义域名)。只是它需要一些 Cognito 知识,很可能还需要一些编码(以处理 cookie 问题)。

我们遇到了同样的问题,希望使用更友好的 DNS 名称重定向到 Kibana,我们使用了带有 S3 存储桶和重定向的解决方案 here

步骤:

  • 创建一个任意名称的 S3 存储桶。
  • 在存储桶属性中,启用“静态网站托管”。
  • 在静态网站托管属性中,select“重定向请求”选项。
  • 在目标域中设置来自您的 elasticsearch 域的 Kibana URL:即 https://vpc-es-randomstring.us-east-1.es.amazonaws.com/_plugin/kibana/
  • 将协议设置为 https
  • 然后在 guide above
  • 上按照 Step 5 中的步骤进行操作