【发布时间】: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 的预发布版本,请在此处获取预发布版本:
【问题讨论】: