gpt4 book ai didi

Mac El Capitan 上的 Apache 2.4.16 : how to make it work with TLS 1. 2

转载 作者:太空宇宙 更新时间:2023-11-03 13:37:38 25 4
gpt4 key购买 nike

在我的 MacBook Pro 中,我有 Apache 2.4.16 和 OpenSSL 1.0.2d。我正在尝试使用 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 日,MAMP PRO 4 有预发布版,其中包括 OpenSSL 1.0.2,在此处获取预发布版:

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

最佳答案

从终端执行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 的 Apache 之外,我认为您无法使用更现代的 openssl。

关于Mac El Capitan 上的 Apache 2.4.16 : how to make it work with TLS 1. 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34515719/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com