-
Notifications
You must be signed in to change notification settings - Fork 573
Fix default tls mode for destination and add 80-443 mapping for ext svc #314
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
Conversation
DISABLE = 0; | ||
|
||
// Placeholder | ||
TLSMODE_INVALID = 0; |
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 think we should keep DISABLE
the default (or change it to PASSTHROUGH
). Either way, IMO our default behavior should be to not touch the connection the app set up.
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.
There's also no reason to add an invalid value to our enum when there's a reasonable default value we can use instead.
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.
Right, but that is covered right? I can omit TLSmode completely, in which case, the semantics is keep things as is.. if I specify a TLS mode, I have to pick something or other (certificates, modes, etc..). Disable implies do not setup a TLS context in the upstream cluster.. I felt that it was a bit dangerous to leave as default.
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.
Actually, to that point: is DISABLED
even needed? If you're providing certs, you probably don't want TLS disabled. If you're not providing certs, there's no reason for a TLSOptions config at all, right?
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.
Yeah true. I was looking at it from a disable istio_mtls thing.. So that we have the ability to control the mTLS setting on a service by service basis. But may be this should not get into route rule in the first place. Should be kept strictly separate and let admins tackle that.. From that point, i think even specifying Istio as an mTLS option here seems like conflating auth and routing (I don't want to inherit RBAC related issues inside route rule semantics)..
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.
If Istio is turning on mTLS by default with it's own provided certificates, isn't mode: DISABLED
needed so the user can turn it off for a specific destination? Just omitting the TLSOptions will leave it as is. I don't see, however, why ISTIO
needs to be called out as a specific option. It seems to me that it's the same as MUTUAL
, just without user provided certificate. Am I missing something?
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.
You are right in that ISTIO implies mTLS. But I was trying to avoid this implicit inference that if its mTLS it will be istio, unless you specify your own certs. (for what its worth, I could turn off istio auth completely). In that case, having a distinct ISTIO_MTLS is more clearer than simply mTLS. But that may be me reading too much into this. I am open to any option here.
// If set to "disable", the proxy will use not setup a TLS connection | ||
// to the upstream server. | ||
DISABLE = 4; | ||
}; |
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.
nit: wrong indentation here
// If set to "istio", the proxy will set up mutual TLS authentication | ||
// using Istio CA issued certificates. This is the default when Istio | ||
// mTLS authentication is enabled mesh-wide. | ||
ISTIO = 1; |
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 need an explicit value for this? Could we instead use MUTUAL
and say that this is what happens if clientCertificate
and privateKey
are not set?
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 like the idea of using the enum to distinguish between 'mutual using local mesh identity' and 'mutual using specific key'. At some point we'll likely end up having to support 'mutual with specific mesh identity' when our identity management system allows for identity delegation.
We can just have the enum be "MUTUAL" but then we have to push the other options down into a one-of.
oneof {
ClientCert { client cert & provate key}
Identity "self" | {other user identity that can be asserted}
}
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.
Sorry just saw this message, right, current setup is more extendable, but maybe we can give a more meaningful name. What about
MUTUAL_TLS_ISTIO_CERT
TLS
MUTUAL_TLS_CLIENT_CERT
...
@@ -54,6 +54,33 @@ option go_package = "istio.io/api/routing/v1alpha2"; | |||
// tls: | |||
// mode: simple # initiates HTTPS when talking to example.com | |||
// | |||
// To reduce the configuration burden for the common case where most | |||
// external services are accessed over port 443, there is an implicit | |||
// internal mapping from port 80 to port 443. Such that an external 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.
Such that An external service declared without any port is assumed...
// | ||
// The application is expected to access these services over port 80 using | ||
// plain text http (i.e. http://foo.com, http://scooby.com, etc.). The | ||
// sidecar would originate TLS connections to the external service over |
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 sidecar will originate TLS connections to the external service on port 443
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.
Unless we set it otherwise ? Not all https servers are on 443.
// The application is expected to access these services over port 80 using | ||
// plain text http (i.e. http://foo.com, http://scooby.com, etc.). The | ||
// sidecar would originate TLS connections to the external service over | ||
// port 443 (i.e. https://foo.com, https://bar.com). Note that currently, |
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.
Nit: no comma after currently, I think it reads fine w/o it:
Note that currently this special case functionality is only available for non-wildcard domains.
// plain text http (i.e. http://foo.com, http://scooby.com, etc.). The | ||
// sidecar would originate TLS connections to the external service over | ||
// port 443 (i.e. https://foo.com, https://bar.com). Note that currently, | ||
// this special case functionality is available only for non-wildcard |
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.
"only available" instead of "available only" reads better IMO.
@@ -174,7 +201,11 @@ message ExternalService { | |||
// the specified destination endpoint IP/host. | |||
repeated string hosts = 1; | |||
|
|||
// REQUIRED. The ports associated with the external service. | |||
// The ports associated with the external service. If omitted, 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 ports associated with the external service. If no ports are provided, the external service is assumed to be reachable over HTTPS on port 443. Applications calling the external service over HTTP on port 80 will be automatically forwarded to the external destination over HTTPS on port 443 by the sidecar.
@ijsnellf feels that this is going to lead to trouble. His point of view is that the following is not so terrible after all. kind: ExternalService
hosts:
- simpleapi.google.com #can't do wildcards if we want port remapping
ports:
- number: 80
protocol: http
- number: 443
protocol: https
---
kind: RouteRule
hosts:
- simpleapi.google.com
http:
- match:
- port:
number: 80
route:
- destination:
name: simpleapi.google.com
port: 443
---
kind: DestinationRule
name: simpleapi.google.com
http:
- port: 443
tls:
mode: simple
--- If we get the ability to rewrite ports for wildcards as well, we can avoid repetition of rules, by lumping lots of domains (e.g., *.watson.net) under a single combo of ext service, route rule, dest rule as shown above. |
@@ -393,19 +393,29 @@ message OutlierDetection { | |||
message TLSSettings { |
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.
One small issue: if destination is *.foo.com, I'm not sure how SNI and SAN will be specified... Maybe indicate in the doc that if SNI or SAN is needed, you need individual hosts, no wildcard ?
Also, once Piotr has the SNI sniffing - we may want to add mode=TRANSPARENT, in which case the client will initiate
a https connection ( all other modes assume client connects to http://foo.com:443 - I assume ? ).
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.
This is covered by the SAN and SNI fields on this object:
api/routing/v1alpha2/destination_rule.proto
Lines 437 to 443 in 911b3fc
// A list of alternate names to verify the subject identity in the | |
// certificate. If specified, the proxy will verify that the server | |
// certificate's subject alt name matches one of the specified values. | |
repeated string subject_alt_names = 5; | |
// SNI string to present to the server during TLS handshake. | |
string sni = 6; |
We should update the comment on the SNI field to make clear that it must be a a subset of the hosts in the destination.
@@ -37,7 +37,7 @@ option go_package = "istio.io/api/routing/v1alpha2"; | |||
// hosts: | |||
// - example.com | |||
// ports: | |||
// - number: 443 | |||
// - number: 9443 |
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.
While 9443 is better then 443 - it may be better to avoid the 443 completely, still red flags... 9080 ?
// configuration fields (clientCertificate, privateKey). | ||
MUTUAL = 3; | ||
|
||
// If set to "disable", the proxy will use not setup a TLS connection |
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.
doc is unclear. I tend to agree with Zack on PASSTHROUGH
* Basic integration test * Addressed comments
Automatic merge from submit-queue. [DO NOT MERGE] Auto PR to update dependencies of mixerclient This PR will be merged automatically once checks are successful. ```release-note none ```
No description provided.