-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
3.9 alpha 3/4 regression: Certificate verification fails with GnuTLS #18715
Comments
This is with GnuTLS 3.5.18 in current Fedora 27, and also happens with GnuTLS 3.6.2 in Rawhide. |
Confirmed with 3.9-alpha.4 aka v3.9.0 (which is on dockerhub, but not on the GitHub release page yet).
|
@openshift/sig-security |
possibly fixed by #18713 |
Cool I break and fix things without even realizing. |
@enj: Nice, thanks! Is there some trick how I can get a build (just the compiled binary or a docker container etc.) with that fix included? Peter Volpe mentioned that OpenShift 3.9 has some other API changes that need adjustment in Cockpit, and I'd like to start with that ASAP. |
The :latest and :v3.9 tags are continuously updated as fixes merge to
master.
…On Thu, Feb 22, 2018 at 3:29 PM, Martin Pitt ***@***.***> wrote:
@enj <https://github.com/enj>: Nice, thanks! Is there some trick how I
can get a build (just the compiled binary or a docker container etc.) with
that fix included? Peter Volpe mentioned that OpenShift 3.9 has some other
API changes that need adjustment in Cockpit, and I'd like to start with
that ASAP.
—
You are receiving this because you are on a team that was mentioned.
Reply to this email directly, view it on GitHub
<#18715 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABG_p7A9Yn5muKZhK8pWHXnw2IUhzhjcks5tXc4fgaJpZM4SO_Al>
.
|
@martinpitt #18713 is merged, can you see if it fixes your issue? |
Negative, I'm afraid. I've installed v3.9.0 (latest), image 297850a38c48, which was built 20 hours ago. The PR was merged 2 days ago, so I would assume it includes that PR. But GnuTLS still fails with the above reproducer. |
At the moment the only difference that I'm seeing with the gnutls and openssl commands is that openssl is sending both the cert and CA and gnutls is just sending the cert. Since the x509 authenticator is seeing > 1 cert from openssl it adds the CA to the intermediates list before verifying, however since the cert is signed directly by the CA that is already in the roots pool that should not matter. On the server we see a generic verification failure only with the gnutls client:
|
In the GnuTLS case, the certificate subject is being modified in-place somewhere along the way. Since the subject is modified, this leads to the signature verification failing. I can actually reproduce this outside of OpenShift with a basic HTTPS server:
If you use the same certificates, with the master server certificate and key in the server above, you will be able to see that the raw subject data is different between the two commands: openssl:
GnuTLS:
Notice that the multi-value group values (the "O" rdn) is being swapped in place. I tested with go 1.9, 1.5, and 1.4, with gnutls-utils-3.5.16-4.fc26.x86_64 and gnutls-utils-2.12.23-21.el6.x86_64 and got the same results. You are probably only seeing this now because the addition of a second "O" rdn was recently added in #17414 I suspect that GnuTLS is doing this to the subject for some odd reason, but I don't know why exactly. |
Seems like GnuTLS might not be handling multi-RDN certs correctly |
@mrogers950 : Nice debugging, thank you so much! It even works if you just swap the Took me a bit to figure out all the steps to update the certificate, so noting them down here for posterity.
I'll put that into cockpit's VM creation script for the OpenShift prerelease image, so that we are unblocked on testing. This isn't a final solution, of course, as other people will stumble over this as well. While it might be a GnuTLS bug, maybe as an intermediate bandaid the O= order can be swapped? Thanks again! |
(I opened https://gitlab.com/gnutls/gnutls/issues/403 for this) |
openshift/origin#17414 introduced a second organization value `system:masters`. Apparently GnuTLS mis-handles multiple RDNs by re-ordering them and then rejecting the client certificate due to a mismatching subject. When building the openshift-prerelease image (and only then), work around this by regenerating the admin certificate with swapping the `O:` fields around. This is an utter hack, but unblocks testing OpenShift 3.9 for now. See openshift/origin#18715 for details.
openshift/origin#17414 introduced a second organization value `system:masters`. Apparently GnuTLS mis-handles multiple RDNs by re-ordering them and then rejecting the client certificate due to a mismatching subject. When building the openshift-prerelease image (and only then), work around this by regenerating the admin certificate with swapping the `O:` fields around. This is an utter hack, but unblocks testing OpenShift 3.9 for now. See openshift/origin#18715 for details.
@nmav PTAL |
As I mentioned in gnutls/403, gnutls modifying the cert cannot be the issue. Certificates are immutable objects and are not modified (otherwise the signature will be invalidated). The issue seems to be on the server, but we may see if we can improve something in gnutls to avoid making it confused. Or I may have not the full picture of how does this work. Are the certificates fixed in both cases, or are generated by openssl and gnutls independently? |
Could it call "openssl x509" to generate the certificate then? With
You avoid the
|
I don't anticipate changing the cert generation architecture for this |
@martinpitt thanks to @mrogers950 and @nmav we found the cause (bug in golang certificate generation) and we may have a workaround for now. |
This is to workaround Bug openshift#18715, which is caused by Golang Crypto's x509 certificate generation ordering Subjects RDN incorrectly *and* GNUTLS' bug that "fixes" client certs on read with the correct encoding. To avoid issues until both are fixed we set the correct ordering ourself Signed-off-by: Simo Sorce <[email protected]>
Note there is also a bug in GNUTLS that "fixes" client cert encoding when it shouldn't ... so 2 bugs for one issue, nice! :-) |
This is to workaround Bug openshift#18715, which is caused by Golang Crypto's x509 certificate generation ordering Subjects RDN incorrectly *and* GNUTLS' bug that "fixes" client certs on read with the correct encoding. To avoid issues until both are fixed we set the correct ordering on our own... Signed-off-by: Simo Sorce <[email protected]>
This is to workaround Bug openshift#18715, which is caused by Golang Crypto's x509 certificate generation ordering Subjects RDN incorrectly *and* GNUTLS' bug that "fixes" client certs on read with the correct encoding. To avoid issues until both are fixed we set the correct ordering on our own... Signed-off-by: Simo Sorce <[email protected]>
Just for completeness, GNUTLS fix is merged here: https://gitlab.com/gnutls/gnutls/merge_requests/608 |
This is to workaround Bug openshift#18715, which is caused by Golang Crypto's x509 certificate generation ordering Subjects RDN incorrectly *and* GNUTLS' bug that "fixes" client certs on read with the correct encoding. To avoid issues until both are fixed we set the correct ordering on our own... Signed-off-by: Simo Sorce <[email protected]>
Automatic merge from submit-queue (batch tested with PRs 18835, 18857, 18641, 18656, 18837). Reorder groups in cert Subjects This is to workaround Bug #18715, which is caused by Golang Crypto's x509 certificate generation ordering Subjects RDN incorrectly *and* GNUTLS' bug that "fixes" client certs on read with the correct encoding. To avoid issues until both are fixed we set the correct ordering ourself Fixes #18715 xref golang/go#24254 https://gitlab.com/gnutls/gnutls/issues/403#note_61687722
This still fails with the recently released v3.9.0. Indeed it seems PR #18837 only landed in master, not in the 3.9 branch? At least it's definitively not applied in https://github.com/openshift/origin/blob/v3.9.0/pkg/cmd/server/crypto/crypto.go , only in https://github.com/openshift/origin/blob/master/pkg/cmd/server/crypto/crypto.go . Can this please get cherry-picked into 3.9.1, so that this works with Cockpit and other GnuTLS clients? |
Unfortunately the fix for openshift/origin#18715 did not make it into the latest v3.9.0 release, so apply it to the stable "openshift" image as well. It is already conditionally done on broken certificates.
Unfortunately the fix for openshift/origin#18715 did not make it into the latest v3.9.0 release, so apply it to the stable "openshift" image as well. It is already conditionally done on broken certificates.
Unfortunately the fix for openshift/origin#18715 did not make it into the latest v3.9.0 release, so apply it to the stable "openshift" image as well. It is already conditionally done on broken certificates.
Unfortunately the fix for openshift/origin#18715 did not make it into the latest v3.9.0 release, so apply it to the stable "openshift" image as well. It is already conditionally done on broken certificates.
Unfortunately the fix for openshift/origin#18715 did not make it into the latest v3.9.0 release, so apply it to the stable "openshift" image as well. It is already conditionally done on broken certificates.
Unfortunately the fix for openshift/origin#18715 did not make it into the latest v3.9.0 release, so apply it to the stable "openshift" image as well. It is already conditionally done on broken certificates.
Unfortunately the fix for openshift/origin#18715 did not make it into the latest v3.9.0 release, so apply it to the stable "openshift" image as well. It is already conditionally done on broken certificates.
- Drop kubevirt for now. It has been broken for many months now (cockpit-project#9479, cockpit-project#9638), and we must rebuild openshift to finally unbreak our cockpit/ws container (cockpit-project#9941). kubevirt tests continue to run on the openshift-prerelease image, which is sufficient for nw. - Move image to fedora-28, so that we can move cockpit/ws and cockpit/base to fedora-28. - Drop workaround for [certificate bug](openshift/origin#18715), the fix is in latest OpenShift 3.9.0 now. Fixes cockpit-project#9479
- Drop kubevirt for now. It has been broken for many months now (cockpit-project#9479, cockpit-project#9638), and we must rebuild openshift to finally unbreak our cockpit/ws container (cockpit-project#9941). kubevirt tests continue to run on the openshift-prerelease image. - Move image to fedora-28, so that we can move cockpit/ws and cockpit/base to fedora-28. - Update workaround for openshift/origin#18715 to install "openssl", which is not in the default install any more on Fedora 28. Fixes cockpit-project#9479 Closes cockpit-project#9975
- Drop kubevirt for now. It has been broken for many months now (cockpit-project#9479, cockpit-project#9638), and we must rebuild openshift to finally unbreak our cockpit/ws container (cockpit-project#9941). kubevirt tests continue to run on the openshift-prerelease image. - Move image to fedora-28, so that we can move cockpit/ws and cockpit/base to fedora-28. - Drop workaround for openshift/origin#18715, the fix is in latest OpenShift 3.9.0 now. Fixes cockpit-project#9479 Closes cockpit-project#9975
- Drop kubevirt for now. It has been broken for many months now (#9479, #9638), and we must rebuild openshift to finally unbreak our cockpit/ws container (#9941). kubevirt tests continue to run on the openshift-prerelease image. - Move image to fedora-28, so that we can move cockpit/ws and cockpit/base to fedora-28. - Update workaround for openshift/origin#18715 to install "openssl", which is not in the default install any more on Fedora 28. Fixes #9479 Closes #9975
SSL certificate based authentication fails with 3.9 alpha 3 when using GnuTLS (which Cockpit does, via glib-networking). This has worked fine so far, up to 3.7.
Things work fine with the
oc
client:To illustrate it with OpenSSL vs GnuTLS, let's extract the certificate into standard X.509 files:
Now, authentication with curl works:
It also works with OpenSSL:
But not with GnuTLS:
For that, openshift logs an error message:
Version
oc v3.9.0-alpha.3+78ddc10
kubernetes v1.9.1+a0ce1bc657
features: Basic-Auth GSSAPI Kerberos SPNEGO
Server https://10.111.112.101:8443
openshift v3.9.0-alpha.3+78ddc10
kubernetes v1.9.1+a0ce1bc657
The text was updated successfully, but these errors were encountered: