RapidSSL:域名与证书通用名称或 SAN 不匹配

RapidSSL:域名与证书通用名称或 SAN 不匹配

我正在 Amazon AWS(负载均衡器)上安装 SSL 证书(RapidSSL)。

安装已完成,但当我测试它时,我得到:

Wrong certificate installed.
The domain name does not match the certificate common name or SAN.

Certificate information
Common name: ip-172-XX-XX-XXX
SAN:

我的 SSL 证书仅适用于https://app.domain.com,因此 SSL 证书是为app.domain.com


编辑:经过一些测试我得到:

The certificate is self-signed. Users will receive a warning when accessing         
this site unless the certificate is manually added as a trusted certificate to  
their web browser. You can fix this error by buying a trusted SSL certificate

None of the common names in the certificate match the name that was entered         
(app.domain.com). You may receive an error when accessing this site in a web    
browser. Learn more about name mismatch errors.
Common name: ip-172-XX-XX-XXX
Organization: SomeOrganization
Location: SomeCity, SomeState, --
Valid from July 23, 2014 to July 23, 2015
Serial Number: 218621 (0x5566)
Signature Algorithm: sha256WithRSAEncrypt
Issuer: ip-172-XX-XX-XXX

编辑2:检查我发现的服务器:

在文件夹中/ssl/证书

localhost.crt //this is the one giving me trouble
ca-bundle.crt
ca-bundle.trust.crt

我应该删除 localhost.crt 吗?

谢谢

答案1

SubjectCN(可选,但很常见)中使用的主机名和 SubjectAN(必需)中的至少一个条目需要与您引用 VirtualHost 的名称相匹配(无论您是通过名称(使用 SNI)还是通过 IP 生成 VirtualHost)。此外,您应将此主机名生成为主主机名或 /etc/hosts 中的别名。请注意,这必须是 FQDN,因为匹配必须精确[1]。

如果证书是为“app.domain.com”颁发的,则必须让您的应用程序监听并响应“app.domain.com”的请求。出于测试目的,最好将操作系统看到的主机名更改为“app.domain.com”(使用 hostname 命令并在“/etc/hostname”文件中设置“HOSTNAME”参数)。


1:请注意,大多数认证机构不会为不合格的主机名颁发证书,因为他们无法确保他们所担保和承诺的主机名确实属于在没有域名组件的情况下申请该主机名的个人或组织

答案2

第一的:请不要删除您的 localhost.crt。如果您删除了,您将无法重新启动服务器,并且您的网页将处于离线状态。如果您删除了,您必须使用以下命令从您的私钥重新生成一个新的 localhost.crt 文件:

openssl req -new -x509 -nodes -sha1 -days 365 -key /etc/pki/tls/private/localhost.key > /etc/pki/tls/certs/localhost.crt

第二:如果您已完成使用负载均衡器创建证书的过程,你不需要使用 AWS IAM 或更改你的 ssl.conf文件。缺少的步骤是更改域记录集。如果您的域托管在 AWS 中,请转到53 号公路在里面EC2 管理控制台并创建一个记录集。它必须是A型记录(不是别名记录),并使用指向您的Amazon 负载均衡器(在标签中检查你的地址DNS在面板中)。地址应该是这样的:

9999999999.eu-west-1.elb.amazonaws.com 

相关内容