繁体   English   中英

Apache HTTP服务器上的SSL

[英]SSL on Apache HTTP Server

我有2个crt文件用于Apache服务器:

  • 1_root_bundle.crt
  • 2_my_domain_name.com.crt

和其他捆绑包:

  • 1_Intermediate.crt
  • 2_my_domain_name.com.crt
  • 根目录

我已经修改

/etc/apache2/sites-available/default-ssl.conf 

并尝试了上述文件的各种组合,但是在Apache2服务重启后SSL无法正常工作,浏览器显示“连接不安全”:

SSLEngine on
SSLCertificateFile      /etc/apache2/ssl/1_Intermediate.crt
SSLCertificateKeyFile   /etc/apache2/ssl/2_my_domain_name.com.crt
SSLCertificateChainFile /etc/apache2/ssl/root.crt

如何在Apache服务器上制作SSL?

它缺少带有证书私钥的密钥文件。 通常,它具有.key扩展名,例如2_my_domain_name.com.key ,文件内容以-----BEGIN PRIVATE KEY-----开头

您的配置应如下所示

SSLEngine on
SSLCertificateFile      /etc/apache2/ssl/2_my_domain_name.com.crt
SSLCertificateKeyFile   /etc/apache2/ssl/2_my_domain_name.com.key
SSLCertificateChainFile /etc/apache2/ssl/1_root_bundle.crt

SSLCertificateChainFile指向一个多合一文件,您可以在其中组合构成服务器证书的证书链的证书颁发机构(CA)的证书。

因此,请确保1_root_bundle.crt包含1_Intermediate.crt内容并采用PEM格式(带有--- BEGIN CERTIFICATE --- ----END CERTIFICATE---标头的base64)

如果使用apache> = 2.4.8,则还可以将指向SSLCertificateFile的文件中的所有证书串联SSLCertificateFile

SSLCertificateChainFile在2.4.8版中已过时,这是因为SSLCertificateFile进行了扩展以从服务器证书文件中加载中间CA证书。

1)安装Apache HTTP服务器mod_ssl

2)配置httpd

请记住禁用SSLv2和SSLv3,因为它们容易受到攻击。

  # Toggle on the SSL/TLS Protocol Engine
  SSLEngine On
  # The signed certificate of the server
  SSLCertificateFile /etc/pki/tls/myserver/myserver.crt
  # The private key of the server
  SSLCertificateKeyFile /etc/pki/tls/myserver/myserver.key
  # The intermediate_certificate of the server
  SSLCertificateChainFile /etc/pki/tls/myserver/tls-ca-chain.pem

  # Accept only strong encryption
  SSLProtocol             all -SSLv2 -SSLv3
  SSLCipherSuite           HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK
  SSLHonorCipherOrder     on

3)检查证书文件的权限。

UPD :如何一步创建密钥和证书签名请求:

openssl req -new -newkey rsa:2048 -nodes -keyout myserver.key -out myserver.csr

接下来,您必须将此csr文件发送给证书颁发机构之一。 他们将发回您的签名证书和中间证书。

您还可以创建自签名证书。

您可以将捆绑文件与SSLCertificateChainFile一起使用。

SSLCertificateFile /home/ubuntu/tad.com/tad.com.crt
SSLCertificateKeyFile /home/ubuntu/tad.com/tad.com.key
SSLCertificateChainFile /home/ubuntu/tad.com/intermediate_bundle.crt
SSLCACertificateFile /home/ubuntu/zup.today/intermediate_bundle.crt

要么

如果您使用捆绑软件,那么它将在没有SSLCertificateChainFile文件的情况下工作。

SSLCertificateFile /home/ubuntu/tad.com/tad.com.crt
SSLCertificateKeyFile /home/ubuntu/tad.com/tad.com.key
SSLCACertificateFile /home/ubuntu/zup.today/intermediate_bundle.crt

暂无
暂无

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

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