-
Notifications
You must be signed in to change notification settings - Fork 690
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
Certificate validation fails when certificate in chain is missing CN #2372
Comments
Contour has some validation to make sure that referenced certs are valid. Does your generated cert have a CN or SubjectAltName? |
I'm not sure what you mean by "generated cert". The validation was failing for the root certificate in the chain that we had stored in a Secret. I linked to the particular certificate chain above. |
This certificate does have a CN, not sure why we would not see it
|
If you copy the last certificate in the chain into it's own file and run the same you can see that the root certificate doesn't have a CN:
Whether this is correct or not I'm unsure... We've since started using the |
Thanks @nowylie! Yeh, it's fine per x509 to not have a CN. Only the leaf serving certificate really needs to have either the CN or SAN. |
We may need to update the CN check then to exclude root certificates or something. |
Ideally, we would validate the hostname from the proxy against the certificate bundle, but it's probably tricky to ensure that we are doing it the same way that Envoy will do it. I'm not sure how much validation Envoy will do at xDS time, but maybe that's the best place to know whether the certificates were bad. |
Okay, the requirement for there to be a CN or SAN is there for serving certificates. See #1965 and envoyproxy/envoy#9182 for more information, but Envoy used to crash if at least one of those fields is not present, and will now reject the config, putting Contour in the dreaded #1472 NACK state where no config updates will flow to Envoy if a serving certificate like this is found. I'm going to test out a few extra cases and see if we can update the validation logic to check that at least one certificate in a bundle contains a CN or SAN, and if that will be enough to allow Envoy to accept the cert. That would solve this issue, as currently, all certs in the bundle must have CN or SAN set. |
After speaking to @jpeach, it seems that Envoy expects the first cert in a bundle to be the serving cert, and will reject the whole thing if that first cert does not have a CN or SAN set. Working on a PR to fix this up now, and add additional testing to cover the "certificate in chain missing CN" use cases. |
This commit updates the Secret validation framework to address bugs around CA certificates, certificates with no CN, and various combinations of the above. Also updates documentation to make the rules for the types of Secrets clearer. Updates projectcontour#2372 Updates projectcontour#3889 Updates projectcontour#3496 Future work is to add some of these checks into the e2e tests, and ensure that all these configs produce valid Envoy config, with no NACKs. Signed-off-by: Nick Young <[email protected]>
This commit updates the Secret validation framework to address bugs around CA certificates, certificates with no CN, and various combinations of the above. Also updates documentation to make the rules for the types of Secrets clearer. Updates projectcontour#2372 Updates projectcontour#3889 Updates projectcontour#3496 Future work is to add some of these checks into the e2e tests, and ensure that all these configs produce valid Envoy config, with no NACKs. Signed-off-by: Nick Young <[email protected]>
This commit updates the Secret validation framework to address bugs around CA certificates, certificates with no CN, and various combinations of the above. Also updates documentation to make the rules for the types of Secrets clearer. Updates projectcontour#2372 Updates projectcontour#3889 Updates projectcontour#3496 Future work is to add some of these checks into the e2e tests, and ensure that all these configs produce valid Envoy config, with no NACKs. Signed-off-by: Nick Young <[email protected]>
This commit updates the Secret validation framework to address bugs around CA certificates, certificates with no CN, and various combinations of the above. Also updates documentation to make the rules for the types of Secrets clearer. Updates #2372 Updates #3889 Updates #3496 Future work is to add some of these checks into the e2e tests, and ensure that all these configs produce valid Envoy config, with no NACKs. Signed-off-by: Nick Young <[email protected]>
Okay, I believe the fix now merged into main should fix this issue. I'll close this, but please reopen if there are still issues once 1.20 is released. |
What steps did you take and what happened:
Contour failed to validate our full chain certificate when the last certificate in the chain was missing a CN. The error in the Contour logs was:
Specifically, Contour doesn't appear to like the root certificate in the GoDaddy Certificate Bundles - G2 With Cross to G1, includes Root (
gd_bundle-g2-g1.crt
) bundle found here.The result was that no HTTPS endpoint was configured for the specified ingress.
What did you expect to happen:
An HTTPS endpoint for the Ingress.
Anything else you would like to add:
N/A
Environment:
1.2.1
kubectl version
):baremetal
/etc/os-release
):Debian GNU/Linux 9.9 (stretch)
The text was updated successfully, but these errors were encountered: