-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Use tproxy to allow preservation of IP addresses #4713
Comments
@plwhite This is definitely a reasonable request; but it has some big implications, so I think we'd want someone to put together an RFC that outlines a plan of attack. Such an RFC will need, at least, some attention to the following:
If I were going about implementing this, I'd probably hack the proxy-init and proxy to prove the core functionality quickly before getting too deep on the plan. And then we'll probably want to take care to ensure that this lands with lands as an experimental feature that doesn't put any burden on users who have not enabled it. |
Hi @plwhite @olix0r ,
Is this from the view of the application or linkerd proxy? My understanding is that linkerd proxy can see the real source ip, but maybe not the application. If this is correct, why would introducing tproxy help the main container see the source ip? Thanks |
It's true that the traffic arrives at the proxy with the right source IP, but the workload container sees localhost. Think about incoming traffic to the pod, say from 1.2.3.4 to 4.3.2.1.
If you use TPROXY, then the proxy (which has all the information to hand) can create a proxy connection with the correct source IP. This requires not just changes to iptables config, but to the proxy code itself and permissions so is rather pervasive. The positives are keeping the original source IP and not having to change the workload container to account for the presence of the service mesh. |
@plwhite thank you for the reply! this really makes sense to me now. |
Feature Request
What problem are you trying to solve?
When traffic arrives at a container in a pod via Linked in, the IP addresses are mangled.
The pod has to listen on localhost instead of the pod IP (which is a minor issue, but does mean that behaviour may need to differ based on whether a service mesh is present).
All incoming traffic appears to come from localhost. This impacts logging; can break certain protocols which mandate behaviour based on IP address in use (SIP); and stops blacklisting of IPs for security.
I'd like to address the second of these.
How should the problem be solved?
The most likely way to fix this is to use TPROXY in iptables rules. Roughly this involves:
changes to iptables rules;
giving the proxy container
CAP_NET_ADMIN
privileges;changing the proxy container to maintain the source address.
This is an option for istio, with some interesting discussion here: istio/istio#4654.
Any alternatives you've considered?
I haven't been able to think of any, though open to suggestions.
How would users interact with this feature?
The use of TPROXY would have to be a Linkerd option, enabled probably globally, both for security reasons (
CAP_NET_ADMIN
) and because of environment specific issues with kernel modules such as istio/istio#22500The text was updated successfully, but these errors were encountered: