使用git 2.5

时间:2015-08-28 09:21:29

标签: git ssl curl ssl-certificate git-clone

我在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

2 个答案:

答案 0 :(得分:1)

免责声明:对于那些不能使用上述建议的人来说,这个解决方案是最后的希望。

请,只有在您真正理解此解决方案涉及的所有含义和安全问题时才会使用

此解决方案必须仅在您没有任何其他选项时使用,如果可能,请将您的git版本降级到低于2.5或等待Git 2.6

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

如果您绝对需要快速(BUT,REPEAT,WRONG)解决方案,可以按照Win 7 x64和Win 10 x64上测试的以下步骤进行操作:

  1. http://www.openssl.org/community/binaries.html openssl-1.0.2-i386-win32.zip(win 32)或openssl-1.0.2-x64_86-win64.zip(win x64)下载预编译库你的平台。

  2. 将下载的文件解压缩到临时目录

  3. 将c:\ Program Files \ Git \ mingw64 \ bin \ ssleay32.dll重命名为其他内容(如果出现问题,就像备份一样......)

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

  5. 这会将SSL库降级为接受DH密钥小于768位的安全性较低的版本

答案 1 :(得分:0)

一种解决方法是:

  • 请勿将自签名证书放入您的git发行版curl-ca-bundle.crt
  • 将其放入专用的file.crt

这将产生两个副作用:

  1. 你对Bitbucket的推动可以进行
  2. 任何可能实际需要该自签名证书的仓库都可以添加本地git config http.sslCAInfo /path/to/self-signed/certificate
  3. 这将确保仅使用该回购的自定义证书文件:

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

    但是,当OP Marco确认in the comments时,错误消息仍然存在:

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

    seen in Ubuntu 12.04+

      

    作为安全性改进,此更新还会将OpenSSL行为修改为   拒绝DH密钥大小低于768位,防止可能的降级   攻击。

    一种可能的解决方案是specify the cipher you want to use... but that won't be possible before git 2.6(2015年9月底)