|
|
|
@ -17,45 +17,48 @@ yum install -y wget curl lsof unzip |
|
|
|
|
yum install -y expect |
|
|
|
|
dnf install crontabs -y |
|
|
|
|
|
|
|
|
|
if [ -f /usr/sbin/iptables ];then |
|
|
|
|
|
|
|
|
|
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT |
|
|
|
|
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT |
|
|
|
|
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT |
|
|
|
|
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT |
|
|
|
|
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT |
|
|
|
|
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT |
|
|
|
|
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT |
|
|
|
|
service iptables save |
|
|
|
|
|
|
|
|
|
iptables_status=`service iptables status | grep 'not running'` |
|
|
|
|
if [ "${iptables_status}" == '' ];then |
|
|
|
|
service iptables restart |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
#安装时不开启 |
|
|
|
|
service iptables stop |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "${isVersion}" == '' ];then |
|
|
|
|
if [ ! -f "/usr/sbin/iptables" ];then |
|
|
|
|
yum install firewalld -y |
|
|
|
|
systemctl enable firewalld |
|
|
|
|
systemctl start firewalld |
|
|
|
|
|
|
|
|
|
SSH_PORT=`netstat -ntpl|grep sshd|grep -v grep | sed -n "1,1p" | awk '{print $4}' | awk -F : '{print $2}'` |
|
|
|
|
echo "SSH PORT:${SSH_PORT}" |
|
|
|
|
|
|
|
|
|
# if [ -f /usr/sbin/iptables ];then |
|
|
|
|
|
|
|
|
|
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT |
|
|
|
|
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT |
|
|
|
|
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT |
|
|
|
|
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT |
|
|
|
|
# # iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT |
|
|
|
|
# # iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT |
|
|
|
|
# # iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT |
|
|
|
|
# service iptables save |
|
|
|
|
|
|
|
|
|
# iptables_status=`service iptables status | grep 'not running'` |
|
|
|
|
# if [ "${iptables_status}" == '' ];then |
|
|
|
|
# service iptables restart |
|
|
|
|
# fi |
|
|
|
|
|
|
|
|
|
# #安装时不开启 |
|
|
|
|
# service iptables stop |
|
|
|
|
# fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ ! -f /usr/sbin/iptables ];then |
|
|
|
|
yum install firewalld -y |
|
|
|
|
systemctl enable firewalld |
|
|
|
|
systemctl start firewalld |
|
|
|
|
|
|
|
|
|
if [ "$SSH_PORT" != "" ];then |
|
|
|
|
firewall-cmd --permanent --zone=public --add-port=${SSH_PORT}/tcp |
|
|
|
|
else |
|
|
|
|
firewall-cmd --permanent --zone=public --add-port=22/tcp |
|
|
|
|
firewall-cmd --permanent --zone=public --add-port=80/tcp |
|
|
|
|
firewall-cmd --permanent --zone=public --add-port=443/tcp |
|
|
|
|
firewall-cmd --permanent --zone=public --add-port=888/tcp |
|
|
|
|
# firewall-cmd --permanent --zone=public --add-port=7200/tcp |
|
|
|
|
# firewall-cmd --permanent --zone=public --add-port=3306/tcp |
|
|
|
|
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp |
|
|
|
|
firewall-cmd --reload |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
firewall-cmd --permanent --zone=public --add-port=80/tcp |
|
|
|
|
firewall-cmd --permanent --zone=public --add-port=443/tcp |
|
|
|
|
firewall-cmd --permanent --zone=public --add-port=888/tcp |
|
|
|
|
firewall-cmd --reload |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#安装时不开启 |
|
|
|
|
systemctl stop firewalld |
|
|
|
|
|
|
|
|
|