-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
curl: Fallback to using Certificate Authority from Windows Certificate Store #13601
Comments
Unlike Macos and Linux, Windows doesn't have a single file root CA file. That's why the ini values are empty in the first place. We recently upped the minimum required Libcurl version to One alternative, bundling our own root CA list, is a big no-no in my opinion. |
Could the minimum libcurl version be bumped to at least 7.71.0 (released in 2020) for PHP 8.5? It would be really nice to reduce the amount of setup/config needed to use the cURL extension on Windows. |
One appliation I use is SimpleSAMLphp, which uses [PHPMailer] for sending emails (https://github.com/PHPMailer/PHPMailer), which uses the function stream_socket_enable_crypto. Is updating libcurl going to solve the problems for the likes of PHPMailer, or is it only a partial solution, with the full soultion being to look into the window certificate store? |
The Lines 673 to 799 in d662ab5
|
Description
In PHP's current implementation, there is an inconsistency in how the language handles SSL/TLS certificate validation across different operating systems. This inconsistency primarily affects Windows users.
In this proof-of-concept, we can see the behavior clearly:
On Windows, the script does two requests:
Request correctly failed without CA certificate (expected on Windows)
Request succeeded with provided CA certificate
On Linux and Mac, it uses the O.S CA file, which prints
Request succeeded without CA certificate (expected on Linux and macOS)
On Linux, it uses by default:
On Mac, it uses:
On Windows, both are blank:
Which means that PHP doesn't have a fallback Certificate Authority file to validate HTTPS requests, which leads to issues such as these. The common solution for this problem for Windows users is to download a trusted CA file (such as from Mozilla), and update php.ini to use it:
openssl.cafile
to the downloaded fileThis is a sub-optimal solution as it increases complexity for the average John Doe that just wants to do a network request against a HTTPS URL.
I think PHP in Windows could fallback to accessing the Windows Certificate Store, or bundle a trusted CA file, although this might get outdated.
The text was updated successfully, but these errors were encountered: