Remove dependency on the filter-FORWARD policy #48724
Merged
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.
- What I did
There are rules in the iptables
DOCKERchain accept packets routed to published container ports/protocols.Until now, there has not been any
DROPrule for un-published ports/protocols. So, if the filter-FORWARD chain's default policy wasACCEPT, there was no per-port/proctocol filtering for packets routed directly to the container's address. (A remote host with a route to the container's network, via the docker host, could access any port. And, for IPv4, docker only sets the filter-FORWARD policy to DROP if it enables IP forwarding itself.)This PR removes the dependency on the filter-FORWARD policy.
(Docs impact - need to improve description of gateway modes, as per changelog comment, various other PRs will also feed in to this.)
- How I did it
Add rules to the
DOCKERchain to explicitly drop packets routed to docker bridge networks, when the packet hasn't beenACCEPTed by a rule for an open port/protocol.Allow ICMP in gateway-mode
routed, because it would previously have been allowed in nat mode with a default policy ofACCEPT(for IPv4), and it may be needed for IPv6 connectivity.- How to verify it
New integration test.
- Description for the changelog