【发布时间】:2016-02-04 14:27:15
【问题描述】:
当我尝试在 Amazon EC2 实例上上传自签名证书时遇到困难。我已经使用 OpenSSL 生成了我的私钥和服务器证书。但是当我在 apache 的 .config 文件中配置它并重新启动服务器时,它显示“RSA 服务器证书 CommonName (CN) `ip-xxx-xx-xx-xx' 与服务器名称不匹配!?”在 crt 生成期间给出的 CommonName 是 www.mydomain.com。
在哪里可以更改 EC2 上的 CommonName (ip-xxx-xx-xx-xx)?下面是我的 .config 内容。(YAML 语法验证)
Resources:
sslSecurityGroupIngress:
Type: AWS::EC2::SecurityGroupIngress
Properties:
GroupId: {"Fn::GetAtt" : ["AWSEBSecurityGroup", "GroupId"]}
IpProtocol: tcp
ToPort: 443
FromPort: 443
CidrIp: 0.0.0.0/0
packages:
yum:
mod_ssl : []
files:
/etc/httpd/conf.d/ssl.conf:
mode: "000644"
owner: root
group: root
content: |
LoadModule ssl_module modules/mod_ssl.so
Listen 443
<VirtualHost *:443>
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ServerName www.mydomain.com
SSLEngine on
SSLCertificateFile "/etc/pki/tls/certs/server.crt"
SSLCertificateKeyFile "/etc/pki/tls/certs/server.key"
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
SSLProtocol All -SSLv2 -SSLv3
SSLHonorCipherOrder On
Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains; preload"
Header always set X-Frame-Options DENY
Header always set X-Content-Type-Options nosniff
LogFormat "%h (%{X-Forwarded-For}i) %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
ErrorLog /var/log/httpd/elasticbeanstalk-error_log
TransferLog /var/log/httpd/elasticbeanstalk-access_log
</VirtualHost>
/etc/pki/tls/certs/server.crt:
mode: "000400"
owner: root
group: root
content: |
-----BEGIN CERTIFICATE-----<my crt content>-----END CERTIFICATE-----
/etc/pki/tls/certs/server.key:
mode: "000400"
owner: root
group: root
content: |
-----BEGIN RSA PRIVATE KEY-----<my private key content>-----END RSA PRIVATE KEY-----
container_commands:
killhttpd:
command: "killall httpd"
waitforhttpddeath:
command: "sleep 3"
谢谢。
【问题讨论】:
-
如果您的网站由名为 www.example.com 的证书保护,如果您使用以下任何名称进行连接,您将收到此错误:example.com example.local 208.77.188.166 10.1。 1.7 - 在这种情况下,我相信你必须重新制作你的证书。使用多域证书或通配符域(注意这个)来解决这个问题。
-
使用通配符域证书,问题依然存在。
-
您的证书是自签名的还是您从证书颁发机构购买的?
标签: apache tomcat amazon-web-services ssl amazon-ec2