|
|
|
@ -66,47 +66,20 @@ SSH_PORT=${SSH_PORT_LINE/"Port "/""} |
|
|
|
|
|
|
|
|
|
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 |
|
|
|
|
# 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 |
|
|
|
|
# firewall-cmd --list-all |
|
|
|
|
# iptables -nL --line-number |
|
|
|
|
pkg install -y firewalld |
|
|
|
|
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 |
|
|
|
|
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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sed -i 's#AllowZoneDrifting=yes#AllowZoneDrifting=no#g' /etc/firewalld/firewalld.conf |
|
|
|
|
firewall-cmd --reload |
|
|
|
|
#安装时不开启 |
|
|
|
|
systemctl stop firewalld |
|
|
|
|
# 检测防火墙是否开启 |
|
|
|
|
FW_ENABLE=`cat /etc/rc.conf | grep firewall_enable` |
|
|
|
|
if [ "$FW_ENABLE" == "" ];then |
|
|
|
|
sysrc firewall_enable="YES" |
|
|
|
|
sysrc firewall_type="open" |
|
|
|
|
sysrc firewall_script="/etc/ipfw.rules" |
|
|
|
|
sysrc firewall_logging="YES" |
|
|
|
|
sysrc firewall_logif="YES" |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# ipfw list |
|
|
|
|
# service ipfw start |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cd /www/server/mdserver-web/scripts && bash lib.sh |
|
|
|
|
chmod 755 /www/server/mdserver-web/data |
|
|
|
|
|
|
|
|
|