linkerd / linkerd/linkerd2

Use tproxy to allow preservation of IP addresses

Open
#4,713 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/iptables area/proxy help wanted
Dominant language
Go
Stars
11.5k
Forks
1.4k
Avg merge
3d 22h
Merged PRs (30d)
53

Description

## 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: https://github.com/istio/istio/pull/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 https://github.com/istio/istio/issues/22500

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing Linkerd's iptables rules and proxy-container configuration, then read the linked Istio discussion and kernel-module issue for TPROXY constraints. Define the required option scope, CAP_NET_ADMIN implications, and source-address preservation behavior before implementation; done means the feature works without breaking environments where TPROXY is unavailable.

Written by the indexing model from the issue text.

Assessment

Tech stack
kubernetes, linux
Domain
infrastructure, networking, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.