-
Notifications
You must be signed in to change notification settings - Fork 4.8k
OCPBUGS-49441: Use different certificates for gRPC interoperability test routes #29757
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
OCPBUGS-49441: Use different certificates for gRPC interoperability test routes #29757
Conversation
|
@alebedev87: This pull request references Jira Issue OCPBUGS-49441, which is valid. 3 validation(s) were run on this bug
Requesting review from QA contact: The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
1b8896b to
8525a88
Compare
|
/retest |
|
Job Failure Risk Analysis for sha: 8525a88
Risk analysis has seen new tests most likely introduced by this PR. New Test Risks for sha: 8525a88
New tests seen in this PR at sha: 8525a88
|
8525a88 to
72b4ed0
Compare
|
/retest |
|
/retest |
|
/assign |
|
Job Failure Risk Analysis for sha: 72b4ed0
|
|
/retest-required |
| pemCrt, err := certgen.MarshalCertToPEMString(tlsCrtData) | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
|
|
||
| _, tlsCrt2Data, tlsPrivateKey2, err := certgen.GenerateKeyPair("Root CA", notBefore, notAfter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is a new Root CA being generated here? Is tlsCrt2Data intended to be a different root CA or a certificate signed by the first root CA?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is a new Root CA being generated here?
That's how GenerateKeyPair works. It generates a self signed root CA certificate and then uses it for the test certificate (which we get as second return value).
Is tlsCrt2Data intended to be a different root CA or a certificate signed by the first root CA?
It's intended to be a different certificate. I think that it may still be possible to sign it with the same root CA though. But I stick to what GenerateKeyPair does.
Having different certificates for secure routes instructs router to enable alpn option in crt-list command on HAProxy frontends (e.g. fe_sni). This results into the usage of ALPN TLS extension for the protocol negotiation. Without ALPN, grpc client will refuse to establish a connection to OpenShift router.
test/extended/router/grpc-interop.go
Outdated
| Key: derKey2, | ||
| Certificate: pemCrt2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use those formats (pem and der) for the cert and key?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are the formats returned by crypto/x509's CreateCertificate function. Both can be used to encode certificates or keys. DER is binary format while PEM is base64. I didn't see a lot the usage of DER for route's keys but it seems to be accepted by the API and router validation. Also, it is not that important when we set the key programmatically (not from a YAML manifest). So, I prefer to be consistent across the router's tests and keep using DER (http2 test does use DER format too).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed up on this one. It turned out that MarshalCertToDERFormat was a misnomer.
alebedev87
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Thealisyed : Thanks for the review! Here are the answers, feel free to follow up in the comments.
| pemCrt, err := certgen.MarshalCertToPEMString(tlsCrtData) | ||
| o.Expect(err).NotTo(o.HaveOccurred()) | ||
|
|
||
| _, tlsCrt2Data, tlsPrivateKey2, err := certgen.GenerateKeyPair("Root CA", notBefore, notAfter) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is a new Root CA being generated here?
That's how GenerateKeyPair works. It generates a self signed root CA certificate and then uses it for the test certificate (which we get as second return value).
Is tlsCrt2Data intended to be a different root CA or a certificate signed by the first root CA?
It's intended to be a different certificate. I think that it may still be possible to sign it with the same root CA though. But I stick to what GenerateKeyPair does.
Having different certificates for secure routes instructs router to enable alpn option in crt-list command on HAProxy frontends (e.g. fe_sni). This results into the usage of ALPN TLS extension for the protocol negotiation. Without ALPN, grpc client will refuse to establish a connection to OpenShift router.
test/extended/router/grpc-interop.go
Outdated
| Key: derKey2, | ||
| Certificate: pemCrt2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are the formats returned by crypto/x509's CreateCertificate function. Both can be used to encode certificates or keys. DER is binary format while PEM is base64. I didn't see a lot the usage of DER for route's keys but it seems to be accepted by the API and router validation. Also, it is not that important when we set the key programmatically (not from a YAML manifest). So, I prefer to be consistent across the router's tests and keep using DER (http2 test does use DER format too).
72b4ed0 to
44a9087
Compare
|
/retest-required |
|
Thanks for the answers and for the follow up PR for /lgtm |
|
Job Failure Risk Analysis for sha: 44a9087
|
|
Job Failure Risk Analysis for sha: 44a9087
|
|
Job Failure Risk Analysis for sha: 44a9087
|
|
Job Failure Risk Analysis for sha: 44a9087
|
|
Job Failure Risk Analysis for sha: 44a9087
|
1 similar comment
|
Job Failure Risk Analysis for sha: 44a9087
|
…ability test routes Before this change the gRPC routes were using the same certificate which prevented the usage of ALPN to avoid the connection coalescing. This commit introduces different certificates for edge and reencrypt routes.
44a9087 to
cf83316
Compare
|
Rebased from |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alebedev87, Thealisyed The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
1 similar comment
|
@alebedev87: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
Job Failure Risk Analysis for sha: cf83316
|
|
Job Failure Risk Analysis for sha: cf83316
|
|
/retest-required |
|
Job Failure Risk Analysis for sha: cf83316
|
9c672e0
into
openshift:main
|
@alebedev87: Jira Issue OCPBUGS-49441: Some pull requests linked via external trackers have merged: The following pull requests linked via external trackers have not merged:
These pull request must merge or be unlinked from the Jira bug in order for it to move to the next state. Once unlinked, request a bug refresh with Jira Issue OCPBUGS-49441 has not been moved to the MODIFIED state. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
[ART PR BUILD NOTIFIER] Distgit: openshift-enterprise-tests |
|
/jira refresh |
|
@melvinjoseph86: Jira Issue OCPBUGS-49441: All pull requests linked via external trackers have merged: Jira Issue OCPBUGS-49441 has been moved to the MODIFIED state. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
Before this change the gRPC routes were using the same certificate which prevented the usage of ALPN to avoid the connection coalescing. This PR introduces different certificates for edge and reencrypt routes.
PR to test the fix in combination with grpc-go
v1.67.0: #29780.