Skip to content

Conversation

ramaraochavali
Copy link
Contributor

#26684 did not fix the custom sni properly. It did not add it correctly to the upstream tls settings. This PR fixes it.

[ ] Configuration Infrastructure
[ ] Docs
[ ] Installation
[ X] Networking
[ ] Performance and Scalability
[ ] Policies and Telemetry
[ ] Security
[ ] Test and Release
[ ] User Experience
[ ] Developer Infrastructure

Pull Request Attributes

Please check any characteristics that apply to this pull request.

[X ] Does not have any changes that may affect Istio users.

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>
@ramaraochavali ramaraochavali requested a review from a team as a code owner November 4, 2020 07:23
@istio-policy-bot istio-policy-bot added area/networking release-notes-none Indicates a PR that does not require release notes. labels Nov 4, 2020
@google-cla google-cla bot added the cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. label Nov 4, 2020
@istio-testing istio-testing added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 4, 2020
Signed-off-by: Rama Chavali <rama.rao@salesforce.com>
@@ -135,13 +137,14 @@ func tlsContextConvert(tls *networkingAPI.ClientTLSSettings, sniName string, met
},
}
tlsContext.CommonTlsContext.AlpnProtocols = util.ALPNInMeshH2
// For ISTIO_MUTUAL if custom SNI is not provided, use the default SNI name.
if len(tls.Sni) == 0 {
tlsContext.Sni = sniName
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do the other types use tls.Sni but here we use sniName?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch we have to set tls.Sni if it exists and if it does not exist for ISTIO_MUTUAL we will have to set the default SNI name. This was existing implementation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like for ISTIO_MUTUAL we only honor the sniName not the ones given in tls.Sni. So the existing implementation is correct.

Copy link
Contributor Author

@ramaraochavali ramaraochavali Nov 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore the above. I corrected the code. If tls.Sni exists we use it otherwise use the default sniName. All tests are passing now. PTAL

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>
@ramaraochavali
Copy link
Contributor Author

/test integ-pilot-k8s-tests_istio

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>
Signed-off-by: Rama Chavali <rama.rao@salesforce.com>
@ramaraochavali
Copy link
Contributor Author

/test integ-pilot-k8s-tests_istio

@@ -374,7 +374,7 @@
,
{
"name": "zipkin",
"transport_socket": {"name":"envoy.transport_sockets.tls","typed_config":{"@type":"type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext","common_tls_context":{"combined_validation_context":{"default_validation_context":{},"validation_context_sds_secret_config":{"name":"file-root:/etc/zipkin/ca.pem","sds_config":{"api_config_source":{"api_type":"GRPC","grpc_services":[{"envoy_grpc":{"cluster_name":"sds-grpc"}}],"transport_api_version":"V3"},"resource_api_version":"V3"}}}}}},
"transport_socket": {"name":"envoy.transport_sockets.tls","typed_config":{"@type":"type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext", "sni":"zipkin-custom-sni", "common_tls_context":{"combined_validation_context":{"default_validation_context":{},"validation_context_sds_secret_config":{"name":"file-root:/etc/zipkin/ca.pem","sds_config":{"api_config_source":{"api_type":"GRPC","grpc_services":[{"envoy_grpc":{"cluster_name":"sds-grpc"}}],"transport_api_version":"V3"},"resource_api_version":"V3"}}}}}},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx!

@ramaraochavali
Copy link
Contributor Author

@howardjohn Can you PTAL when you get chance?

@ramaraochavali
Copy link
Contributor Author

/test integ-pilot-k8s-tests_istio

@istio-testing istio-testing merged commit 4b76b26 into istio:master Nov 7, 2020
@ramaraochavali ramaraochavali deleted the fix/zipkin_tls branch November 7, 2020 09:41
vikaschoudhary16 pushed a commit to vikaschoudhary16/istio that referenced this pull request Feb 12, 2021
* fix custom sni properly

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

* remove unnecessary code

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

* fix istio mutual tls

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

* revert istio mutual tls

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

* try setting again

Signed-off-by: Rama Chavali <rama.rao@salesforce.com>

Co-authored-by: Rama Chavali <rama.rao@salesforce.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/networking cla: yes Set by the Google CLA bot to indicate the author of a PR has signed the Google CLA. release-notes-none Indicates a PR that does not require release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants