-
Notifications
You must be signed in to change notification settings - Fork 138
OCPBUGS-87205: Strip X-SSL-Client-* headers for plain HTTP #787
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
base: master
Are you sure you want to change the base?
Changes from all commits
2e0ec41
ef98dff
fca5221
861e7c2
d180c82
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -273,6 +273,23 @@ frontend public | |
| # Strip off Proxy headers to prevent HTTpoxy (https://httpoxy.org/) | ||
| http-request del-header Proxy | ||
|
|
||
| # Strip off X-SSL* headers for plain HTTP if not explicitly disabled. | ||
| # This prevents unauthenticated spoofing of mutual TLS client identities. | ||
| {{- if isTrue (env "ROUTER_MUTUAL_TLS_HEADER_FILTER" "true") }} | ||
| http-request del-header X-SSL | ||
| http-request del-header X-SSL-Client-CN | ||
| http-request del-header X-SSL-Client-DER | ||
| http-request del-header X-SSL-Client-DN | ||
| http-request del-header X-SSL-Client-NotAfter | ||
| http-request del-header X-SSL-Client-NotBefore | ||
| http-request del-header X-SSL-Client-SHA1 | ||
| http-request del-header X-SSL-Client-Serial | ||
| http-request del-header X-SSL-Client-Subject | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While we don't set them on router, I think it is a valid deletion. This header can also be used for authentication, in case some day we decide to add it to router passing to backend by a customer request we can run on a problem of forgetting to remove it
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems arbitrary. Why not also add |
||
| http-request del-header X-SSL-Client-Verify | ||
| http-request del-header X-SSL-Client-Version | ||
| http-request del-header X-SSL-Issuer | ||
| {{- end }} | ||
|
|
||
| # DNS labels are case insensitive (RFC 4343), we need to convert the hostname into lowercase | ||
| # before matching, or any requests containing uppercase characters will never match. | ||
| http-request set-header Host %[req.hdr(Host),lower] | ||
|
|
@@ -390,6 +407,24 @@ frontend fe_sni | |
| # Strip off Proxy headers to prevent HTTpoxy (https://httpoxy.org/) | ||
| http-request del-header Proxy | ||
|
|
||
| # Strip off X-SSL* headers if not explicitly disabled. | ||
| # This prevents unauthenticated spoofing of mutual TLS client identities | ||
| # when mutual TLS is not enabled and so the headers are not set below. | ||
| {{- if isTrue (env "ROUTER_MUTUAL_TLS_HEADER_FILTER" "true") }} | ||
| http-request del-header X-SSL | ||
| http-request del-header X-SSL-Client-CN | ||
| http-request del-header X-SSL-Client-DER | ||
| http-request del-header X-SSL-Client-DN | ||
| http-request del-header X-SSL-Client-NotAfter | ||
| http-request del-header X-SSL-Client-NotBefore | ||
| http-request del-header X-SSL-Client-SHA1 | ||
| http-request del-header X-SSL-Client-Serial | ||
| http-request del-header X-SSL-Client-Subject | ||
| http-request del-header X-SSL-Client-Verify | ||
| http-request del-header X-SSL-Client-Version | ||
| http-request del-header X-SSL-Issuer | ||
| {{- end }} | ||
|
|
||
| # DNS labels are case insensitive (RFC 4343), we need to convert the hostname into lowercase | ||
| # before matching, or any requests containing uppercase characters will never match. | ||
| http-request set-header Host %[req.hdr(Host),lower] | ||
|
|
@@ -505,6 +540,24 @@ frontend fe_no_sni | |
| # Strip off Proxy headers to prevent HTTpoxy (https://httpoxy.org/) | ||
| http-request del-header Proxy | ||
|
|
||
| # Strip off X-SSL* headers if not explicitly disabled. | ||
| # This prevents unauthenticated spoofing of mutual TLS client identities | ||
| # when mutual TLS is not enabled and so the headers are not set below. | ||
| {{- if isTrue (env "ROUTER_MUTUAL_TLS_HEADER_FILTER" "true") }} | ||
| http-request del-header X-SSL | ||
| http-request del-header X-SSL-Client-CN | ||
| http-request del-header X-SSL-Client-DER | ||
| http-request del-header X-SSL-Client-DN | ||
| http-request del-header X-SSL-Client-NotAfter | ||
| http-request del-header X-SSL-Client-NotBefore | ||
| http-request del-header X-SSL-Client-SHA1 | ||
| http-request del-header X-SSL-Client-Serial | ||
| http-request del-header X-SSL-Client-Subject | ||
| http-request del-header X-SSL-Client-Verify | ||
| http-request del-header X-SSL-Client-Version | ||
| http-request del-header X-SSL-Issuer | ||
| {{- end }} | ||
|
|
||
| # DNS labels are case insensitive (RFC 4343), we need to convert the hostname into lowercase | ||
| # before matching, or any requests containing uppercase characters will never match. | ||
| http-request set-header Host %[req.hdr(Host),lower] | ||
|
|
||
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.
The indentation of these Go template stanzas is inconsistent with surrounding Go template stanzas, but the template already has similar inconsistencies elsewhere; we can fix them all up in a follow-up.