[go: nahoru, domu]

Skip to content

Mitigate hosts on LAN from routing to Docker container via published port on 127.0.0.1? #1128

Answered by polarathene
polarathene asked this question in Q&A
Discussion options

You must be logged in to vote

Possible solution (not firewalld specific)

Is it this an issue due to the PREROUTING nat chain with DNAT? It seems to be possible to resolve by modifying that Docker created iptables rule:

# Avoid appling DNAT rules too early when destination is `127.0.0.1` (delay until OUTPUT chain):
# https://askubuntu.com/questions/579231/whats-the-difference-between-prerouting-and-forward-in-iptables/579242#579242
iptables -t nat -D PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
iptables -t nat -A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER ! -d 127.0.0.1

Now connections from a host on the LAN fail to route to 127.0.0.1, while the docker host can still connect successfully.

I assume 127.0.0.1

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@polarathene
Comment options

Answer selected by polarathene
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant