Mik*_* T. 5 ssl mod-ssl git curl github
像大多数其他人一样,我们的存储库服务器需要尽快禁用 SSLv3(和 v2)。
然而,这样做似乎破坏了我们的 git 客户端——至少,在 RHEL5 上(来自我的 FreeBSD 桌面的连接工作正常)。即使是最新的 git (2.1.2) 也失败了,将 OpenSSL 库升级到供应商的最新版本也无济于事。
然而!相同的 git-client 对 github.com 工作得很好——而且 github.com 也已经禁用了 SSLv3。通过反复试验,我将我们服务器的(Apache)SSL 配置设置为与 github 的配置相匹配:
SSLProtocol ALL -SSLv2 -SSLv3
SSLHonorCipherOrder On
SSLCipherSuite "AES128-SHA AES256-SHA RC4-SHA"
Run Code Online (Sandbox Code Playgroud)
通过sslscan
在我们的服务器和 github 上运行,我得到了接受和拒绝的相同密码列表。但是 git 继续失败:
% git clone https://git.example.net/git/puppet-hiera
Cloning into 'puppet-hiera'...
* Couldn't find host git.example.net in the .netrc file, using defaults
* About to connect() to git.example.net port 443
* Trying 10.89.8.27... * connected
* Connected to git.example.net (10.89.8.27) port 443
* successfully set certificate verify locations:
* CAfile: /etc/pki/tls/certs/ca-bundle.crt
CApath: none
* Unknown SSL protocol error in connection to git.example.net:443
* Closing connection #0
fatal: unable to access 'https://git.example.net/git/puppet-hiera/': Unknown SSL protocol error in connection to git.example.net:443
Run Code Online (Sandbox Code Playgroud)
现在,我们服务器的 SSL 和 GitHub 之间唯一可察觉的区别sslscan
是能够输出 GitHub 证书的详细信息,但无法从我们的服务器获取这些信息。
当我从 FreeBSD 桌面连接到我们的 git-server 时,同样的git clone
命令可以工作。而不是失败,输出后CApath: none
,我看到:
CApath: none
* SSL connection using AES128-SHA
* Server certificate:
subject: C=US; postalCode= ............
Run Code Online (Sandbox Code Playgroud)
并且克隆成功。我如何配置我们的服务器,以便 git 即使在旧的 RHEL5 系统中也能使用它——就像它对 GitHub 服务器一样?
更新:尝试使用简单的访问我们的服务器curl
,我在 SSL 兼容性上遇到了类似的错误。但是,我能够通过使用显式--tlsv1
选项(也称为-1
)调用 curl 来克服它。所以,RHEL5 系统上的软件能够使用必要的协议和密码——我如何让它默认使用它们而不是尝试旧的并失败?
好的,这是交易。在今天的 Apache 中禁用 SSLv3 意味着,服务器甚至不会告诉客户端它想要使用 TLS。如果客户端不开始与 TLS 对话,客户端将失败——即使可以与 TLS 对话。非常感谢用户Chris S.,他分析了问题,甚至在回答相关问题时为 Apache提供了补丁。mod_ssl
查看了 Chris 的补丁后,Apache 开发人员提出了一个更全面的补丁,它甚至可能成为下一个 Apache 版本的一部分。它为 Apache 的SSLProtocols
指令引入了一个新选项:ANY
. 当 Apache 遇到 时ANY
,它会通知连接的客户端(通过 SSLv2Hello),它必须切换到 TLS:
SSLProtocol ANY -SSLv2 -SSLv3
Run Code Online (Sandbox Code Playgroud)
我在这里为那些不能等待 Apache 2.4.11 的人粘贴补丁。
Index: modules/ssl/ssl_private.h
===================================================================
--- modules/ssl/ssl_private.h (revision 1635012)
+++ modules/ssl/ssl_private.h (working copy)
@@ -295,8 +295,10 @@ typedef int ssl_opt_t;
#define SSL_PROTOCOL_TLSV1_2 (1<<4)
#define SSL_PROTOCOL_ALL (SSL_PROTOCOL_SSLV3|SSL_PROTOCOL_TLSV1| \
SSL_PROTOCOL_TLSV1_1|SSL_PROTOCOL_TLSV1_2)
+#define SSL_PROTOCOL_ANY (1<<5)
#else
#define SSL_PROTOCOL_ALL (SSL_PROTOCOL_SSLV3|SSL_PROTOCOL_TLSV1)
+#define SSL_PROTOCOL_ANY (1<<3)
#endif
typedef int ssl_proto_t;
Index: modules/ssl/ssl_engine_init.c
===================================================================
--- modules/ssl/ssl_engine_init.c (revision 1635012)
+++ modules/ssl/ssl_engine_init.c (working copy)
@@ -490,6 +490,7 @@ static apr_status_t ssl_init_ctx_protocol(server_r
}
cp = apr_pstrcat(p,
+ (protocol & SSL_PROTOCOL_ANY ? "SSLv23, " : ""),
(protocol & SSL_PROTOCOL_SSLV3 ? "SSLv3, " : ""),
(protocol & SSL_PROTOCOL_TLSV1 ? "TLSv1, " : ""),
#ifdef HAVE_TLSV1_X
Index: modules/ssl/ssl_engine_config.c
===================================================================
--- modules/ssl/ssl_engine_config.c (revision 1635012)
+++ modules/ssl/ssl_engine_config.c (working copy)
@@ -1311,6 +1311,9 @@ static const char *ssl_cmd_protocol_parse(cmd_parm
else if (strcEQ(w, "all")) {
thisopt = SSL_PROTOCOL_ALL;
}
+ else if (strcEQ(w, "any")) {
+ thisopt = SSL_PROTOCOL_ANY|SSL_PROTOCOL_ALL;
+ }
else {
return apr_pstrcat(parms->temp_pool,
parms->cmd->name,
Index: modules/ssl/ssl_engine_io.c
===================================================================
--- modules/ssl/ssl_engine_io.c (revision 1635012)
+++ modules/ssl/ssl_engine_io.c (working copy)
@@ -1137,6 +1137,7 @@ static apr_status_t ssl_io_filter_handshake(ssl_fi
* IPv4 and IPv6 addresses are not permitted".)
*/
if (hostname_note &&
+ !(sc->proxy->protocol & SSL_PROTOCOL_ANY) &&
sc->proxy->protocol != SSL_PROTOCOL_SSLV3 &&
apr_ipsubnet_create(&ip, hostname_note, NULL,
c->pool) != APR_SUCCESS) {
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5750 次 |
最近记录: |