-
Notifications
You must be signed in to change notification settings - Fork 118
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-29373: generateHAProxyCertConfigMap: No H2 with dup certs #589
OCPBUGS-29373: generateHAProxyCertConfigMap: No H2 with dup certs #589
Conversation
@Miciah: This pull request references Jira Issue OCPBUGS-29373, which is valid. The bug has been moved to the POST state. 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. In 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. |
tested it with 4.16.0-0.ci.test-2024-04-30-082717-ci-ln-pzlmy6b-latest
|
/label qe-approved |
@Miciah: This pull request references Jira Issue OCPBUGS-29373, which is valid. 3 validation(s) were run on this bug
Requesting review from QA contact: In 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. |
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.
LGTM, just one question about break
ing in a loop.
contains := false | ||
for _, line := range strings.Split(string(content), "\n") { | ||
if line == entry { | ||
contains = true |
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.
Can we break once contains
is true?
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.
It's just test code, but I can add a break
.
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.
openshift/origin#28757 should fix the e2e-agnostic failure. |
/hold |
/assign @frobware |
28757 has merged. |
/test e2e-agnostic The verify jobs is failing because of go fmt differences. |
Add a check in generateHAProxyCertConfigMap for whether the same certificate is specified on more than one route, or whether a route specifies the default certificate as a custom certificate. If either of these conditions is detected, then configure HAProxy not to allow HTTP/2 client connections to this route. Using the same certificate for multiple routes signals to Web browsers that they can do HTTP/2 connection coalescing. This means that a browser could open a connection for one route and then re-use this connection to connect to a second route, which can cause the client's request to go to the wrong backend server. We try to prevent this client behavior by advertising HTTP/2 in TLS ALPN only for routes that have unique certificates. In general, we assume that if a route specifies a custom certificate, then it is a unique certificate. However, this assumption is not necessarily valid; indeed, it is possible to specify the same custom certificate on multiple routes, or specify the default certificate as an explicit certificate on a route. After this commit, OpenShift router detects the cases where multiple routes have the same certificate, or where a route specifies the default certificate; in these cases, we prohibit negotiating HTTP/2 using ALPN for those routes. This should prevent connection coalescing in this situation. This commit fixes OCPBUGS-29373. https://issues.redhat.com/browse/OCPBUGS-29373 * pkg/router/template/router.go (templateData): Add a CertificateIndex field to track the number of times each certificate is observed. ((templateRouter).writeConfig): Set CertificateIndex. * pkg/router/template/template_helper.go (generateHAProxyCertConfigMap): Use CertificateIndex to determine whether HTTP/2 should be enabled for the specified route. * pkg/router/router_test.go (TestMain): Configure the certs directory and default certificate. (TestConfigTemplate): Add test cases for two routes with distinct certificates, two routes with the same certificate, and a route that uses the default certificate. (mustCreate, (mustCreate).Apply): Add a cert field so that test cases can specify the route certificate. (mustMatchConfig): Add a mapFile field so that test cases can specify a map file to check. Add comments for all the fields. ((mustMatchConfig).Match): Add a switch to handle matching map files in addition to haproxy.config, using the new matchMapFile and matchConfig helper functions. (matchConfig, matchMapFile): New helper functions.
f86a9ba
to
0bc6f5e
Compare
https://github.com/openshift/router/compare/f86a9ba57bfa08239f396d8bf1fc597c332c1c62..0bc6f5ecf4c52169ca2a802cede164ac0a46f138 adds an aesthetic |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: frobware The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@Miciah: all tests passed! Full PR test history. Your PR dashboard. 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 kubernetes/test-infra repository. I understand the commands that are listed here. |
@Miciah: Jira Issue OCPBUGS-29373: All pull requests linked via external trackers have merged: Jira Issue OCPBUGS-29373 has been moved to the MODIFIED state. In 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] This PR has been included in build ose-haproxy-router-base-container-v4.16.0-202405031950.p0.g56ab14f.assembly.stream.el9 for distgit ose-haproxy-router-base. |
Fix included in accepted release 4.16.0-0.nightly-2024-05-04-214435 |
Add a check in
generateHAProxyCertConfigMap
for whether the same certificate is specified on more than one route, or whether a route specifies the default certificate as a custom certificate. If either of these conditions is detected, then configure HAProxy not to allow HTTP/2 client connections to this route.Using the same certificate for multiple routes signals to Web browsers that they can do HTTP/2 connection coalescing. This means that a browser could open a connection for one route and then re-use this connection to connect to a second route, which can cause the client's request to go to the wrong backend server. We try to prevent this client behavior by advertising HTTP/2 in TLS ALPN only for routes that have unique certificates.
In general, we assume that if a route specifies a custom certificate, then it is a unique certificate. However, this assumption is not necessarily valid; indeed, it is possible to specify the same custom certificate on multiple routes, or specify the default certificate as an explicit certificate on a route.
After this commit, OpenShift router detects the cases where multiple routes have the same certificate, or where a route specifies the default certificate; in these cases, we prohibit negotiating HTTP/2 using ALPN for those routes. This should prevent connection coalescing in this situation.