3 ms·
Maybe inform yourself of the situation and consider again carefully. Should all programs running as root bypass a firewall explicitly configured by the user?
by ysleepy 4y ago
Maybe inform yourself of the situation and consider again carefully.
Should all programs running as root bypass a firewall explicitly configured by the user?
- josephcsible 4y agoNot by default, but if you explicitly pass them a command-line flag that means "open this port to the network" then they should.
- izacus 4y agoNo they shouldn't, just how nginx shouldn't manipulate iptables just because you've said it should listen to 443 on "the network". Many times you don't even want docker containers to go "to the network" directly and it shouldn't assume unsecure behaviour by default. Moreover, CRITICALLY, you can't prevent Docker from doing that and you can ONLY secure the machine by adding another rule on top that supresses Dockers rule... and those dockers rule change over time making it easy for the blocking hack to stop working after an update and again make the machine unsecure.
- selfmodruntime 4y agoYou‘re wrong. If you use a command line argument that explicitely states „this will publish this port in your firewall for convenience“, a command line argument which you shouldn‘t use anyway, then you‘re on your own. You choose to do this. Docker assumes that you know what you‘re doing. You‘re also wrong in your last paragraph. There is the - easy - option to expose the port on your loopback, and re route to the docker bridge network by using a reverse proxy.
- nickstinemates 4y agoThis is exactly right. The alternative is ridiculous. Also, comparing expectations of Docker vs. something like nginx is crazy.
- allarm 4y ago> the alternative is ridiculous. Like what is, having full control over your own system? I don’t think there’s anything wrong with not messing with my firewall and leaving this part to me. > is crazy And this is why, exactly?
- Gordonjcp 4y agoHow exactly do you *not* have full control of your system? Because typing in a command expressly designed to modify firewall rules... actually modifies firewall rules?
- allarm 4y agoIt’s not clearly stated in the docs, this is exactly how and why that happens.
- Gordonjcp 4y agoIt actually is, though, you just need to read them.
- apple4ever 4y agoI read them. It's doesn't say that.
- selfmodruntime 4y agoYou do have full control over your system. You could choose not to install docker, for once.
- bionade24 4y agoYou can prevent docker from doing that by editing its config, but you have to read the documentation to know that. As you have to, to actually know what a certain command does, too.
- selfmodruntime 4y agoWhat horror. Now we actually have to read the documentation of potentially dangerous tools instead of guessing or following twitter tutorials.
- Gordonjcp 4y ago> No they shouldn't, just how nginx shouldn't manipulate iptables just because you've said it should listen to 443 on "the network". But you've typed in a command that explicitly will alter the iptables rules, as documented, and as you have requested > Many times you don't even want docker containers to go "to the network" directly and it shouldn't assume unsecure behaviour by default. Docker containers do not have a network connection outside their own subnet by default, and only expose the ports that they have explicitly been configured in the Dockerfile to expose. By determining the container's IP address you can talk to it directly but this is not really recommended, because it can and will change. This internal IP address is by default in an RFC1918 range, and will not be in any way accessible from the outside world. > Moreover, CRITICALLY, you can't prevent Docker from doing that and you can ONLY secure the machine by adding another rule on top that supresses Dockers rule... and those dockers rule change over time making it easy for the blocking hack to stop working after an update and again make the machine unsecure. You can prevent Docker from doing that, by not adding into the command line the additional option that tells it to hook containers up directly to the "outside world" interface bypassing any firewall you might set.
- selfmodruntime 4y agoThe real answer is that OP is using docker wrong. If you „publish“ a port, your firewall gets amended. This is clearly stated in the documentation. If you do not wish for that to happen, and instead want to use a reverse proxy, you „expose“ a port instead and reroute the requests into the docker bridge network.
- LinAGKar 4y agoNo, it isn't. Looking at the documentation (https://docs.docker.com/compose/compose-file/compose-file-v3/#ports https://docs.docker.com/compose/compose-file/compose-file-v3...), it doesn't mention the firewall anywhere.
- selfmodruntime 4y agoIt clearly states “this will publish the mentioned port to the outside world”. How do you expect this to work? Magic?
- allarm 4y agoExcept it is not clear at all and should mention the firewall changes. I expect that publishing means listening on 0.0.0.0, not messing with the firewall.
- selfmodruntime 4y agoSee my comment above. Firewall changes are clearly mentioned under the section "published ports". What you expect does not matter. What you're thinking of is exposing. It's even in the word "publish". The documentation has two sections entirely devoted to the terms. It's in the section "container networking", which is marked as required reading by the docs. It's not dockers fault that you're copy pasting configuration examples from medium blogs. [0]: https://docs.docker.com/config/containers/container-networking/#published-ports https://docs.docker.com/config/containers/container-networki...
- Gordonjcp 4y agoYes, if the command you ask them to perform connects to the public interface.