CentOS Firewall fix

This commit is contained in:
Dan Schaper 2016-10-10 11:30:15 -07:00
parent 94dd5b1ebe
commit 570611fc09

View file

@ -764,14 +764,8 @@ create_pihole_user(){
configureFirewall() {
# Allow HTTP and DNS traffic
if [ -x "$(command -v firewall-cmd)" ]; then
firewall-cmd --state > /dev/null
if [[ $? -eq 0 ]]; then
echo "::: Configuring firewalld for httpd and dnsmasq.."
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=53/tcp
firewall-cmd --permanent --add-port=53/udp
firewall-cmd --reload
fi
firewall-cmd --state &> /dev/null && ( echo "::: Configuring firewalld for httpd and dnsmasq.." && firewall-cmd --permanent --add-port=80/tcp && firewall-cmd --permanent --add-port=53/tcp \
&& firewall-cmd --permanent --add-port=53/udp && firewall-cmd --reload) || echo "::: FirewallD not enabled"
elif [ -x "$(command -v iptables)" ]; then
echo "::: Configuring iptables for httpd and dnsmasq.."
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT