gh-107562: Lib/test: update test certificates to expire far in the future#107594
gh-107562: Lib/test: update test certificates to expire far in the future#107594encukou merged 2 commits into
Conversation
Sorry, something went wrong.
9d1eaf9 to
725e4c0
Compare
August 3, 2023 15:27
725e4c0 to
8b1fe18
Compare
January 4, 2024 09:39
|
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.
|
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
971a38f to
cb1d9bb
Compare
April 26, 2024 12:08
|
@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. |
Sorry, something went wrong.
|
To be clear, I'm worried about increasing the expiration from @sethmlarson, do you have any thoughts here? The relevant change is to |
Sorry, something went wrong.
|
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? |
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
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. |
Sorry, something went wrong.
|
@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 |
Sorry, something went wrong.
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: |
Sorry, something went wrong.
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. |
Sorry, something went wrong.
That's what I meant in #107594 (comment). |
Sorry, something went wrong.
|
Enhancements to make_ssl_certs that aren't about expiration dates now have their own pull request: |
Sorry, something went wrong.
|
#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). |
Sorry, something went wrong.
6ad5725 to
41fa741
Compare
September 26, 2024 11:11
|
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 :) |
Sorry, something went wrong.
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. |
Sorry, something went wrong.
41fa741 to
592c5c8
Compare
September 26, 2024 12:41
|
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. |
Sorry, something went wrong.
592c5c8 to
2ddcd47
Compare
September 26, 2024 14:22
Ok, I think the regression is resolved with these cert3.pem fixes. The PR for them is #124598 |
Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
…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 <alex.kanavin@gmail.com>
2ddcd47 to
c3d4d01
Compare
October 7, 2024 13:51
Done. |
Sorry, something went wrong.
|
@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.”) |
Sorry, something went wrong.
|
@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. |
Sorry, something went wrong.
…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 <alex.kanavin@gmail.com>
Most issues were resolved via upstream version updates that bring in needed fixes: glib-2.0 update to 2.78.0 that includes: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3547 https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3550 curl update to 8.3.0 that includes curl/curl#11610 util-linux update to 2.39 that includes util-linux/util-linux#2430 util-linux/util-linux@3ab9e69 util-linux/util-linux#2435 glib-networking update to 2.78.0 that includes https://gitlab.gnome.org/GNOME/glib-networking/-/merge_requests/241 python3-cryptography update to 42.0.0 which resolves pyca/cryptography#9370 via pyca/cryptography#9964 perl update to 5.40.0 which includes Perl/perl5#21379 python3 update to 3.13.0 which includes python/cpython#118425 python3 update to 3.13.1 which includes python/cpython#124972 python3 update to 3.14.0 which includes python/cpython#119401 python/cpython#125045 python/cpython#107594 python/cpython#125104 tcl update to 9.0.0 which includes tcltk/tcl@4ca6172 (tcl8 recipe has a simple backport of this) dbus update to 1.16.0 which includes https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/444 https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/289 openssh update to 10.0p1 which includes openssh/openssh-portable#425 https://bugzilla.mindrot.org/show_bug.cgi?id=3684 https://marc.info/?l=openbsd-bugs&m=172561736524815&w=2 https://lists.mindrot.org/pipermail/openssh-unix-dev/2024-October/041621.html (all reporting the same issue) gcc update to 15.1 which includes llvm/llvm-project#99699 via gcc-mirror/gcc@fa32100 and allows dropping special flags and exceptions for gcc-sanitizers. Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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.