Traefik Mesh ACL mode transition for internal service isolation
0 reputation · 27 Apr 2023, 22:43 UTC
0 reputation · 27 Apr 2023, 22:43 UTC
Traefik Mesh implements a permissive default posture where services are reachable by any other meshed workload upon joining the mesh. To prevent accidental internal exposure, the mesh provides an ACL mode based on the Service Mesh Interface (SMI) TrafficTarget specification.
When transitioning from a permissive setup to a restrictive one, the primary goal is to ensure a deny-by-default state where only explicitly defined source-to-destination paths are permitted. However, there is uncertainty regarding how these ACLs are enforced when workloads utilize headless services or attempt direct pod-to-pod communication that may bypass the node-level proxy.
Given the current architecture of Traefik Mesh's transparent proxying, what is the expected behavior for traffic targeting headless services when ACL mode is enabled? Does the mesh maintain enforcement for direct pod IP communication, or does this create a security gap in the deny-by-default assumption?
31775 reputation · 28 Apr 2023, 10:02 UTC
When ACL mode is enabled ( mesh.acl.enabled: true ), Traefik Mesh enforces a deny‑by‑default policy on **all** traffic that passes through the Envoy sidecar. This includes traffic that resolves to a headless service DNS name and traffic that targets a pod’s IP directly. The sidecar intercepts every packet destined for the pod’s IP address (the pod’s network namespace) via iptables rules, so the ACL engine evaluates the request before it reaches the application container.
Therefore, as long as the pod is part of the mesh and the sidecar is running, there is no security gap: even direct pod‑to‑pod communication is subject to the ACL rules. The only way to bypass ACL enforcement is to send traffic that never enters the sidecar—e.g., using host‑networking or bypassing the pod’s IP entirely.
traefik-mesh.yaml:
mesh:
acl:
enabled: true
apiVersion: traefik.io/v1alpha1
kind: TrafficTarget
metadata:
name: allow-a-to-b
spec:
source:
kind: Service
name: service-a
destination:
kind: Service
name: service-b
rules:
- action: allow
meshctl apply -f traffic-target.yaml
meshctl get acl
service-b.default.svc.cluster.local (headless DNS).10.244.1.23:8080).200 OK indicates the ACL allowed the request, while a 403 Forbidden or connection reset indicates denial.hostNetwork: true, the sidecar does not intercept traffic, and ACLs will not apply.To ensure the recommendation applies, could you confirm that the pods you are testing are running the Traefik Mesh sidecar and are not using hostNetwork?
Use comments to ask for clarification. Post a solution as an answer.
31,775 reputation · 28 Apr 2023, 09:45 UTC
While the Envoy sidecar effectively intercepts traffic for headless services and direct pod IPs via iptables, it is important to clarify the boundaries of this "deny-by-default" posture. The security guarantee relies entirely on the transparent proxying mechanism.
To ensure a robust transition to restrictive mode, verify that the following bypass vectors are addressed in your cluster configuration:
hostNetwork: true bypass the pod network namespace and the associated iptables rules, meaning their traffic will not be intercepted by the Envoy proxy.For production environments, combining Traefik Mesh ACLs with Kubernetes NetworkPolicies is recommended to provide a secondary layer of defense for non-meshed traffic.