git 2.5的windows下git clone出现SSL3错误



我在windows 10上使用git,在SSL公司代理后面,使用自签名证书绕过cntlm,证书添加到自定义curl-ca-bundle.crt文件

当我做时,从Git 2.5开始

git clone 'https://XXXX@bitbucket.org/XXXX/XXXX.git/'

我收到以下错误:

fatal: unable to access 'https://XXXX@bitbucket.org/XXXX/XXXX.git/':
error:14082174:SSL routines:ssl3_check_cert_and_algorithm:dh key too small

这个问题可能与自签名证书的质量差有关,但我无法更改证书本身(这超出了我的控制范围(

请注意:

  • 如果您看到XXXX是一个经过编辑的安全/隐私值,但这与此无关
  • 我无法重新生成自签名证书(我无法控制(
  • 我已经尝试过git-config https.sslVerify false(当然还有--global…(
  • 对于以前的git版本,此问题不会发生

低于我自己的配置:

git config --list
core.symlinks=false
core.autocrlf=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
http.proxy=http://localhost:9999
http.sslcainfo=c:/Users/XXXX/curl-ca-bundle.crt
https.proxy=https://localhost:9999
https.sslcainfo=c:/Users/XXXX/curl-ca-bundle.crt

有办法解决这个问题吗?

更新:

根据@VonC的建议,我已经将设置更改为使用每个项目的设置。我将全局设置保留为默认设置,并更改了每个项目的设置,但问题仍然存在。

因此,现在的设置如下:

全局设置:

core.symlinks=false
core.autocrlf=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true

每个项目设置:

core.symlinks=false
core.autocrlf=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
diff.astextplain.textconv=astextplain
rebase.autosquash=true
http.proxy=http://localhost:9999
http.sslcainfo=c:/Users/XXXX/curl-ca-bundle.crt
https.proxy=https://localhost:9999
https.sslcainfo=c:/Users/XXXX/curl-ca-bundle.crt

免责声明:此解决方案是那些无法使用上述建议中正确解决方案的人的最后希望

请仅在您真正了解此解决方案涉及的所有含义和安全问题时使用

只有当您没有任何其他选择时,才必须使用此解决方案,如果可能的话,将您的git版本降级到2.5以下,或者等待git 2.6

作为第一个更好、更安全的解决方案,请查看VonC的以下回复

如果你绝对需要一个快速(但是,重复,错误(的解决方案,可以按照以下步骤在Win 7 x64和Win 10 x64上测试:

  1. 下载自http://www.openssl.org/community/binaries.htmlopenssl-1.0-2-i386-win32.zip(win32(或openssl-1.02-x64_86-win64.zip(winx64(基于您的平台预编译的库。

  2. 提取临时目录中下载的文件

  3. 将c:\Program Files\Git\mingw64\bin\ssleay32.dll重命名为其他文件(就像出现问题时的备份一样…(

  4. 将点1上提取的ssleay32.dll复制到c:\Program Files\Git\mingw64\bin\

这将把SSL库降级到一个不太安全的版本,该版本接受小于768位的DH密钥

一种解决方法是:

  • 不要将您的自签名证书放在git发行版curl-ca-bundle.crt
  • 将其放入专用文件.crt

这将有两个副作用:

  1. 可以处理您对Bitbucket的推送
  2. 任何可能实际需要自签名证书的回购都可以添加本地git config http.sslCAInfo /path/to/self-signed/certificate

这将确保只使用该回购的自定义证书文件:

git -c http.https://bitbucket.org/.sslcainfo=/path/to/mycertif.cert clone https://XXXX@bitbucket.org/XXXX/XXXX.git

但是,正如OP Marco在评论中确认的那样,错误信息仍然存在:

error:14082174:SSL routines:ssl3_check_cert_and_algorithm:dh key too small

它可以在Ubuntu 12.04+中看到:

作为一项安全改进,此更新还将OpenSSL行为修改为拒绝768位以下的DH密钥大小,防止可能的降级袭击

一种可能的解决方案是指定要使用的密码。。。但这在git2.6(2015年9月底(之前是不可能的

最新更新