Plain grep, escape the special characters.

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
pull/1067/head
Dan Schaper 8 years ago
parent de6ce276d0
commit 8ee2bdec4d
No known key found for this signature in database
GPG Key ID: 572E999E385B7BFC

@ -891,7 +891,7 @@ configureFirewall() {
elif modinfo ip_tables &> /dev/null; then
# If chain Policy is not ACCEPT or last Rule is not ACCEPT
# then check and insert our Rules above the DROP/REJECT Rule.
if iptables -S INPUT | head -n1 | grep -qv 'ACCEPT$' || iptables -S INPUT | tail -n1 | grep -qv '(^-A\|^-P).*ACCEPT$'; then
if iptables -S INPUT | head -n1 | grep -qv '^-P.*ACCEPT$' || iptables -S INPUT | tail -n1 | grep -qv '^-\(A\|P\).*ACCEPT$'; then
# Check chain first, otherwise a new rule will duplicate old ones
echo "::: Configuring iptables for httpd and dnsmasq.."
iptables -C INPUT -p tcp -m tcp --dport 80 -j ACCEPT &> /dev/null || iptables -I INPUT 1 -p tcp -m tcp --dport 80 -j ACCEPT

Loading…
Cancel
Save