On Sun, Nov 27, 2016 at 2:22 PM, Niklas Keller <m...@kelunik.com> wrote:
> > > 2016-11-27 14:09 GMT+01:00 Jakub Zelenka <bu...@php.net>: > >> >> >> On Sun, Nov 27, 2016 at 1:06 PM, Jakub Zelenka <bu...@php.net> wrote: >> >>> >>> >>> On Sat, Nov 26, 2016 at 3:49 PM, Niklas Keller <m...@kelunik.com> wrote: >>> >>>> Morning Internals, >>>> >>>> I plan to distrust SHA-1 certificates by default in PHP 7.2. All major >>>> browsers will no longer trust SHA-1 certificates starting already >>>> 2017-01-01. >>>> >>>> Unfortunately, PHP doesn't even provide a way yet to limit the accepted >>>> algorithms for certificates. The RFC fixes that and introduces new >>>> defaults >>>> for PHP 7.2. The "signature_algorithms" context option will also be >>>> backported to PHP 5.6, which is only supported until the end of 2016 >>>> with >>>> regular releases, but after that there will be two more years of >>>> security-only updates. Therefore I'd like to get this done before the >>>> end >>>> of 2016. >>>> >>>> Currently the RFC aims for BC and doesn't restrict the algorithms on >>>> older >>>> versions. As all major browsers start distrusting those certificates on >>>> 2017-01-01 I'm not sure whether that's the correct choice. I'd like to >>>> go >>>> secure-by-default there and disable SHA-1 also on older versions. People >>>> which really need longer can always opt-out and add the needed >>>> algorithms >>>> again. Unfortunately, we didn't announce any plans regarding SHA-1 yet, >>>> so >>>> this might be a bit last-minute. >>>> >>>> You can read the full RFC in the wiki: >>>> https://wiki.php.net/rfc/distrust-sha1-certificates >>>> >>>> >>> I think you should change the format to match the one supported by >>> OpenSSL [1] which is also simpler. >>> >> > It is exactly in OpenSSL's format for SSL_CTX_set1_sigalgs_list. > Ah you right. I incorrectly read the RFC. So it's fine then. > > >> In general I'm not a big fan of such defaults especially when new values >>> can be added later (e.g. EdDSA that is specified in TLS 1.3) so we have to >>> keep it up to date which was kind of issue in the past. >>> >> > That's true, but I don't see a way in OpenSSL do have a blacklist instead, > but we could do that in our own verify callback. > Yeah but not sure if it's ideal too. Will have to think about it. > > >> However I see the point that we should make it easier for users to have >>> it secure by default so it's probably a good choice. It's not actually just >>> about SHA >>> >> >> Ah sent before I finished it. :) I wanted to say that it's not just about >> SHA-1 but also MD5 that I think we might still support but would have to >> double check that... >> > > I wanted to double-check that, too, but didn't do that yet. If MD5 is > still supported, we should definitely put it into PHP 5.6 as a security > update. > > As far as I can see, MD5 support is the case if it has not been disabled > by the OpenSSL version in use, as all supported algorithms are allowed by > default. > > SSL_CTX_set1_sigalgs is anyway only supported starting in OpenSSL 1.0.2, > so we need a custom verify callback for older OpenSSL versions. In our own > verify callback we can use a blacklist instead of the suggested whitelist > by default. > > No need to add support for 1.0.1 as it's going to be EOL end of December. Lower version are EOL already. Cheers Jakub