ensure firewalld is running before configuration

This commit is contained in:
bcambl 2016-05-14 19:51:05 -06:00
parent e6634531c7
commit 4fc40d96d9
1 changed files with 7 additions and 4 deletions

View File

@ -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