From 4fc40d96d90ce2b96ecc36e5224b7277b13414ce Mon Sep 17 00:00:00 2001 From: bcambl Date: Sat, 14 May 2016 19:51:05 -0600 Subject: [PATCH] ensure firewalld is running before configuration --- automated install/basic-install.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 98668a3d..d47a5fe5 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -744,10 +744,13 @@ setUser(){ 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 + $SUDO firewall-cmd --state > /dev/null + if [[ $? -eq 0 ]]; 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 + fi 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