Skip to content

Provide a better error message for schannel errors #3326

Closed

Activity

  1. self-assigned this
    on Nov 22, 2017
  2. j-f1 commented on Dec 4, 2017

    @j-f1
    Contributor

    Also #3498.

  3. schlamar commented on Dec 15, 2017

    @schlamar

    I played a little bit with git sslBackend settings and directly with curl 7.57.0 including SChannel support.

    If you have a corporate proxy intercepting your traffic with a custom cert (MITM proxy) or you are intercepting your own traffic with a local proxy like Fiddler, all SSL revocation checks will fail (curl/curl#264 (comment)). This results in the error:

    next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate
    

    There are two solutions: The first would be using openssl as SSL backend (I guess openSSL isn't doing revocation checks at all), but this requires that you configure sslCAInfo.

    Another option (and IMO preferable) would be to configure libcurl to disable revocation checks:

    If you are unable to find the cause and your circumstances allow you can
    disable revocation checking per session in curl w/ WinSSL by using
    option --ssl-no-revoke [1] in curl >= 7.44 or by passing flag
    CURLSSLOPT_NO_REVOKE to CURLOPT_SSL_OPTIONS [2] in libcurl >= 7.44.

    source

    However, it looks like this option is not yet available in git. So maybe this should be reported upstream to Git for Windows? Others have added this option, too. E.g. cargo (rust-lang/cargo#2464).

    BTW, there is the GIT_CURL_VERBOSE environment variable, which might be really helpful to debug these issues.

  4. shiftkey commented on Dec 27, 2017

    @shiftkey
    Member

    However, it looks like this option is not yet available in git. So maybe this should be reported upstream to Git for Windows? Others have added this option, too. E.g. cargo (rust-lang/cargo#2464).

    This is probably where we need to head with this. If you don't open an issue to start the discussion about this in Git for Windows before the new year then I can do it.

  5. pwagland commented on Jan 21, 2018

    @pwagland

    Was there an upstream issue created? This one comes fairly early in the google search, so it would be useful if it could forward through to where the problem is really going to be resolved.

    In my case, I was originally getting:

    $ git clone https://git.server/git/main.git
    Cloning into 'main'...
    fatal: unable to access 'https://git.server/git/main.git/': schannel: next InitializeSecurityContext failed: SEC_E_UNTRUSTED_ROOT (0x80090325) - The certificate chain was issued by an authority that is not trusted.
    

    I installed the certificate in the windows trusted store, and then got this message:

    $ git clone https://git.server/git/main.git
    Cloning into 'main'...
    fatal: unable to access 'https://git.server/git/main.git/': schannel: next InitializeSecurityContext failed: Unknown error (0x80092013) - The revocation function was unable to check revocation because the revocation server was offline.
    

    Based on what I read above, I would really like to be able to turn off revocation checking, so being able to set that option would be useful :-)

  6. shiftkey commented on Jan 21, 2018

    @shiftkey
    Member

    Based on what I read above, I would really like to be able to turn off revocation checking, so being able to set that option would be useful :-)

    I'd recommend switching yourself over to the OpenSSL backend, as that doesn't seem to trigger this issue.

    $ git config --local http.sslBackend "openssl"
    $ git config --local http.sslCAInfo [path to .pem file]
    

    The problem with this backend is that you're back to managing your certificates again, but if you need to provide your own certificates I'd recommend starting with this PEM file of public certificates and concatenating them (this thread has some important tips).

  7. shiftkey commented on Jan 21, 2018

    @shiftkey
    Member

    Was there an upstream issue created?

    @pwagland @schlamar I've opened up an issue here to get interest in it: git-for-windows/git#1446

  8. removed their assignment
    on Jan 22, 2018
  9. sgthomas-github commented on Jun 13, 2018

    @sgthomas-github

    I'd recommend switching yourself over to the OpenSSL backend, as that doesn't seem to trigger this issue.
    $ git config --local http.sslBackend "openssl"
    $ git config --local http.sslCAInfo [path to .pem file]

    I tried the above settings but still run into the same error.

  10. shiftkey commented on Jun 13, 2018

    @shiftkey
    Member

    @sgthomas-github please ensure that you've used a valid path to a PEM file, as [path to .pem file] is only supposed to be a placeholder.

  11. sgthomas-github commented on Jun 13, 2018

    @sgthomas-github

    [path to .pem file] is only supposed to be a placeholder.

    Yes, indeed, I had the following instead.

    $ git config --global http.sslBackend "openssl"
    $ git config --global http.sslCAInfo "C:\Program Files\Git\mingw64\ssl\cert.pem"

    When that didn't work, I tried also just providing the folder path (for the second setting)

    $ git config --global http.sslCAInfo "C:\Program Files\Git\mingw64\ssl"

    I also tried setting it to the certs subfolder under ssl, as well as the one under C:\Program Files\Git\usr\ssl

    I've tried uninstalling/reinstalling many times since this issue surfaced, tried with OpenSSL and native Secure channel options, everything leads to one of the below errors for me.

    OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
    schannel: failed to receive handshake, SSL/TLS connection failed

    Even the git config --global http.sslVerify false setting doesn't work for me with either of the above options. This was working without any problems on Windows 7 out of the box.

  12. jd-mtb commented on Aug 2, 2018

    @jd-mtb

    Hi, I am, in part, responsible for deploying git internally at our company. We can use the workaround mentioned but want to avoid defining the proxy for every user (aka injecting clear text username / passowrd into disk esp with corp password policy requiring frequent changes).

    Schannel works well for internal git servers it seems (we have an internal gitlab server). It only fails when using git for external uses (gitlab / github tested, noticed when installing go...). I have a supposition that this is because whatever appliance they use doesn't create an internal CRL / CDP for the certificates (which makes some sense as they are deployed on the fly, seemingly).

    I would wager that this error is indeed related to not having a CDP configured. This might be a poor assumption of schannel libraries or it could be a git bug caused by the same assumption - that a cdp exists.

    If anyone wants to reach out to me to perform some testing I might be able to assist.

    I am using git for windows 18.0 windows 7.

    Thanks, Josh

  13. shiftkey commented on Aug 7, 2018

    @shiftkey
    Member

    @jd-mtb stay tuned for the next Git for Windows update (2.18.1) as it will have the ability to disable certificate revocation checks using git config http.schannelCheckRevoke

    https://github.com/dscho/git/blob/6152657e1a97c478df97d633c47469043b397519/Documentation/config.txt#L2127-L2133

    http.schannelCheckRevoke::
    	Used to enforce or disable certificate revocation checks in cURL
    	when http.sslBackend is set to "schannel". Defaults to `true` if
    	unset. Only necessary to disable this if Git consistently errors
    	and the message is about checking the revocation status of a
    	certificate. This option is ignored if cURL lacks support for
    	setting the relevant SSL option at runtime.
    

    I'll be looking at improving the messaging in Desktop to set this flag (if the user consents) once we've upgraded our embedded Git. Then you won't need to revert to the OpenSSL backend.

  14. jd-mtb commented on Aug 7, 2018

    @jd-mtb

    @shiftkey
    Thanks, I think this is 'ok' for my needs and perfectly fine for my environment. I feel like a more ideal setting for the project might be to check CRL when available, but to not if it is not available on the certificate. That might just be me being a begging chooser though and even in my case, this only manifests externally when git is hitting the proxy cert and checking is rather moot.

    In any case, thanks for the heads up! I will be sure to take advantage of this upon release.

  15. shiftkey commented on Aug 7, 2018

    @shiftkey
    Member

    I feel like a more ideal setting for the project might be to check CRL when available, but to not if it is not available on the certificate.

    If you feel strongly about it you should ask on the upstream project: https://github.com/git-for-windows/git

  16. jd-mtb commented on Aug 7, 2018

    @jd-mtb

    Thanks, I totally thought I was under the git-for-windows repository, I was at some point but must have selected the wrong tab and never noticed :).

    Thanks again!!

  17. Norway174 commented on Sep 8, 2018

    @Norway174

    I downloaded the cacert.pem as linked to in the workaround. And ran the commands trough git with no problems.

    However, now I get this instead:
    fatal: unable to access 'https://github.com/Norway174/Peanut-DiscordBot.git/': SSL certificate problem: self signed certificate in certificate chain

    I should also note, I'm on a personal home system. So why I even got it to begin with, is a bit weird.
    And the old GitHub for Desktop works perfectly fine.

  18. shiftkey commented on Sep 13, 2018

    @shiftkey
    Member

    @Norway174 are you using any sort of proxy server in between your machine and GitHub? That message often happens when something tries to use a different certificate but the machine doesn't trust it.

  19. Norway174 commented on Sep 13, 2018

    @Norway174

    @shiftkey Nope, shouldn't be. I'm connected to http://github.com just fine in my browser.
    But is there a way to check, just in case?

  20. shiftkey commented on Sep 13, 2018

    @shiftkey
    Member

    @Norway174 I don't know which OS and browser setup you are on, but that can affect how they check and verify certificates.

    But you can view the certificate chain using OpenSSL and this command:

    $ openssl s_client -host github.com -port 443     
    

    You should see a chain like this at the start of the output:

    CONNECTED(00000006)
    depth=1 C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert SHA2 Extended Validation Server CA
    verify error:num=20:unable to get local issuer certificate
    verify return:0
    ---
    Certificate chain
     0 s:/businessCategory=Private Organization/1.3.6.1.4.1.311.60.2.1.3=US/1.3.6.1.4.1.311.60.2.1.2=Delaware/serialNumber=5157550/C=US/ST=California/L=San Francisco/O=GitHub, Inc./CN=github.com
       i:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 Extended Validation Server CA
     1 s:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 Extended Validation Server CA
       i:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance EV Root CA
    ---
    Server certificate
    -----BEGIN CERTIFICATE-----
    ...
    
  21. Norway174 commented on Sep 13, 2018

    @Norway174

    @shiftkey Looks like it's my Kaspersky Anti-Virus. Never had a problem with it before. ¯\(ツ)/¯

    CONNECTED(00000003)
    depth=1 O = AO Kaspersky Lab, CN = Kaspersky Anti-Virus Personal Root Certificate
    verify error:num=19:self signed certificate in certificate chain
    ---
    Certificate chain
     0 s:/businessCategory=Private Organization/jurisdictionC=US/jurisdictionST=Delaware/serialNumber=5157550/C=US/ST=California/L=San Francisco/O=GitHub, Inc./CN=github.com
       i:/O=AO Kaspersky Lab/CN=Kaspersky Anti-Virus Personal Root Certificate
     1 s:/O=AO Kaspersky Lab/CN=Kaspersky Anti-Virus Personal Root Certificate
       i:/O=AO Kaspersky Lab/CN=Kaspersky Anti-Virus Personal Root Certificate
    ---
    Server certificate
    -----BEGIN CERTIFICATE-----
    . . .
    

    And I'm on Win10, and using Opera as my browser.

  22. shiftkey commented on Sep 13, 2018

    @shiftkey
    Member

    Never had a problem with it before.

    Check out #4738 and https://github.community/t5/How-to-use-Git-and-GitHub/Getting-quot-SSL-certificate-problem-self-signed-certificate-in/td-p/7531/page/3 for more details. Kasperksy might be registering itself in the Windows Certificate Store, but if you've switched to using the OpenSSL backend that uses the cacert.pem bundle you just obtained - and so it won't exist.

  23. Norway174 commented on Sep 13, 2018

    @Norway174

    @shiftkey Thanks, I turned off Encrypted connections scanning. And it works now.

    I wasn't able to find a way to add it to the exclusions, so it still works. But I'll keep looking into it. Thanks!

  24. billygriffin commented on Feb 25, 2020

    @billygriffin
    Contributor

    Related to #8748 and #2789, and we're looking at this in the context of those.

  25. vishnupriyaaTR commented on Jun 24, 2021

    @vishnupriyaaTR

    openssl s_client -host github.com -port 443

    This worked for me.

    1. open the GitBash application in my local
    2. executed the command "openssl s_client -host github.com -port 443"
    3. Go to jenkins, rerun the maven project and it started working
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions