istio: AUTO_SNI does not respect Authority rewrite
Is this the right place to submit this?
- This is not a security vulnerability or a crashing bug
- This is not a question about how to use Istio
Bug Description
I installed istio version 1.21.0 via Helm into a cluster. After that I made a deploy of my application. I need DR because on the application side, HTTPS works, not HTTP. The settings concerning Istio are:
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: preapproved-service
namespace: cnv-preprod
spec:
host: preapproved-service
trafficPolicy:
tls:
mode: SIMPLE
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: preapproved-service
namespace: cnv-preprod
spec:
gateways:
- istio-ingress/cnv-ingress-gateway-https
hosts:
- preprod-cnv-srv.example.com
http:
- match:
- uri:
prefix: /preapproved-service
name: preapproved-service
rewrite:
uri: /
route:
- destination:
host: preapproved-service
port:
number: 8080
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: cnv-ingress-gateway-https
namespace: istio-ingress
spec:
selector:
istio: ingressgateway
servers:
- hosts:
- preprod-cnv-srv.example.com
port:
name: https
number: 443
protocol: HTTPS
tls:
credentialName: tls-certs-opaque-preprod-cnv-srv
mode: SIMPLE
After I try to connect my application: https://preprod-cnv-srv.example.com/preapproved-service/healthCheck and see the error:
upstream connect error or disconnect/reset before headers. retried and the latest reset reason: remote connection failure, transport failure reason: TLS_error:|268435581:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED:TLS_error_end:TLS_error_end
When I downgrade istiod from 1.21.0 to 1.20.1 (my dev and test clusters using this version of istio) the error disappears. The configuration does not change in any way. Probably it’s not a bug and something wrong in my configuration, I don’t know for sure
Version
PS .\istioctl.exe version --kubeconfig C:\Users\Vladimir.Fomin\.kube\preprod-cnv-kubeconfig.yaml
client version: 1.20.1
control plane version: 1.21.0
data plane version: 1.20.1 (2 proxies)
helm version --short
v3.14.0+g3fc9f4b
Additional Information
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 26 (19 by maintainers)
My PR (https://github.com/envoyproxy/envoy/issues/35330) in envoy got merged. It improves both Auto-SNI and Auto-SAN behavior such that host manipulation happening at route level will be taken into account when computing SNI/SAN. No adjustments from Istio-side are needed as the new behavior is also the new default for envoy. You should see the new behavior in Istio 1.24 once we update to the latest envoy release. For the time being, we will retain the AUTO_SNI env flag for users affected by this issue, it will be removed in Istio 1.25
I will close this issue, please let me know if you still encounter auto-sni issues in 1.24
I remember checking some weeks ago why envoy ignores the rewrite if auto sni is enabled. I will need to check again but I recall it being intended, I feel that we will have to disable auto sni if we have a rewrite in a VS. This week I have limited availability but perhaps I can manage to take a look.
Hi,
I’m not 100% sure if this is related, but we face the same issue when using an
VirtualServiceto expose an external Service (ServiceEntry) via Istio IngressGateway.We can fix the problem, if we define the SNI explicitly within the
DestinationRulefor ourServiceEntry(see examples below).But IMHO this was kind of breaking change for us (worked without the SNI override within 1.20.x, but was broken in 1.21.3) @howardjohn. Actually, I would have thought, that the
AUTO_SNIsetting would not influence the SNI header if theAuthorityhas been overriden using the Rewrite functionality of the VirtualService.Our setup basically looks like this and worked with Istio 1.20.x: Internal URL -> Istio IngressGateway -> VirtualService -> ServiceEntry (external URL) + DestinationRule (HTTPS mode, Simple TLS)
Code-wise the AUTO_SNI flag handling looks correct. @DMSwimTech could you raise a separate issue with a small POC to reproduce it so that we can take a deeper look?
I will open an issue in envoy. If the Envoy community agrees on the approach I can take care of performing the changes there (and any adaptation that may be require from Istio side)
@vsfomin we also experienced this when upgrading from 1.20 to 1.22 but solved it with the SNI option like this:
https://istio.io/latest/docs/reference/config/networking/destination-rule/#ClientTLSSettings:
Maybe try to add InsecureSkipVerify in DR