简体   繁体   English

AWS Elastic Search Domain 的 Route53 给出证书错误

[英]Route53 for AWS Elastic Search Domain gives certificate error

I have create a AWS elastic search domain in Virginia and got a Endpoint url.我在弗吉尼亚州创建了一个 AWS 弹性搜索域并获得了一个端点 URL。

在此处输入图片说明

Now I wanted to configure the Route53 behavior around it, so that a caller can use the same url, even though there is some change in elastic search or in case of a disaster recovery.现在我想围绕它配置 Route53 行为,以便调用者可以使用相同的 url,即使弹性搜索或灾难恢复有一些变化。

So,所以,

Virginia Route 53 -- 1 Points to -- Virgina Elastic Search Domain URL Oregon Route 53 -- 2 Points to -- Oregon Elastic Search Domain URL Main Route 53 -- 3 Points to -- Route 53 1 or 2 Virginia Route 53 -- 1 Points to -- Virgina Elastic Search Domain URL Oregon Route 53 -- 2 Points to -- Oregon Elastic Search Domain URL Main Route 53 -- 3 Points to -- Route 53 1 or 2

I have already create these and also created and uploaded SSL certificate with correct SAN entries.我已经创建了这些,还创建并上传了带有正确 SAN 条目的 SSL 证书。 But when I execute,但是当我执行时,

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

I am getting this error,我收到此错误,

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

But when I am calling the Elastic Search URL directly its working.但是当我直接调用 Elastic Search URL 时它的工作原理。 So I understand this is a issue with the way I am using the certificate.所以我知道这是我使用证书的方式的问题。 Any help appreciated.任何帮助表示赞赏。

Your Elastic Search endpoint will always return the Elastic Search SSL certificate.您的 Elastic Search 终端节点将始终返回 Elastic Search SSL 证书。

So when you create a Route 53 "alias" for it, you may be connecting to it via your custom DNS entry, but Elastic Search will still use the Elastic Search SSL certificate.因此,当您为其创建 Route 53“别名”时,您可能会通过自定义 DNS 条目连接到它,但 Elastic Search 仍将使用 Elastic Search SSL 证书。

Since the DNS endpoint you're using does not match the SSL certificate, you get that error.由于您使用的 DNS 端点与 SSL 证书不匹配,因此您会收到该错误。

You could use the --insecure curl flag to have it not check the SSL certificate, however, there are risks of doing that.您可以使用--insecure curl 标志让它不检查 SSL 证书,但是,这样做存在风险。

You can probably work around this by setting up a proxy server in front of the Elasticsearch domain, although it's kind of silly since there appears to also be an ELB inside the Elasticsearch domain.您可以通过在 Elasticsearch 域前设置代理服务器来解决此问题,尽管这有点愚蠢,因为 Elasticsearch 域中似乎也有一个 ELB。 Ah well.嗯。

The domain Amazon ES creates for you includes the nodes in the Elasticsearch cluster and resources from several AWS services. Amazon ES 为您创建的域包括 Elasticsearch 集群中的节点和来自多个 AWS 服务的资源。 When Amazon ES creates your domain, it launches instances into a service-controlled VPC.当 Amazon ES 创建您的域时,它会在服务控制的 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.这些实例以 Elastic Load Balancing (ELB) 为前端,负载均衡器的端点通过 Route 53 发布。对域的请求通过 ELB 负载均衡器,后者将它们路由到域的 EC2 实例。

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

One way you can access Elasticsearch using your custom domain name is to use an API Gateway as an HTPP proxy.您可以使用自定义域名访问 Elasticsearch 的一种方法是使用 API 网关作为 HTPP 代理。 But then you have to deal with the authentication part since the Cognito cookies for ES will be pointing to the original domain ( *.es.amazonaws.com ).但是您必须处理身份验证部分,因为 ES 的 Cognito cookie 将指向原始域 ( *.es.amazonaws.com )。

In my experience this is doable and you should be able to use API Gateway (plus Custom Domain Names and Route 53) to achieve what you want (having a custom domain name over ES).根据我的经验,这是可行的,您应该能够使用 API Gateway(加上自定义域名和 Route 53)来实现您想要的(通过 ES 拥有自定义域名)。 It's just that it requires some Cognito knowledge and most likely, some coding (to handle the cookie problem).只是它需要一些 Cognito 知识,并且很可能需要一些编码(以处理 cookie 问题)。

You can use the http endpoint instead of the https one您可以使用http端点而不是https端点

ie

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

This works around the fact that AWS does not allow providing custom domain certificate in its managed Elastic service这可以解决 AWS 不允许在其托管的Elastic服务中提供自定义域证书的事实

We had the same issue, wanted to be redirected to Kibana with a more friendlier DNS name and we used the solution with S3 bucket and the redirection as described here .我们有同样的问题,希望被重定向到Kibana一个更友好的DNS名称,我们使用S3存储解决方案,并重定向描述这里

The steps:步骤:

  • Create a S3 bucket with any name.创建一个任意名称的 S3 存储桶。
  • In the bucket properties, enable “Static Website hosting”.在存储桶属性中,启用“静态网站托管”。
  • In the Static WebSite hosting properties, select the option to “Redirect Requests”.在静态网站托管属性中,选择“重定向请求”选项。
  • In the target domain set the Kibana URL that is given from your elasticsearch domain: ie https://vpc-es-randomstring.us-east-1.es.amazonaws.com/_plugin/kibana/在目标域中设置从您的 elasticsearch 域提供的 Kibana URL:即https://vpc-es-randomstring.us-east-1.es.amazonaws.com/_plugin/kibana/
  • Set Protocol to https将协议设置为https
  • Then follow the steps from Step 5 on the guide above然后按照上述指南中Step 5中的Step 5进行操作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM