我如何让git告诉curl使用openssl而不是gnutls而不重建包?

我如何让git告诉curl使用openssl而不是gnutls而不重建包?,git,ubuntu,curl,openssl,gnutls,Git,Ubuntu,Curl,Openssl,Gnutls,我们有一个GnuTLS不喜欢的内部服务器,例如: gnutls-cli --x509cafile /etc/ssl/certs/ca-certificates.crt foo.example.com Processed 173 CA certificate(s). Resolving 'foo.example.com'... Connecting to '1.2.3.4:443'... *** Verifying server certificate failed... *** Fatal er

我们有一个GnuTLS不喜欢的内部服务器,例如:

gnutls-cli --x509cafile /etc/ssl/certs/ca-certificates.crt foo.example.com
Processed 173 CA certificate(s).
Resolving 'foo.example.com'...
Connecting to '1.2.3.4:443'...
*** Verifying server certificate failed...
*** Fatal error: Error in the certificate.
*** Handshake has failed
GnuTLS error: Error in the certificate.
除了GnuTLS之外的所有东西都可以与它对话,但git似乎在Ubuntu 14.04.2 LTS上使用了GnuTLS开箱即用,因此git在以下方面失败:

GIT_CURL_VERBOSE=1 git clone https://foo.example.com/some-repo.git
Cloning into 'some-repo'...
* Couldn't find host foo.example.com in the .netrc file; using defaults
* Hostname was NOT found in DNS cache
*   Trying 1.2.3.4...
* Connected to foo.example.com (1.2.3.4) port 443 (#0)
* found 173 certificates in /etc/ssl/certs/ca-certificates.crt
* server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
* Closing connection 0
fatal: unable to access 'https://foo.example.com/some-repo.git/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none

我们正在努力修复与GnuTLS的不兼容性,但与此同时,是否有办法迫使git告诉curl在运行时使用另一个SSL引擎(即不从源代码重建git)?

git是为了使用libcurl而构建的,libcurl是为了使用一个在运行时无法更改的固定TLS库而构建的

但是,您可以强制git在运行时使用不同的libcurl构建,并且libcurl可以使用OpenSSL。最简单的方法是将使用libcurl的OpenSSL放在与“标准”目录不同的目录中,然后执行以下操作之一:

  • 确保
    /etc/ld.so.conf
    在旧的libcurl宿主目录之前列出新的目录-尽管这样会更改所有使用libcurl的程序的设置,而您可能不希望这样做(根据您的询问方式)

  • 将“LD_LIBRARY_PATH=[directory where your special libcurl is]git”放入名为“git2”的脚本或别名中,并使用该脚本或别名代替普通git


  • 致命错误:证书中有错误
    。在解析证书数据时,GnuTLS比许多库(如OpenSSL)更严格。也许要问的问题是,证书有什么问题。我猜名称
    foo.example.com
    1.2.3.4
    ,没有列为SubjectAltName。如果你提供了真实的信息,那么我们可能会帮助你。如果您问证书有什么问题,请在另一个主题站点上执行,如Super User.AWS CodeCommit给出此错误,fwiw@jww就我的问题而言,我提出了我所关心的问题,并得到了我所需要的答案。有问题的证书的问题并不重要,正如我所说的,这是独立研究的(我自己无法修复它,也无法对那些能够修复它的人产生太大的影响)。