Skip to content

Commit

Permalink
update lib
Browse files Browse the repository at this point in the history
  • Loading branch information
gdbtek committed Sep 13, 2019
1 parent b46eaeb commit 1ac2926
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions libraries/util.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2221,6 +2221,8 @@ function flushFirewall()
iptables -X

iptables --list

saveFirewall
}

function isPortOpen()
Expand Down Expand Up @@ -2272,6 +2274,30 @@ function remountTMP()
fi
}

function saveFirewall()
{
header 'SAVING FIREWALL'

local ruleFile=''

for ruleFile in '/etc/iptables/rules.v4' '/etc/iptables/rules.v6' '/etc/sysconfig/iptables' '/etc/sysconfig/ip6tables'
do
if [[ -f "${ruleFile}" ]]
then
if [[ "$(grep -F '6' <<< "${ruleFile}")" = '' ]]
then
iptables-save > "${ruleFile}"
else
ip6tables-save > "${ruleFile}"
fi

info "${ruleFile}"
cat "${ruleFile}"
echo
fi
done
}

############################
# USER AND GROUP UTILITIES #
############################
Expand Down

0 comments on commit 1ac2926

Please sign in to comment.