Task: to close access from outside all ports except 22, 80 and 443. The server in the same local network must have access to all the ports listening on the server.
Created iptables rules:
-P INPUT DROP
-A INPUT-p tcp -m tcp -m multiport --dports 22,80,443 -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT-p icmp -m icmp --icmp-type 0 -j ACCEPT
-A INPUT-p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT-p icmp -m icmp --icmp-type 3/1-j ACCEPT
-A INPUT -s 127.0.0.1/32 -j ACCEPT
-A INPUT -s 192.168.1.100/32 -j ACCEPT
-A INPUT -s 192.168.1.101/32 -j ACCEPT
-A INPUT -s 192.168.1.102/32 -j ACCEPT
-A INPUT-i docker0 -j ACCEPT
Everything works, but after running docker containers, docker adds rules in its chain, which give access to the listening ports to the outside:
How to solve this problem, what would the open ports of the containers have been closed out and was only available for certain servers specified in the INPUT chain?
I think if you disable some options, such as --ip forward and iptables--, you can use your own chain of rules.
Tried. But then all the rules that Docker creates by yourself, you need to register yourself. Without them, the containers do not work.
And it is very uncomfortable.
We have to somehow solve the problem without these options. - octavia.Bernhard60 commented on July 9th 19 at 13:06
And it is very uncomfortable.
We have to somehow solve the problem without these options. - octavia.Bernhard60 commented on July 9th 19 at 13:06