News for hackers. Stuff that matters.
Re:SSL and PHP Streams, Part 1 by thegeomaster on Thursday June 26, 2014 @09:45AM (#7949569)
It by default doesn't try to verify the certificate of the peer it's connecting to? Isn't that the whole point of introducing TLS support?

Pardon me if I'm missing something, but that sounds like a horrible design decision, and anyone who tries to use TLS streams without reading the documentation is fooled into a false sense of security.

Re:SSL and PHP Streams, Part 1 by viraptor on Thursday June 26, 2014 @09:51AM (#7949596)
Yeah, I was surprised by that part until:

"We must also specify the expected peer name on the presented certificate with the `CN_match` option, it will not be inferred from the URL and if it is not specified, the name on the certificate will not be validated."

WTF? Who ever got the idea that this is something that can ever hit production?

Re:SSL and PHP Streams, Part 1 by RobAley on Thursday June 26, 2014 @10:28AM (#7949780)
Again the article is out of date, it's now parsed from the URL if you don't specify a CN_match (which you can still do if you need to).
Re:SSL and PHP Streams, Part 1 by viraptor on Thursday June 26, 2014 @11:09AM (#7950017)
This doesn't matter now. People don't (and sometimes cannot) upgrade quickly. Also, documentation for the latest version still says peer_verify defaults to false and CN_match doesn't mention being computed automatically.

Effectively if you write any code you're not going to deploy yourself, you have to specify the CN_match and verify_peer. Others will not know about the limitations, so this function is messed up until after 5.5 is EOLed.

Designing APIs is hard and bad defaults can hurt for many major versions after they're changed.

Re:SSL and PHP Streams, Part 1 by DaveRandom on Thursday June 26, 2014 @10:54AM (#7949927)
Not before 5.6 (where CN_match is actually deprecated in favour of peer_name)
Re:SSL and PHP Streams, Part 1 by chc on Thursday June 26, 2014 @11:25AM (#7950108)
It is? Which of the versions of PHP linked from the homepage of PHP.net do this? I didn't think any of them did.
Re:SSL and PHP Streams, Part 1 by RobAley on Thursday June 26, 2014 @10:22AM (#7949744)
The article is somewhat out of date, the default is now to verify (though you can turn it off if you need to). A lot is changing with PHP, and people aren't keeping up.
Re:SSL and PHP Streams, Part 1 by viraptor on Thursday June 26, 2014 @11:15AM (#7950060)
> the default is now to verify

You mean in the version that's not properly released or anywhere close to production ready? 5.5 still defaults to not verifying according to the documentation.

Re:SSL and PHP Streams, Part 1 by johnnyfaehell on Thursday June 26, 2014 @10:32AM (#7949806)
I love how this article was written today and is already out of date.
Re:SSL and PHP Streams, Part 1 by DaveRandom on Thursday June 26, 2014 @10:47AM (#7949889)
I did quite clearly state, this information applies to PHP versions before 5.6 (which means that in practice, people need to be doing this for at least the next two years until 5.6 is widely adopted)...

The next article will cover the changes in 5.6 and why you don't need to set those ctx opts any more (and a few more you might want to set instead)