-
-
Notifications
You must be signed in to change notification settings - Fork 31.2k
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
gh-107562: Lib/test: update test certificates to expire far in the future #107594
Conversation
9d1eaf9
to
725e4c0
Compare
725e4c0
to
8b1fe18
Compare
I'm not comfortable merging this without a SSL expert. (Some candidate experts were pinged as codeowners, but didn't give a yes/no, and didn't prioritize investigating the issue. As for me, I recall there's some kind of Chesterton's Fence in this area, but I can't commit to researching that.) IMO, until we start running Y2038 tests in CPython's test suite, the way to go is regenerating the certs yourself before running the test suite.
|
As far as I understand problems may arise on legacy 32 bit systems which haven't been reconfigured with 64 bit time_t, as they will misinterpret post-2038 dates in regenerated certs. The pipeline above doesn't seem to include such systems. I don't know if such retrocomputing systems are important to python upstream: I'd say making it easier to confirm that 32 bit (and 64 bit) systems that do have 64 bit time_t enabled are not going to fail is more important. 32 bit ARM is by far the most problematic - 32 bit x86, mips and ppc are all fading away in use. If you can get more people to look at this I'd appreciate. |
971a38f
to
cb1d9bb
Compare
@encukou Note that the existing certificate generation script already sets some of the certificates to expire 7000 days into the future, and therefore the following change: modified them to expire in 2043, and so rendered the whole test suite incompatible with 32 bit time systems. So this pull request won't make things any worse I think; I have meanwhile rebased it on top of all recent changes. |
To be clear, I'm worried about increasing the expiration from @sethmlarson, do you have any thoughts here? The relevant change is to |
Here are some questions. I presume they all have reasonable answers -- I don't want to stand in the way of the future, but recently we are starting to having some concerns about checking blobs of binary data. Why can't the testing be done on a private fork with these changes? Has anyone (other than the PR author) double-checked that re-running make_ssl_certs.py produces the same binary blobs that are in the PR? Why are we checking the output of that script into the tree in the first place? A possible reason for @tiran's doubts could be that the increase might trigger Y2038 issues in other software? |
Thanks for chiming in, I can give some answers from my perspective.
It can, and I've been doing it for a while here: You can see all the issues that has uncovered, and that has been reported/fixed by me: And indeed, re-setting python test certificates has uncovered a failure in python's test_ssl, which was traced to an issue in openssl, fixed in the just-released 3.3.0: If the question is, why does this need to land in python upstream, it's basically to allow others to easily test for actual issues, and not have to fight with certificate expiry errors (which are common across the whole userspace stack). I can't cover everything, and people configure their systems differently, and so may see issues that I don't.
I agree. You shouldn't trust that I'm not 'Jia Tan'. I'm slightly concerned that e.g. openssl has blobs that they don't even know how to regenerate, because the original author has vanished:
That's exactly the goal. We want to trigger (and fix) those issues now, and not when the date rolls over and critical infrastructure stops working. |
Unfortunately, the certs include random data and the current date. Anyway, a core dev should re-create the certs before merging. I'll add a label so we don't merge before that.
AFAIK, it's because they're generated by the
If that's the only reason, and buildbot tests pass for supported platforms, then we should merge this. |
@encukou Thanks for the ping. I don't have specific concerns about having a test case for a certificate that expires far in the future. I do know there's been a general trend of certificate lifetimes becoming shorter and shorter, and specifically not longer. This change kinda flies in the face of that trend. I like the idea of testing for Y2038, but we don't necessarily need to change all of our certificates to achieve that and isn't 7,000 days already enough to set us past 2038? Regarding "seeded" generation of certificates, I don't think OpenSSL has support but certtool has support for a |
Another option is for the cert generation script to obtain the data after generating the certs, and write it into a reference file next to the cert files. Then the reference file would be used by the tests, instead of having that data hardcoded inside test_ssl.py. It's basically these fields that change:
|
Setting expiry dates far in the future is intentional. The idea is that when people want to test Y2038 and set their system time to some future date after 2038 they don't have to think about what date specifically to set so that all components' test suites fit into it. Just pick something from the 21st century and it will work. Y2038 testing is done with a complete system, not just isolated components. Another consideration is that this way, expiry dates don't have to be re-set again in our lifetimes, this is done once, and no one has to deal with it again. Long validity periods don't affect security, as these certs are never deployed anywhere. |
That's what I meant in #107594 (comment). |
Enhancements to make_ssl_certs that aren't about expiration dates now have their own pull request: |
#119401 isn't getting any attention from reviewers, sadly, so this can't move forward either (as it needs to be rebased on top of that, once it merges). |
6ad5725
to
41fa741
Compare
Somehow, simply running make_ssl_certs.py on my build machine (and committing the result to this PR) no longer seems to produce certificates that tests are happy with:
I've confirmed this is not related to recent improvements to make_ssl_certs.py by reverting them and still observing this fail. I've excluded cert regeneration from this PR for now. This needs to be done separately by a reviewer/maintainer anyway to avoid supply chain attacks :) |
@encukou please take a look. |
I've bisected this to 8ef358d
I need to take a break now, but it probably needs to be reverted? Looks like cert3.pem was incorrectly allowed into the tree without a way to regenerate it. |
41fa741
to
592c5c8
Compare
Come to think of it, running make_ssl_certs.py should also be a part of the CI pipeline at least in one build. So that regressions like this don't happen. |
592c5c8
to
2ddcd47
Compare
Ok, I think the regression is resolved with these cert3.pem fixes. The PR for them is #124598 |
Took some time as I couldn't make this a high priority, but it looks like the yak is almost shaved now. I'd like to get the #120762 fix approved too, and then I'd run the resulting script, put updated certs in a separate PR, and merge all three. |
Signed-off-by: Alexander Kanavin <[email protected]>
…default This allows testing Y2038 with system time set to after that, so that actual Y2038 issues can be exposed, and not masked by expired certificate errors. Signed-off-by: Alexander Kanavin <[email protected]>
2ddcd47
to
c3d4d01
Compare
Done. |
@sethmlarson Well, this PR is in its final and pure form now. Do your objections still stand after @kanavin's later comments? (“Y2038 testing is done with a complete system”, “Long validity periods don't affect security, as these certs are never deployed anywhere.”) |
@encukou This change is fine with me. Since we're using OpenSSL APIs for now this is an okay fix (because OpenSSL doesn't have an opinion about certificate lifetimes), but if we ever adopt system certificate APIs then this approach won't work anymore. |
…pire far in the future by default (pythonGH-107594) This allows testing Y2038 with system time set to after that, so that actual Y2038 issues can be exposed, and not masked by expired certificate errors. Signed-off-by: Alexander Kanavin <[email protected]>
This allows testing Y2038 with system time set to after that, so that actual Y2038 issues can be exposed, and not masked by expired certificate errors.