File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 55
55
PORTS_TO_BLOCK="80,5555,2222"
56
56
EXTERNAL_INTERFACE=$1
57
57
58
+ # Flush an delete custom Chains
58
59
iptables -F DOCKER-USER
59
60
iptables -F EXTERNAL-ACCESS-DENY
60
61
iptables -X EXTERNAL-ACCESS-DENY
61
62
63
+ # Create a log-and-drop Chain
62
64
iptables -N EXTERNAL-ACCESS-DENY
63
65
iptables -A EXTERNAL-ACCESS-DENY -j LOG --log-prefix "DCKR-EXT-ACCESS-DENY:" --log-level 6
64
66
iptables -A EXTERNAL-ACCESS-DENY -j DROP
65
67
68
+ # Block all incomming traffic for docker
66
69
iptables -A DOCKER-USER -i $EXTERNAL_INTERFACE -p tcp --match multiport --dports $PORTS_TO_BLOCK -j EXTERNAL-ACCESS-DENY
70
+
71
+ # Restore default rule to return all the back to FORWARD-Chain
67
72
iptables -A DOCKER-USER -j RETURN
68
73
69
74
echo "Rules created "
You can’t perform that action at this time.
0 commit comments