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