【问题标题】:Cloudfront Alternate Domain Names InvalidViewerCertificateExceptionCloudfront 备用域名 InvalidViewerCertificateException
【发布时间】:2020-09-11 00:31:17
【问题描述】:

我的设置

  • EC2:应用程序
  • 域名注册商:namecheap
  • DNS:路由 53

我使用 EC2 来托管我的应用程序,使用 AWS 路由 53 来引导 url,并使用 cloudfront 来获取我的应用程序的静态文件。现在云端正在使用不友好的域名*.cloudfront.net

我在我的 EC2 中使用 certbot 来提供 SSL 连接。

当我尝试更改云端域名时,我使用由 ACM(AWS 证书管理器)生成的 Custom SSL Certificate。我遇到了错误:

com.amazonaws.services.cloudfront.model.InvalidViewerCertificateException: The certificate that is attached to your distribution doesn't cover the alternate domain name (CNAME) that you're trying to add. For more details, see: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html#alternate-domain-names-requirements (Service: AmazonCloudFront; Status Code: 400; Error Code: InvalidViewerCertificate; Request ID: 2d39c685-bf17-4d24-9c4b-82955daa878f; Proxy: null)

ACM 证书是在 N.Virginia 生成的,这很好,因为我的 EC2 托管在那里。我使用*.example.com 生成了证书并通过了验证。

我不知道如何解决这个问题。有什么建议吗?

【问题讨论】:

  • 您好,您能否提供有关 ACM 证书的更多信息?是 ACM 生成的还是你上传的?是单域还是多域?
  • @mokugo-devops 它由 ACM 生成。单域:*.example.com
  • 好的,您使用的域是 *.example.com,而不是 example.com?
  • 没错。基于 ACM:Type the fully qualified domain name of the site you want to secure with an SSL/TLS certificate (for example, www.example.com). Use an asterisk (*) to request a wildcard certificate to protect several sites in the same domain. For example: *.example.com protects www.example.com, site.example.com and images.example.com.
  • @mokugo-devops 这不是我的问题,必须等待 OP 确认其是否完全解决。但这似乎是事实。

标签: amazon-web-services ssl amazon-cloudfront amazon-route53 certbot


【解决方案1】:

这将是由于您配置的 ACM 证书使用的域名无效。

因为生成的 ACM 证书是 *.example.com,所以只能使用 1 级深度子域。

进一步解释:

  • www.example.com 是 ACM 证书的有效子域
  • foo.bar.example.com 不是 ACM 证书的有效子域
  • example.com 对此 ACM 证书无效,因为它是根域(并且未在 SSL 上引用)。

因为它是在ACM中生成的,所以只要符合following conditions,我们就可以验证这个证书是兼容的。

要使 SSL 用于根域和子域,它必须同时包含 example.com 和 *.example.com 才能在 CloudFront 中正常工作。

【讨论】:

    猜你喜欢
    • 2018-09-17
    • 2021-10-13
    • 2017-10-23
    • 2021-01-31
    • 2017-07-17
    • 1970-01-01
    • 2021-02-10
    • 2018-07-31
    • 1970-01-01
    相关资源
    最近更新 更多