Skip to content

Add tcp_tls protocol to Istio traffic management#6280

Merged
rshriram merged 9 commits intoistio:masterfrom
vadimeisenbergibm:tls_with_sni
Jun 15, 2018
Merged

Add tcp_tls protocol to Istio traffic management#6280
rshriram merged 9 commits intoistio:masterfrom
vadimeisenbergibm:tls_with_sni

Conversation

@vadimeisenbergibm
Copy link
Copy Markdown
Contributor

Add tls_with_sni as a protocol different from https and tcp. It should be handled by Istio as opaque TLS with SNI, for which no TLS termination is performed. Note that if no TLS termination is performed, the protocol on top of TLS cannot be known - the communication is encrypted. For a proxy, it does not matter if the protocol on top TLS is HTTP or Mongo, it is opaque for the proxy since the proxy cannot decrypt it. Without TLS termination, treatment of HTTPS or Mongo/TLS is exactly the same.

Note the distinction of TLS without SNI and tls_with_sni. For TLS without SNI, the proxy can probably do nothing other than to treat it as opaque TCP.

The proposed classification and treatment of the protocols on top of TLS:

  1. https is known to be HTTP on top of TLS with SNI. Optional TLS termination by Istio and then treating the protocol as HTTP.
  2. tls_with_sni is unknown protocol on top of TLS with SNI. Treated as an opaque TCP with known SNI, including matching by SNI for routing.
  3. TLS without SNI is treated as tcp, an opaque TCP without SNI and without matching by SNI.

@istio-testing
Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vadimeisenbergibm

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 14, 2018

Codecov Report

Merging #6280 into master will decrease coverage by 1%.
The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #6280    +/-   ##
=======================================
- Coverage      68%     67%   -<1%     
=======================================
  Files         345     345            
  Lines       30569   30589    +20     
=======================================
- Hits        20499   20493     -6     
- Misses       9250    9279    +29     
+ Partials      820     817     -3
Impacted Files Coverage Δ
pilot/pkg/model/service.go 78% <0%> (-2%) ⬇️
pilot/pkg/networking/core/v1alpha3/listener.go 1% <0%> (ø) ⬆️
...olarwinds/internal/papertrail/papertrail_logger.go 59% <0%> (-21%) ⬇️
mixer/adapter/cloudwatch/cloudwatch.go 58% <0%> (-9%) ⬇️
mixer/adapter/statsd/statsd.go 95% <0%> (ø) ⬇️
mixer/pkg/protobuf/yaml/dynamic/primitive.go 98% <0%> (ø) ⬇️
mixer/adapter/list/regexList.go 100% <0%> (ø) ⬆️
mixer/pkg/pool/goroutine.go 100% <0%> (ø) ⬆️
mixer/adapter/memquota/dedup.go 100% <0%> (ø) ⬆️
mixer/adapter/kubernetesenv/cache.go 95% <0%> (+2%) ⬆️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 986ec0f...fc89f5c. Read the comment docs.

@vadimeisenbergibm
Copy link
Copy Markdown
Contributor Author

/retest

Protocol: string(model.ProtocolHTTPS),
Name: fmt.Sprintf("https-443-ingress-%s-%s", ingress.Name, ingress.Namespace),
Protocol: string(model.ProtocolTLSWithSNI),
Name: fmt.Sprintf("tls-with-sni-443-ingress-%s-%s", ingress.Name, ingress.Namespace),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

? why change this? gateway is tls terminating entity.

// This is the default protocol for a service port.
ProtocolTCP Protocol = "TCP"
// ProtocolTLSWithSNI declares that the port carries TLS traffic with SNI
ProtocolTLSWithSNI Protocol = "TLS_with_SNI"
Copy link
Copy Markdown
Member

@rshriram rshriram Jun 14, 2018

Choose a reason for hiding this comment

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

TCP_TLS

case "https":
return ProtocolHTTPS
case "tls_with_sni":
return ProtocolTLSWithSNI
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

tcp_tls.

if !listenerTypeMap[listenerMapKey].IsTCP() || servicePort.Protocol != model.ProtocolHTTPS || !service.MeshExternal {
if !listenerTypeMap[listenerMapKey].IsTCP() ||
(servicePort.Protocol != model.ProtocolHTTPS &&
servicePort.Protocol != model.ProtocolTLSWithSNI) ||
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

create a convenience function port.IsTLS() and this becoems shorter

Copy link
Copy Markdown
Member

@rshriram rshriram left a comment

Choose a reason for hiding this comment

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

This is nice. thanks for picking up on the TODO.
TLSWithSNI is a bit clunky. TCP_TLS i feel is short and sweet.

You need to add logic to service entry to add a new protocol TCP_TLS and update the service entry conversion code to reflect this protocol.

@rshriram
Copy link
Copy Markdown
Member

Btw, we already have TCP-TLS as a protocol in the service entry (https://github.com/istio/api/blob/master/networking/v1alpha3/gateway.proto#L301). this just needs to be parsed.

@vadimeisenbergibm
Copy link
Copy Markdown
Contributor Author

@rshriram TCP_TLS does not reflect the fact that the client must send SNI. Can we use TCP_TLS_SNI?

@vadimeisenbergibm
Copy link
Copy Markdown
Contributor Author

/retest

@istio-testing
Copy link
Copy Markdown
Collaborator

istio-testing commented Jun 15, 2018

@vadimeisenbergibm: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
prow/istio-pilot-e2e.sh fc89f5c link /test istio-pilot-e2e
prow/e2e-bookInfoTests.sh fc89f5c link /test e2e-bookInfo
Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@rshriram
Copy link
Copy Markdown
Member

Almost all clients use SNI. And TCP_TLS is no different from plain TCP. In other words, TLS implies SNI for us and nothing else. We are not terminating TLS connections inside the mesh, on behalf of the application. Its all Istio CA stuff.

@rshriram rshriram changed the title Add tls_with_sni protocol to Istio traffic management Add tcp_tls protocol to Istio traffic management Jun 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants