My use case is the following I want o intercept calls to the LDAP in 172.28.0.3:389 and forward to 172.28.0.3:636 with TLS.
I have followed the steps of egress tls originate and it works fine. Now I am trying to use the gateway, unfortunately I am having problems setting up the ports. I have basically copied and paste the setup of documentation and adapted the protocols from HTTP and HTTPS to TCP and the ports 80 and 443 to 389 and 636 respectively:
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
name: cnn
spec:
hosts:
- ldap.host
addresses:
- 172.28.0.3
ports:
- number: 389
name: tcp
protocol: TCP
- number: 636
name: tcp-secure
protocol: TCP
resolution: STATIC
endpoints:
- address: 172.28.0.3
------
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: istio-egressgateway
spec:
selector:
istio: egressgateway
servers:
- port:
number: 389 # I am not sure about this
name: tpc-port-for-tls-origination
protocol: tcp
hosts:
- ldap.host
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: egressgateway-for-cnn
spec:
host: istio-egressgateway.istio-system.svc.cluster.local
subsets:
- name: cnn
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: direct-cnn-through-egress-gateway
spec:
hosts:
- ldap.host
gateways:
- istio-egressgateway
- mesh
tcp: # I AM NOT SURE ABOUT THIS PART
- match:
- gateways:
- mesh
port: 389
route:
- destination:
host: istio-egressgateway.istio-system.svc.cluster.local
subset: cnn
port:
number: 389
weight: 100
- match:
- gateways:
- istio-egressgateway
port: 389
route:
- destination:
host: ldap.host
port:
number: 636
weight: 100
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: originate-tls-for-edition-cnn-com
spec:
host: ldap.host
trafficPolicy:
loadBalancer:
simple: ROUND_ROBIN
portLevelSettings:
- port:
number: 636
tls:
mode: SIMPLE # initiates HTTPS for connections to edition.cnn.com
I have the feeling that the problem is on the VirtualService
, however I have tried many things but without success, any hint what might be the issue would be highly appreciated.