Skip to content

Commit

Permalink
Moved firewall commands from CentOS 7 to a routine and called form bo…
Browse files Browse the repository at this point in the history
…th CentOS 7 and Fedora. (#4366)
  • Loading branch information
sorvani authored and snipe committed Nov 8, 2017
1 parent 70efac8 commit dd7db0d
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions snipeit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ isdnfinstalled () {
fi
}

openfirewalld () {
if [ "$(firewall-cmd --state)" == "running" ]; then
echo "* Configuring firewall to allow HTTP traffic only."
log "firewall-cmd --zone=public --add-port=http/tcp --permanent"
log "firewall-cmd --reload"
fi
}

if [[ -f /etc/lsb-release || -f /etc/debian_version ]]; then
distro="$(lsb_release -s -i)"
version="$(lsb_release -s -r)"
Expand Down Expand Up @@ -539,11 +547,8 @@ case $distro in

installsnipeit

if [ "$(firewall-cmd --state)" == "running" ]; then
echo "* Configuring firewall."
log "firewall-cmd --zone=public --add-port=http/tcp --permanent"
log "firewall-cmd --reload"
fi
#open the firewall for HTTP traffic only
openfirewalld

#Check if SELinux is enforcing
if [ "$(getenforce)" == "Enforcing" ]; then
Expand Down Expand Up @@ -602,6 +607,9 @@ case $distro in

installsnipeit

#open the firewall for HTTP traffic only
openfirewalld

#Check if SELinux is enforcing
if [ "$(getenforce)" == "Enforcing" ]; then
echo "* Configuring SELinux."
Expand Down

0 comments on commit dd7db0d

Please sign in to comment.