3 ms·
Ensuring you have some sort of root trust store is a _start_ but probably not the end for anything but trivial hacks. The file you know as cacert.pem is a resu
by tialaramex 9y ago
Ensuring you have some sort of root trust store is a _start_ but probably not the end for anything but trivial hacks.
The file you know as cacert.pem is a result of processing source code Mozilla makes available for NSS, the trust component of the Firefox browser.
Now, Mozilla makes its trust decisions in public, on the hybrid newsgroup/ mailing list mozilla.dev.security.policy. But it makes these decisions _primarily_ as a web browser. The Web PKI (a PKI for things that speak SSL/TLS over the Internet, not necessarily just the web) overlaps well with that, but the two aren't quite the same.
Further, Mozilla can and does make trust decisions that go beyond the simple binary decisions reflected in NSS and thus in cacert.pem. For example, if Mozilla decides they trust a particular CA to put honest dates in their certificates, but that their validation regime was too poor to be acceptable until August 2016, they might tell Firefox to reject certificates from that CA which say they were issued before that date. But NSS will only mark that CA as acceptable, and so it'll be included in cacert.pem
If you have a very specialised application you can and should curate your own trust store. Most people are too lazy, but that's a bad thing. Now, disabling CA checks altogether is definitely _worse_ than using Mozilla's trust store blindly, but it is not a panacea.
This isn't PHP-specific. If your application cares whether it's talking to real.example.com or dubious.example.net then you need to care about trust stores. They are not very sexy, there is no magic solution, and "Trust Mozilla" or "Trust my operating system vendor" is, again, better than "I dunno, let's switch the checks off altogether", but you really ought to do better.
Apple runs the Podcasting backend that matters for most people. You would assume that huge multinational corporation Apple carefully curates the trust store for that right? Er, nope. It's built out of Java apparently, once Oracle shipped a JDK update that trusted a new CA, magically that CA was trusted by the Apple podcasting system shortly afterwards.
And by the way apart from the fact that they're the ones who provide source code ready for download, the other reason people rely on Mozilla these days is they're open about how this works. If you use the built-in trust on Windows, or MacOS, you have no insight into their rules, they don't publish anything beyond the very basics of how to apply to be added to their stores. What are the acceptance criteria? Nobody knows.