From e6634531c743f8698604f96f7eff6682b609523b Mon Sep 17 00:00:00 2001 From: bcambl Date: Sat, 14 May 2016 17:05:40 -0600 Subject: [PATCH] basic firewalld/iptables configuration --- automated install/basic-install.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 347b29f0..98668a3d 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -741,6 +741,22 @@ setUser(){ fi } +configureFirewall() { + # Allow HTTP and DNS traffic + if [ -x "$(command -v firewall-cmd)" ]; then + $SUDO echo "::: Configuring firewalld for httpd and dnsmasq.." + $SUDO firewall-cmd --zone=public --permanent --add-service=http + $SUDO firewall-cmd --zone=public --permanent --add-service=dns + $SUDO firewall-cmd --reload + elif [ -x "$(command -v iptables)" ]; then + $SUDO echo "::: Configuring iptables for httpd and dnsmasq.." + $SUDO iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT + $SUDO iptables -A INPUT -p tcp -m tcp --dport 53 -j ACCEPT + else + $SUDO echo "::: No firewall detected.. skipping firewall configuration." + fi +} + installPihole() { # Install base files and web interface checkForDependencies # done @@ -766,6 +782,7 @@ installPihole() { installPiholeWeb installCron runGravity + configureFirewall } displayFinalMessage() {