Skip to content

Commit 4fea4c0

Browse files
committed
Finalize firewalld port forwarding support
There are two major changes here. Firstly, this adds proper support for port forwarding from localhost via a new policy accepting traffic from HOST. This is the last bit we were missing from the original port-forwarding implementation. This requires two new zones: one in which the actual port forward occurs, and one to allow traffic to 127.0.0.1 to be masqeuraded so we can talk to the container from localhost. Secondly, this fixes a bug where we generated incorrect rules when port-forwarding from a single IP. Instead of doing standard port-forwarding rules, those need rich rules. This was reported as #881. There are also some small code cleanups in how we handle setting up and tearing down port forwarding. It's still rather ugly, but at least a little better than it was before. Fixes #881 Signed-off-by: Matthew Heon <[email protected]>
1 parent 646bca2 commit 4fea4c0

File tree

5 files changed

+626
-238
lines changed

5 files changed

+626
-238
lines changed

docs/netavark-firewalld.7.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ When it is enabled (set to `yes`), port forwarding with root Podman will become
3131
Attempting to start a container or pod with the `-p` or `-P` options will return errors.
3232
When StrictForwardPorts is enabled, all port forwarding must be done through firewalld using the firewall-cmd tool.
3333
This ensures that containers cannot allow traffic through the firewall without administrator intervention.
34-
Please note that rootless Podman is unaffected by this setting, and will function as it always has.
34+
Please note that rootless Podman is unaffected by this setting and will function as it always has.
3535

36-
Instead, containers should be started without forwarded ports specified, and preferably with static IPs.
36+
Instead, containers should be started without forwarded ports specified and preferably with static IPs.
3737

3838
To forward a port externally, the following command should be run, substituting the desired host and container port numbers, protocol, and the container's IP.
3939
```

0 commit comments

Comments
 (0)