将SSL证书上载到IAM for Cloudfront

问题描述 投票:1回答:1

有大量的Cloudfront问题,但谷歌搜索可能存在的问题仍然让我感到惊讶。这是我的......

我目前正在尝试的是将SSL证书上传到IAM,以便我可以使用Cloudfront的自定义域名(例如https://assets.mydomain.com)。然而,这并不是那么顺利。证书是从DNSimple购买的。 AWS cli上载如下:

aws iam upload-server-certificate \
  --server-certificate-name MyDomainProduction \
  --path /cloudfront/ \
  --certificate-body file://~/Downloads/STAR_mydomain_com/STAR_mydomain_com.crt \
  --private-key file://~/Downloads/STAR_mydomain_com.key \
  --certificate-chain file://~/Downloads/STAR_mydomain_com.pem

错误:

A client error (MalformedCertificate) occurred when calling the
UploadServerCertificate operation: Unable to validate certificate
chain. The certificate chain must start with the immediate signing
certificate, followed by any intermediaries in order. The index within
the chain of the invalid certificate is: 1

我想我已经尝试了500种不同的可能性,而且我没有想到为什么我不能让事情发挥作用。以下是我在工具箱中获取的DNSimple和Comodo交给我的内容:

  • STAR_mydomain_com.pem
  • STAR_mydomain_com.key
  • STAR_mydomain_com/AddTrustExternalCARoot.crt
  • STAR_mydomain_com/COMODORSADomainValidationSecureServerCA.crt
  • STAR_mydomain_com/COMODORSAAddTrustCA.crt
  • STAR_mydomain_com/STAR_mydomain_com.crt

什么是crts,pem和key的正确组合,以使SSL在Cloudfront上运行?

ssl amazon-cloudfront amazon-iam dnsimple
1个回答
7
投票

你几乎完成。错误是您使用了错误的中间证书文件。您应该使用仅包含链的包,而不使用主证书。

换句话说,从DNSimple安装向导中,选择其他并下载文件(1),(2)和(4)。您下载了(3)而不是(4)。

主要区别在于(3)是(4)+(1)。但是,由于您已经明确地使用--certificate-body参数传递(1),因此Cloudfront只希望链接没有主要的。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.