Skip to content
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

Automatically set outbound (envoy as client) SNI based on host/authority #27847

Closed
nickperry opened this issue Oct 9, 2020 · 12 comments
Closed
Labels
area/networking kind/enhancement lifecycle/automatically-closed Indicates a PR or issue that has been closed automatically. lifecycle/stale Indicates a PR or issue hasn't been manipulated by an Istio team member for a while

Comments

@nickperry
Copy link

nickperry commented Oct 9, 2020

Describe the feature request

I would like Istio to be able to automatically set the outbound (envoy as client) SNI based on host/authority.

Currently, for all egress cases where I am doing TLS origination AND the destination host expects SNI to be set, I need to use a DestinationRule with a subset like

  subsets:
  - name: foo.bar
    trafficPolicy:
      loadBalancer:
        simple: ROUND_ROBIN
      portLevelSettings:
      - port:
          number: 443
        tls:
          mode: ISTIO_MUTUAL
          sni: foo.bar

to manually set the SNI value.

Having to do this for every egress destination is painful.

Describe alternatives you've considered

Lua Envoy filter.
or
CRD for egress destinations, and a controller which would manage the underlying VirtualService, DestinationRule, ServiceEntry and Gateway resources.

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

Additional context

https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-upstreamhttpprotocoloptions-auto-sni

envoyproxy/envoy#2690

@howardjohn
Copy link
Member

I think this would need Envoy support if we want to get it from the Host header - despite the linked issue I don't think this is present.

However, we could do it based on the host of the configured cluster, which could work in cases like k8s services, or non-wildcard ServiceEntries potentionally.

@vikaschoudhary16
Copy link
Contributor

vikaschoudhary16 commented Oct 13, 2020

However, we could do it based on the host of the configured cluster, which could work in cases like k8s services, or non-wildcard ServiceEntries potentionally.

I guess thats what CRD for egress destination and a controller would be doing

@ramaraochavali
Copy link
Contributor

Envoy already supports this for upstream clusters https://www.envoyproxy.io/docs/envoy/latest/faq/configuration/sni#how-do-i-configure-sni-for-clusters - Does it solve this usecase?

@howardjohn
Copy link
Member

howardjohn commented Oct 13, 2020 via email

@hzxuzhonghu
Copy link
Member

If both set, which one takes effect?

@nickperry
Copy link
Author

nickperry commented Oct 15, 2020

So is this as simple as exposing the underlying Envoy auto_sni and auto_san_validation protocol options (https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-upstreamhttpprotocoloptions-auto-sni)? And as @hzxuzhonghu menitoned, determining how those settings interact with a manually set SNI field?

@howardjohn
Copy link
Member

So is this as simple as exposing the underlying Envoy auto_sni and auto_san_validation protocol options

We also need to make sure its only set for non-mtls destinations

@lizan
Copy link
Contributor

lizan commented Nov 11, 2020

So is this as simple as exposing the underlying Envoy auto_sni and auto_san_validation protocol options (https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-upstreamhttpprotocoloptions-auto-sni)? And as @hzxuzhonghu menitoned, determining how those settings interact with a manually set SNI field?

If both are set, the auto_sni and auto_san_validation takes effect.

@hzxuzhonghu
Copy link
Member

So i suggest setting auto_sni and auto_san_validation only when it is not explicitly set

@istio-policy-bot
Copy link

🚧 This issue or pull request has been closed due to not having had activity from an Istio team member since 2020-11-11. If you feel this issue or pull request deserves attention, please reopen the issue. Please see this wiki page for more information. Thank you for your contributions.

Created by the issue and PR lifecycle manager.

@istio-policy-bot istio-policy-bot added the lifecycle/automatically-closed Indicates a PR or issue that has been closed automatically. label May 25, 2021
@breuerjo
Copy link

Is there already an implementation of the auto_san and auto_sni property in the ClientTLSSetting or someone working on one? Did someone find the possibility to configure them via a custom EnvoyFilter?

@breuerjo
Copy link

breuerjo commented Jun 28, 2021

While Istio isn't directly supporting the auto_sni and auto_san_validation envoy configuration properties, they can also be set via a custom EnvoyFilter:

apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
  name: enable-auto-sni-san-validation
  namespace: istio-system
spec:
  configPatches:
  - applyTo: CLUSTER
    match:
      cluster:
        name: "*.google.com"
    patch:
      operation: MERGE
      value:
        upstream_http_protocol_options:
          auto_sni: true
          auto_san_validation: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/networking kind/enhancement lifecycle/automatically-closed Indicates a PR or issue that has been closed automatically. lifecycle/stale Indicates a PR or issue hasn't been manipulated by an Istio team member for a while
Projects
None yet
Development

No branches or pull requests

8 participants