-
-
Notifications
You must be signed in to change notification settings - Fork 473
Description
Description
(bouncd back from lima-vm/lima#655)
macOS 12.2 arm64, colima 0.3.2, limactl version 0.8.2, docker back-end
docker/docker-compose support a 3-part port-binding technique where the interface to bind to can be chosen explicitly. For example:
docker run -p 127.0.0.1:8080:80 --name nginx -d nginx
Given that example, you should be able to curl localhost:8080
on the system where you ran it, but you should not be able to connect from another interface. For example, if 10.211.55.2
is another interface, curl 10.211.55.2:8080
should fail.
This has very serious security implications for applications that are not supposed to bind to all interfaces, see
When you bind to all interfaces (the default, 0.0.0.0) it typically means that any user on the local network can access any service running under lima.
To demonstrate this,
- run the example nginx container:
docker run -p 127.0.0.1:8080:80 --name nginx -d nginx
- Connect from localhost,
curl localhost:8080
- you'll see the default nginx output - Connect to another interface on your machine,
curl 10.211.55.2:8080
for example, and it will also show the default nginx output. It should not.
You can repeat the same with any version of docker and you won't see this exposed behavior.