[WIP] Rootless bridge: preserve source IPs via pesto/pasta#28478
Draft
Honny1 wants to merge 3 commits intocontainers:mainfrom
Draft
[WIP] Rootless bridge: preserve source IPs via pesto/pasta#28478Honny1 wants to merge 3 commits intocontainers:mainfrom
Honny1 wants to merge 3 commits intocontainers:mainfrom
Conversation
TODO: vendor container-libs Signed-off-by: Jan Rodák <hony.com@seznam.cz>
Pesto dynamically updates pasta's forwarding table via UNIX socket, preserving source IPs that rootlessport's userspace proxy destroyed. Strip HostIP from port mappings passed to netavark in rootless mode (portMappingsForNetavark) because pesto handles host-side address binding via pasta. Netavark's DNAT rules inside the rootless netns must not restrict on destination address since pasta's splice delivers traffic with a different address than the user-specified HostIP. Pesto receives the original HostIP so pasta binds correctly on the host. Fixes: https://redhat.atlassian.net/browse/RUN-2214 Fixes: containers#8193 Fixes: https://redhat.atlassian.net/browse/RUN-3587 Signed-off-by: Jan Rodák <hony.com@seznam.cz>
Delete networking_rootlessport.go, rootlessPortSync pipes, and the reloadRootlessRLKPortMapping stub. Signed-off-by: Jan Rodák <hony.com@seznam.cz>
|
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
1 similar comment
|
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
Member
Author
|
Question for reviewers: Should the option for rootlessport exist, or can it be dropped fully? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Require passta version: tbd
Local Passt Setup
TODO:
cmd/rootlessport/binary andpkg/rootlessport/package (now dead code for bridge networking)Replace
rootlessportwithpestofor rootless bridge network port forwarding, preserving source IPs.Problem
When running rootless containers on a bridge network (
podman run -p 8080:80 --network mynet), the oldrootlessportuserspace TCP/UDP proxy destroyed source IP information. Every connection appeared to come from127.0.0.1inside the container, regardless of the actual client IP.Solution
Pesto is a client tool for
passtathat dynamically updates port forwarding rules via a UNIX domain socket. Instead of proxying traffic in userspace (which loses source IPs), pesto configurespastato forward at the kernel level using splice (localhost) or TAP (external traffic), preserving the original source IP.How it works
pastainstance runs in the rootless network namespace with a control socket (-c pasta.sock)pestoreplaces pasta's entire forwarding table with the aggregate ports of all running bridge containerspestoupdates the table without the stopped container's ports, then netavark tears down bridge/DNATpestoreplaces the table to reflect the new stateKey implementation details:
portMappingsForNetavark()stripsHostIPfrom port mappings before passing them to netavark in rootless mode. Pesto handles host-side address binding via pasta; netavark's DNAT rules inside the rootless netns must not restrict on destination address since pasta's splice delivers traffic with a different address than the user-specified HostIPensureLoopbackSetmark()inserts an nftables rule so localhost-originated traffic (src127.0.0.0/8) is properly masqueraded through the bridge, required because pasta's splice path delivers packets with loopback source addressesroute_localnet=1sysctl is set once per rootless netns lifetime so the kernel allows routing of127.x.x.x-sourced packets to non-loopback interfacesCurrent limitations
0.0.0.0by default)gatherAllRootlessBridgePortsreads all containers from DB without locksFixes: https://redhat.atlassian.net/browse/RUN-2214
Fixes: #8193
Fixes: https://redhat.atlassian.net/browse/RUN-3587
Depends on: passta version tbd
Depends on: containers/container-libs#755
Depends on: #27828
Depends on: #28451
Checklist
Ensure you have completed the following checklist for your pull request to be reviewed:
commits. (
git commit -s). (If needed, usegit commit -s --amend). The author email must matchthe sign-off email address. See CONTRIBUTING.md
for more information.
Fixes: #00000in commit message (if applicable)make validatepr(format/lint checks)Noneif no user-facing changes)Does this PR introduce a user-facing change?