【问题标题】:Apache 2.4.16 on Mac El Capitan: how to make it work with TLS 1.2Mac El Capitan 上的 Apache 2.4.16:如何使其与 TLS 1.2 一起使用
【发布时间】:2016-04-03 14:42:55
【问题描述】:

在我的 MacBook Pro 中,我有带有 OpenSSL 1.0.2d 的 Apache 2.4.16。 我正在尝试使用 SSL 配置它,它也应该使用 TLS 1.2。 所以我创建了一个自签名证书:

openssl req -x509 -nodes -sha256 -days 365 -newkey rsa:2048 -keyout localhost.key -out localhost.crt

我写了我的httpd-ssl.conf 文件,如下所示:

###############################
######## Enable SSL ###########
<IfModule ssl_module>
Listen 443
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl
SSLPassPhraseDialog  builtin
#SSLSessionCache shmcb:/Applications/AMPPS/apache/logs/ssl_gcache_data(512000) 
SSLSessionCacheTimeout  300
Mutex default
</IfModule>
###############################

#### Localhost SSL Entries ####
<IfModule ssl_module>
<VirtualHost *:443>
  DocumentRoot "/Users/lory/Sites"
  ServerName localhost
  SSLEngine on
  SSLProtocol all -SSLv2 -SSLv3
  SSLHonorCipherOrder on
  SSLCertificateFile "/Users/lory/Sites/localhost.crt"
  SSLCertificateKeyFile "/Users/lory/Sites/localhost.key"
</VirtualHost>

如果我执行sudo apachectl start,它会起作用。无论如何,我在终端上尝试:

openssl s_client -connect localhost:443 -tls1_2

那么这就是我得到的:

CONNECTED(00000003)
140735258165328:error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version   number:s3_pkt.c:362:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 5 bytes and written 7 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
  Protocol  : TLSv1.2
  Cipher    : 0000
  Session-ID: 
  Session-ID-ctx: 
  Master-Key: 
  Key-Arg   : None
  PSK identity: None
  PSK identity hint: None
  SRP username: None
  Start Time: 1451408861
  Timeout   : 7200 (sec)
  Verify return code: 0 (ok)
---

从中我推断事情并不顺利。

事实上,如果我检查 phpinfo(); 的输出,我会看到:

  • Apache/2.4.16 (Unix) PHP/5.5.30 OpenSSL/0.9.8zg 使用版本

  • ssl、sslv3、sslv2

等等。我不知道为什么,我以为我禁用了它们。 我该如何解决?

更新

特别感谢用户 Myles 发出此信号:

截至 2016 年 7 月 21 日,有一个包含 OpenSSL 1.0.2 的 MAMP PRO 4 的预发布版本,请在此处获取预发布版本:

https://www.mamp.info/en/pre-release.html

【问题讨论】:

    标签: apache ssl tls1.2


    【解决方案1】:

    从终端执行which openssl。我想你会发现它不是 /usr/bin/openssl。您正在运行通过 HomeBrew 或 MacPorts 编译或安装的 openssl。 OS X 自带的内置 Apache 不能使用那个 openssl。它将使用 /usr/bin 中的那个,这就是 phpinfo() 报告 0.9.8zg 的原因。

    试试/usr/bin/openssl version,你会看到相同的 0.9.8zg。

    除了编译您自己的 Apache 或使用 HomeBrew 或 MacPorts 中的一个之外,我认为您无法使用更现代的 openssl。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-25
      • 2016-03-03
      相关资源
      最近更新 更多