Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Feature untrusted client certs #8248
Feature untrusted client certs #8248
Changes from 12 commits
76db27e
fa49263
ac64de9
7183a27
b46e68f
651c486
068a96d
a2af86a
38aa67c
0b5d7f6
701083e
8930a36
5d33098
f5b063c
28222fc
2f197ad
ec67893
2f6a793
1bf38c1
d1e9b83
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Do we really want a new header field for untrusted client certificates? Can we just add
Trusted=False
in XFCC header to indicate that?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.
We had initially implemented this way, however had concerns over the potential for existing code to treat ForwardedClientCert as having passed validation.
An example of the routing we perform is as follows: - route to the intended service, iff have x-forwarded-client-cert header. (I guess a 'safe-regex_match' could alternatively be used to route based on 'Trusted=False/True'
"routes": [
{
"match": { "prefix": "/", "headers": [
{ "name": "x-forwarded-untrusted-client-cert", "present_match": true }
] },
"route": {
"cluster": "venue-edge-access-control",
"prefix_rewrite": "/api/cert/untrusted",
"host_rewrite": "venue-edge-access-control"
}
},
{
"match": { "prefix": "/", "headers": [
{ "name": "x-forwarded-client-cert", "present_match": true, "invert_match" : true }
] },
"route": {
"cluster": "venue-edge-access-control",
"prefix_rewrite": "/api/cert/untrusted",
"host_rewrite": "venue-edge-access-control"
}
},
{
"match": { "prefix": "/", "headers": [
{ "name": "x-forwarded-client-cert", "present_match": true },
{ "name": ":authority", "prefix_match": "service-actual-target-service" }
] },
"route": {
"cluster": "service-actual-target-service"
}
},
....
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.
@PiotrSikora thoughts on these headers and what other proxies might do.
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.
@jimini-lumox I see what your example try to address. Does it make more sense to have a route matcher based on presented client cert semantically rather than relying on XFCC/XFUCC header? Adding header and route matching can be orthogonal.
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'm not sure I understand exactly, or how to achieve it using the route matcher. Below is a comment on our usage from the first cut of the PR (#5207). Do you know how we would use route matching to handle the scenarios (maybe it's easy, I'm not sure)
We use Envoy as an Edge Proxy to host services, with thousands of devices in venues on a private network.
We're using the Hash List as validation of clients, which will initially be empty ie - nothing to validate against.
Client Certs are currently self-signed (no PKI infrastructure available) - so there is nothing within the certificate to validate against.
If a client connects and its Cert Hash is in the list, it will be routed to its intended target service.
(eg: x-forwarded-client-cert header present & :authority header match)
If a client connects and its Cert Hash is not in the list (or there is no validation context yet), then it may be routed to an access-control-service.
(eg: x-forwarded-untrusted-client-cert header present & :authority header match)
Then the access-control-service controls whether a client is to be permitted, in which case the client hash will be added to the verify_certificate_hash list (using dynamic_resources from the Edge Proxy, so subsequent request is routed to the intended service).
Additionally we may not care if a client needs to be validated to reach certain other host services.
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.
RouteMatch only uses http headers, so if I'm following you correctly:
either add a field to the x-forwarded-client-cert to indicated that it passed/failed validation (eg Trusted=false)
or add another http header that simply indicates whether the client was validated, so we can route based on this.
then the matching would simplify to:
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 config example looks right, I think we should open another issue for this API proposal.
This is how current implementation does but not a hard limitation. You can use the cert information directly from downstream connection and plumb it into RouteMatcher.
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.
Ok, so should I create a new PR that has this API proposal including the changes to route the required connection info through to the Route matching.
I was thinking that we could provide the StreamInfo through the route matching from which we can get the downstreamSslConnection info etc.
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.
Exactly.
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've raised PR #8453 with an initial cut of passing the connection stream_info through to the route matching.