-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Conversation
@jimini-lumox Thanks for taking this up. In addition to the test failures and formatting, you'll need to rewrite those commits (including the merge) with DCO sign-offs (see the DCO section in CONTRIBUTING.md). |
/wait |
Signed-off-by: Michael Hargreaves <[email protected]>
Signed-off-by: Michael Hargreaves <[email protected]>
Signed-off-by: Michael Hargreaves <[email protected]>
Signed-off-by: Michael Hargreaves <[email protected]>
f009fbc
to
7183a27
Compare
Signed-off-by: Michael Hargreaves <[email protected]>
Signed-off-by: Michael Hargreaves <[email protected]>
Signed-off-by: Michael Hargreaves <[email protected]>
…ng_dictionary.txt Signed-off-by: Michael Hargreaves <[email protected]>
include/envoy/http/header_map.h
Outdated
@@ -310,6 +310,7 @@ class HeaderEntry { | |||
HEADER_FUNC(Etag) \ | |||
HEADER_FUNC(Expect) \ | |||
HEADER_FUNC(ForwardedClientCert) \ | |||
HEADER_FUNC(ForwardedUntrustedClientCert) \ |
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:
- always hoist headers into x-forwarded-client-cert (instead of using x-forwarded-untrusted-client-cert for either failed or unvalidated)
- and,
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. - and then add a new RouteMatch field that can simplify the route matching rules for validation, eg something like:
message RouteMatch {
message CredentialMatchOptions {
google.protobuf.BoolValue validated = 1;
// can add further matches here - eg Issuer,Hash etc.
}
...
CredentialMatchOptions credentials = 11;
}
then the matching would simplify to:
"routes": [
{
"match": { "prefix": "/", "credentials": { "validated": false } },
"route": {
"cluster": "venue-edge-access-control",
...
}
},
{
"match": { "prefix": "/", "credentials": { "validated": true },
"headers": [ { "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.
The config example looks right, I think we should open another issue for this API proposal.
RouteMatch only uses http headers
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.
I was thinking that we could provide the StreamInfo through the route matching from which we can get the downstreamSslConnection info etc.
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.
include/envoy/http/header_map.h
Outdated
@@ -310,6 +310,7 @@ class HeaderEntry { | |||
HEADER_FUNC(Etag) \ | |||
HEADER_FUNC(Expect) \ | |||
HEADER_FUNC(ForwardedClientCert) \ | |||
HEADER_FUNC(ForwardedUntrustedClientCert) \ |
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.
Signed-off-by: Michael Hargreaves <[email protected]>
Signed-off-by: Michael Hargreaves <[email protected]>
Signed-off-by: Michael Hargreaves <[email protected]>
Signed-off-by: Michael Hargreaves <[email protected]>
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Add the ability to route match based on client credentials. This is an output of the changes requested for PR #8248 (#8248 (comment)) To more cleanly support #8248 , it would be better to be able to route based on downstream connection details, instead of hoisting more information into headers. As an API example, route matching based on presented and/or expired client certificate is supported. The end goal for #8248 is to route based on 'validated'. By default the routing rules are unchanged. Risk Level: Medium Testing: Currently Manual tests Docs Changes: API proto changes Release Notes: N/A Signed-off-by: Michael Hargreaves <[email protected]>
…eature-untrusted-client-certs Signed-off-by: Michael Hargreaves <[email protected]>
…eature-untrusted-client-certs Signed-off-by: Michael Hargreaves <[email protected]>
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
…textMatchOptions instead of additional header (x-forwarded-untrusted-client-cert) Signed-off-by: Michael Hargreaves <[email protected]>
Signed-off-by: Michael Hargreaves <[email protected]>
Signed-off-by: Michael Hargreaves <[email protected]>
Signed-off-by: Michael Hargreaves <[email protected]>
Signed-off-by: Michael Hargreaves <[email protected]>
Signed-off-by: Michael Hargreaves <[email protected]>
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
This pull request has been automatically closed because it has not had activity in the last 14 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Description: Add the ability to pass through and route 'untrusted' certificates.
This is a resurrection of #6760
The original PR covered two requirements:
Allowing certs that fail validation.
Request peer certs when there is nothing to validate against.
By default the client validation rules are unchanged.
Additional validation context options:
// Specify the certificate validation to be performed: VERIFY_TRUST_CHAIN(default), ACCEPT_UNTRUSTED, NOT_VERIFIED.
TrustChainVerification verify_certificate_trust_chain;
// If ACCEPT_UNTRUSTED or NOT_VERIFIED selected, when a client certificate fails (or is not validated) an x-forwarded-untrusted-client-cert HTTP header hoisted.
Risk Level: Medium
Testing: Manual and unit tests
Docs Changes: API proto changes
Release Notes: N/A