-
Notifications
You must be signed in to change notification settings - Fork 147
Add transparent network policy support for HBONE connections #1665
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
base: master
Are you sure you want to change the base?
Add transparent network policy support for HBONE connections #1665
Conversation
Introduces TRANSPARENT_NETWORK_POLICIES config flag to preserve original destination ports for HBONE protocol connections. When enabled, outbound HBONE traffic uses the original destination port instead of routing all traffic through the standard HBONE port. This allows network policies to operate transparently based on the actual service port, enabling port-level policy enforcement without application awareness. Defaults to false to maintain backward compatibility.
|
😊 Welcome @electricjesus! This is either your first contribution to the Istio ztunnel repo, or it's been You can learn more about the Istio working groups, Code of Conduct, and contribution guidelines Thanks for contributing! Courtesy of your friendly welcome wagon. |
|
|
Hi @electricjesus. Thanks for your PR. I'm waiting for a istio member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
|
Hi all! this is still a draft. We're still working on a few things related to this here over at ProjectCalico. |
We had started a conversation with some of the istio maintainers a couple weeks ago regarding the desire to make the dst port rewrite optional as it conflicted with L4 Network Policy enforcement. If I remember correctly they were ok with this as long as its disabled by default which you have satisfied the requirement here. How do you envision to handle the destination proxy behavior? Since the listening socket is on 0.0.0.0:15008 in the pod network namespace and you no longer have the dstport:15008 and maintaining the original dst port? Are you using bpf, netfilter to redirect to the correct socket? It probably makes sense to get this ironed out? Unless I am completely missunderstanding the code :-) |
|
hi @MikeZappa87, thanks for your comment here! My mistake, I completely forgot to reference the companion change to Istio CNI. However, all of these are pretty much prototyping code. These two are all still missing some further enhancement details like the same behaviour when it comes to waypoint proxy.
Will you point me to where this discussion is happening, we're hoping to participate |
|
Looking at the CNI change, it looks like you're using dscp marking in the IP header to match inbound traffic and send it to ztunnel port 15008. I assume something in ztunnel would need to set that mark? |
I was curious of what was setting the mark here. Is Calico providing this with ebpf? I am assuming if it is ebpf you are checking if a pkt matches a netpol you apply this mark? |
Want to message me on the K8s slack? We probably all can think about this. |
Description
Introduces TRANSPARENT_NETWORK_POLICIES config flag to preserve original destination ports for HBONE protocol connections. When enabled, outbound HBONE traffic uses the original destination port instead of routing all traffic through the standard HBONE port. This allows network policies to operate transparently based on the actual service port, enabling port-level policy enforcement without application awareness.
Defaults to false to maintain backward compatibility.
Requires this change also for the rest of the traffic control
How does it work?
With our modifications:
sequenceDiagram participant PodA as Pod A<br/>(Client) participant ZTA as ZTunnel<br>(listening socket in Pod A netns) participant IFPodA as Iface Pod A participant Plc as Network Policies<br>(Allow port 8080 for Pod A) participant IFPodB as Iface Pod B participant ZTB as ZTunnel<br>(listening socket in Pod B netns) participant PodB as Pod B<br/>(Server:8080) Note over PodA,PodB: Mesh Communication - with microsegmentation PodA->>ZTA: Istio redirects all TCP traffic,<br>leaving the pod, to ZTunnel ZTA->>IFPodA: Proxing over<br>HBONE protocol<br>(original dst port) Note over ZTA,IFPodA: Modified ZTunnel<br>that proxies with<br>original dst port IFPodA->>Plc: Flow to Pod B (port 8080) Plc->>IFPodB: Traffic Allowed Note over IFPodB: Felix makes magic<br>DSCP mark (0x17)<br>(host netns) Note over IFPodB: Modified Istio CNI<br>iptables rules<br>redirects to ZTunnel<br>(pod netns) IFPodB->>ZTB: ZTunnel receives<br>the connection :15008 ZTB->>PodB: Ztunnel proxying<br>finishesThe key concept is that Felix (part of calico-node) maintains an ipset of pods that have the istio ambient mode label. For traffic that matches tha ipset it's marked with a DSCP rule that drives traffic back to ztunnel inbound