Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPv6 security should match IPv4 #2557

Closed
grigorig opened this issue May 29, 2020 · 5 comments
Closed

IPv6 security should match IPv4 #2557

grigorig opened this issue May 29, 2020 · 5 comments

Comments

@grigorig
Copy link

grigorig commented May 29, 2020

Docker abuses IPv4 NAT to create a private network for containers. Ports opened by containers are by default not available from the public internet and need to be mapped/forwarded explicitly.
When IPv6 is enabled for Docker, all of that goes out of the window and what's worse is that there is NO indication about this at all to the user.

Docker should use a stateful packet filter to mirror a similar setup with IPv6, i.e.:

  • Block access to Docker's IPv6 network from the outside world by default
  • Port numbers explicitly configured as exposed by a container can then be used to let through traffic to specific IP/port combinations to containers
  • There should probably be an option to fully expose a container if that is desired

Of course there are some limitations as well: as there is no NAT, there is no way to remap ports. But that should not a serious issue in practice because after all every container gets its own address.

@thaJeztah
Copy link
Member

I think this should be fixed by #2572 (not yet in a release, but will probably included as an experimental feature for docker 20.10)

@grigorig
Copy link
Author

As far as I can tell, that MR implements IPv6 NAT as an optional mode of operation for IPv6. This is a completely different matter. Please reopen.

@thaJeztah
Copy link
Member

Ah, right, so the intent here is to not use IPv6 NAT (the default, routable IPv6 addresses for containers), but still block access?

I can reopen, but I think generally firewall rules to block access are out of scope for the rules that the daemon sets up.

/cc @arkodg

@thaJeztah thaJeztah reopened this Nov 23, 2020
@grigorig
Copy link
Author

I don't really see how that is out of scope. NAT indirectly forces a default-block policy in a sense. The same can be achieved with regular routing and a stateful filter. And if Docker doesn't handle this, the whole "port publishing" functionality doesn't make much sense.

@akerouanton
Copy link
Member

Thanks for reporting!

As of v27.0, ip6tables has been put out of experimental mode and Docker networks support a new option named com.docker.network.bridge.gateway_mode_ipv4|6. This new option can currently take two values: routed and nat.

With routed, all ports but those published with -p are blocked, no NAT rules is created, and it's up to the end-user to properly set the routing table of adjacent / remote hosts to access those ports. This new mode is documented here: https://docs.docker.com/engine/network/packet-filtering-firewalls/#direct-routing.

With nat, ports are NATed like before.

Based on your original post @grigorig, I assume what you were asking for is that new routed mode.

Since this repo is now defunct, and not actively watched by maintainers, let me close this issue. If you think these new 'gateway modes' don't match what you need, please ping me and I'll reopen / move this issue to https://github.com/moby/moby.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants