File tree Expand file tree Collapse file tree 1 file changed +1
-16
lines changed
Expand file tree Collapse file tree 1 file changed +1
-16
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ echo "$iptables -P INPUT ACCEPT" >> $tmp
6464echo " $iptables -F INPUT" >> $tmp
6565
6666# Enabling stateful support
67- if [ " $conntrack " != ' no' ]; then
67+ if [ " $conntrack " != ' no' ] || grep --quiet container=lxc /proc/1/environ ; then
6868 str=" $iptables -A INPUT -m state"
6969 str=" $str --state ESTABLISHED,RELATED -j ACCEPT"
7070 echo " $str " >> $tmp
@@ -112,21 +112,6 @@ for line in $(sort -r -n -k 2 -t \' $rules); do
112112 fi
113113done
114114
115- # Check if is LXC
116- if grep --quiet container=lxc /proc/1/environ; then
117- # Get active dns servers /etc/resolv.conf
118- DNS_SERVER=$( cat /etc/resolv.conf | grep -v ' ^#' | grep nameserver | awk ' {print $2}' )
119-
120- # Add iptable rules for dns server
121- for ip in $DNS_SERVER
122- do
123- echo " $iptables -A OUTPUT -p udp -d $ip --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT" >> $tmp
124- echo " $iptables -A INPUT -p udp -s $ip --sport 53 -m state --state ESTABLISHED -j ACCEPT" >> $tmp
125- echo " $iptables -A OUTPUT -p tcp -d $ip --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT" >> $tmp
126- echo " $iptables -A INPUT -p tcp -s $ip --sport 53 -m state --state ESTABLISHED -j ACCEPT" >> $tmp
127- done
128- fi
129-
130115# Switching chain policy to DROP
131116echo " $iptables -P INPUT DROP" >> $tmp
132117
You can’t perform that action at this time.
0 commit comments