Closed mglaman closed 4 years ago
Okay here's the root of the error: https://github.com/reactphp/socket/blob/284d72d11a40bb3e3b8092f6dd2732caa59b13dd/src/SecureConnector.php#L59
// try to enable encryption
return $promise = $encryption->enable($connection)->then(null, function ($error) use ($connection, $uri) {
// establishing encryption failed => close invalid connection and return error
$connection->close();
throw new \RuntimeException(
'Connection to ' . $uri . ' failed during TLS handshake: ' . $error->getMessage(),
$error->getCode()
);
});
I had to update openssl.capath
to include the mkcert CAROOT
@mglaman Happy to hear you've got this solved already!
In case somebody else stumbles upon the same problem, can you share a short snippet of how you've updated the "openssl.capath
to include the mkcert CAROOT
"?
Ah, yes! Forgot to post the fix here.
Here's the command I used for macOS, because Homebrew installs a second version of OpenSSL it's downloaded packages use
mkdir /usr/local/etc/openssl@1.1/certs
ln -s "$(mkcert -CAROOT)/rootCA.pem" /usr/local/etc/openssl@1.1/certs
You just need to symlink the rootCA.pem to the capath.
I did a more lengthy write up here: https://mglaman.dev/blog/php-sockets-fix-unable-complete-tls-handshake-mkcert-local-development-certificates
I'm using DDEV to run a local API, which leverages mkcert (https://mkcert.org/) to allow valid localhost HTTPS certificates. cURL is happy with it
But I'm getting the following error when trying to connect using react/http, and I tracked the error to StreamEncryption (or so)
It looks like the promise fails here
mkcert installs certificate so that they're valid in the system trust store