4

I recently reinstalled my computer and installed Linux Subsystem which I always do. When I wanted to run composer I noticed something strange. It failed because it was unable to establish a TLS connection.

[RuntimeException] Failed to clone https://github.com/inquam/colors.php via https, ssh protocols, aborting.

  • https://github.com/inquam/colors.php Cloning into bare repository '/home/danlil/.cache/composer/vcs/https---github.com-inquam-colors.php'... fatal: unable to access 'https://github.com/inquam/colors.php/': gnutls_handshake() failed: The TLS connection was non-properly terminated.

  • git@github.com:inquam/colors.php Cloning into bare repository '/home/danlil/.cache/composer/vcs/https---github.com-inquam-colors.php'... Warning: Permanently added the RSA host key for IP address '192.30.253.113' to the list of known hosts. Permission denied (public key). fatal: Could not read from remote repository.

    Please make sure you have the correct access rights and the repository exists.

After trying a bit more I noticed that this happens no matter which GitHub repository I try to clone via https and it also applies to any connection via curl or other commands that connect using TLS. I have tried several proposed solutions in other threads like updating ca-certificates, reinstalling Ubuntu on Windows 10, downloading https://curl.haxx.se/ca/cacert.pem and pointing to that in php.ini, making sure ipv6 is not the preferred method in Ubuntu etc.

Previously when I have used Ubuntu in Windows 10 I have just installed and everything has worked without any issues like this at all.

Update: After testing a bit more I decided to test install the Windows version of GIT and remove the Linux one since the Linux Subsystem can now run Windows binaries. It worked fine. Then Composer wanted to download https://packagist.org/packages.json and failed once again due to TLS. So TLS doesn't work in Bash when running Linux versions of the programs but work fine with WIndows versions.

[Composer\Downloader\TransportException] The "https://packagist.org/packages.json" file could not be downloaded: Failed to enable crypto failed to open stream: operation failed

To demonstrate it seems to affect every native Bash application I tested the following too

me@DATHREADRIPPER:/mnt/e/src$ php -r 'echo file_get_contents("https://packagist.org/packages.json");'

PHP Warning: file_get_contents(): Failed to enable crypto in Command line code on line 1 PHP Warning: file_get_contents(https://packagist.org/packages.json): failed to open stream: operation failed in Command line code on line 1

Update: For me, this was finally solved when I installed the newer Ubuntu 18.04 in Windows from the Windows store.

inquam
  • 12,664
  • 15
  • 61
  • 101
  • I have run into the exact same error when I try a simple ˋgit cloneˋ. I am using Win10 enterprise. I am unable to use SSL mode, owing to enterprise network constraints. I also get this error when trying to download GO sourcecode using the ˋgo getˋ command. – Prasanna K Rao Apr 16 '18 at 20:26
  • Strange that it would only affect the Linux Subsystem. Here I'm running my own network so unless Microsoft has pushed destroying SSL in the Linux Subsystem as an update I find it strange that it stopped working after working perfectly for a year. Installed the exact same way :) – inquam Apr 16 '18 at 20:45
  • Could it be the proxy? I am a bit suspicious of the proxy that I use (the corporate one)? – Prasanna K Rao Apr 17 '18 at 05:15
  • I have seen proxy as being a possible issue and checked if somehow a proxy settings was sent in the Linux Subsystem but nothing and no proxy in Windows or my prsense router etc. – inquam Apr 17 '18 at 05:30
  • ok. In my case, I found this to be an issue w/ GIT not playing nicely with GNUTLS. I opted to rebuilding GIT on my WSL with Openssl. Big thanks to [this question](https://stackoverflow.com/questions/38378914/git-error-rpc-failed-curl-56-gnutls/49374509) – Prasanna K Rao Apr 17 '18 at 08:57
  • And for my case, I opted to use [cntlm](http://cntlm.sourceforge.net/) – Prasanna K Rao Apr 17 '18 at 08:58

0 Answers0