2019-01-07 20:28:53 +00:00
|
|
|
if ! [ $(id -u) = 0 ]; then
|
|
|
|
echo "Please run this script as root."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-02-21 21:35:32 +00:00
|
|
|
if [[ -f /etc/redhat-release ]] ; then
|
2018-09-06 13:47:33 +00:00
|
|
|
CENTOS_VER=`/opt/hirs/scripts/common/get_centos_major_version.sh`
|
2019-02-21 21:35:32 +00:00
|
|
|
elif [[ -f /etc/os-release ]] ; then
|
|
|
|
AMAZON_VER=`/opt/hirs/scripts/common/get_amazon_linux_major_version.sh`
|
|
|
|
fi
|
2018-09-06 13:47:33 +00:00
|
|
|
|
|
|
|
if [ $CENTOS_VER -eq "6" ] ; then
|
|
|
|
checkHTTPS=`iptables-save | grep -- "--dport 8443 -j ACCEPT"`
|
|
|
|
if [[ $checkHTTPS == "" ]]; then
|
|
|
|
echo "Tomcat HTTPS firewall rule doesn't exist, adding now"
|
2019-01-07 20:28:53 +00:00
|
|
|
iptables -I INPUT 1 -p tcp -m tcp --dport 8443 -j ACCEPT
|
2018-09-06 13:47:33 +00:00
|
|
|
service iptables save
|
|
|
|
fi
|
2019-02-21 21:35:32 +00:00
|
|
|
elif [ $CENTOS_VER -eq "7" ] || [ $AMAZON_VER -eq "2" ] ; then
|
2019-01-07 20:28:53 +00:00
|
|
|
firewall-cmd --direct --permanent --add-rule ipv4 filter INPUT 0 -p tcp --dport 8443 -j ACCEPT
|
|
|
|
firewall-cmd --reload
|
2018-09-06 13:47:33 +00:00
|
|
|
else
|
2019-02-21 21:35:32 +00:00
|
|
|
echo "Unsupported Linux detected"
|
2018-09-06 13:47:33 +00:00
|
|
|
exit 1
|
2019-02-21 21:35:32 +00:00
|
|
|
fi
|
|
|
|
|