为什么服务器禁用SSLv3后git停止工作?

像大多数其他人一样,我们的存储库服务器需要尽快禁用SSLv3(和v2)。

然而,这样做似乎打破了我们的客户端 – 至less在RHEL5上(从我的FreeBSD桌面连接工作正常)。 即使最近的git(2.1.2)也失败了,并且从供应商升级OpenSSL库到最新的版本都没有帮助。

不过 ! 同样的git-client在github.com上工作得很好 – 而且github.com已经禁用了SSLv3。 通过试验和错误,我设置了我们的服务器(Apache)SSLconfiguration以匹配github的configuration:

SSLProtocol ALL -SSLv2 -SSLv3 SSLHonorCipherOrder On SSLCipherSuite "AES128-SHA AES256-SHA RC4-SHA" 

通过运行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 

现在,我们的服务器的SSL和GitHub之间唯一可以区分的是sslscan能够输出GitHub证书的详细信息,但是无法从服务器获得这些信息。

当我从我的FreeBSD桌面连接到我们的git-server时,同样的git clone命令起作用。 在输出CApath: none之后,没有失败,我看到:

  CApath: none * SSL connection using AES128-SHA * Server certificate: subject: C=US; postalCode= ............ 

并克隆成功。 我如何configuration我们的服务器,以便git甚至可以使用旧的RHEL5系统 – 就像它在GitHub服务器上一样?

更新 :尝试访问我们的服务器只是curl ,我有一个SSL兼容性类似的错误。 不过,我可以通过使用明确的--tlsv1选项(也称为-1 )来调用curl来克服它。 因此,RHEL5系统上的软件能够提供必要的协议和密码 – 我如何在默认情况下使用它们,而不是尝试旧的和失败的?

好的,这是交易。 在今天的Apache中禁用SSLv3意味着,服务器甚至不会告诉客户端,它想要使用TLS。 如果客户端没有开始与TLS的对话,客户端将会失败 – 即使可以与TLS通话。 非常感谢用户Chris S. ,他分析了这个问题,甚至为Apache的mod_ssl提供了一个补丁来解答相关的问题 。

看过Chris的补丁后,Apache开发者提出了一个更全面的解决scheme,甚至可能成为下一个Apache版本的一部分。 它为Apache的SSLProtocols指令引入了一个新选项: ANY 。 当Apache遇到ANY ,会通知连接客户端(通过SSLv2Hello),它必须切换到TLS:

 SSLProtocol ANY -SSLv2 -SSLv3 

我在这里为那些无法等待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) { 

我喜欢你提供的解释如何进行服务器端的调整,让git客户端工作。 我的问题是试图连接到jazzhub,我没有能力更改服务器。 我今天(和昨晚)提出了这个解决scheme:

https://developer.ibm.com/answers/answers/164635/view.html

如果你有一些反馈意见,我很乐意听到。

-Michael