mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
Fix iptables detection
This commit is contained in:
@@ -352,8 +352,8 @@ class firewall_api:
|
|||||||
elif self.__isMac:
|
elif self.__isMac:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
mw.execShell('/etc/init.d/iptables save')
|
mw.execShell('service iptables save')
|
||||||
mw.execShell('/etc/init.d/iptables stop')
|
mw.execShell('service iptables stop')
|
||||||
else:
|
else:
|
||||||
if self.__isUfw:
|
if self.__isUfw:
|
||||||
mw.execShell("echo 'y'| ufw enable")
|
mw.execShell("echo 'y'| ufw enable")
|
||||||
@@ -363,8 +363,8 @@ class firewall_api:
|
|||||||
elif self.__isMac:
|
elif self.__isMac:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
mw.execShell('/etc/init.d/iptables save')
|
mw.execShell('service iptables save')
|
||||||
mw.execShell('/etc/init.d/iptables restart')
|
mw.execShell('service iptables restart')
|
||||||
|
|
||||||
return mw.returnData(True, '设置成功!')
|
return mw.returnData(True, '设置成功!')
|
||||||
|
|
||||||
@@ -437,8 +437,8 @@ class firewall_api:
|
|||||||
elif self.__isMac:
|
elif self.__isMac:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
mw.execShell('/etc/init.d/iptables save')
|
mw.execShell('service iptables save')
|
||||||
mw.execShell('/etc/init.d/iptables restart')
|
mw.execShell('service iptables restart')
|
||||||
|
|
||||||
def getFwStatus(self):
|
def getFwStatus(self):
|
||||||
if self.__isUfw:
|
if self.__isUfw:
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ if [ ! -d /root/.acme.sh ];then
|
|||||||
curl https://get.acme.sh | sh
|
curl https://get.acme.sh | sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /etc/init.d/iptables ];then
|
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 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 80 -j ACCEPT
|
||||||
@@ -41,7 +41,7 @@ if [ -f /etc/init.d/iptables ];then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ ! -f /etc/init.d/iptables ];then
|
if [ ! -f /usr/sbin/iptables ];then
|
||||||
yum install firewalld -y
|
yum install firewalld -y
|
||||||
systemctl enable firewalld
|
systemctl enable firewalld
|
||||||
systemctl start firewalld
|
systemctl start firewalld
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ if [ ! -d /root/.acme.sh ];then
|
|||||||
curl https://get.acme.sh | sh
|
curl https://get.acme.sh | sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /etc/init.d/iptables ];then
|
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 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 80 -j ACCEPT
|
||||||
@@ -49,7 +49,7 @@ if [ -f /etc/init.d/iptables ];then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ ! -f /etc/init.d/iptables ];then
|
if [ ! -f /usr/sbin/iptables ];then
|
||||||
yum install firewalld -y
|
yum install firewalld -y
|
||||||
systemctl enable firewalld
|
systemctl enable firewalld
|
||||||
#取消服务锁定
|
#取消服务锁定
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ if [ ! -d /root/.acme.sh ];then
|
|||||||
curl https://get.acme.sh | sh
|
curl https://get.acme.sh | sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /etc/init.d/iptables ];then
|
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 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 80 -j ACCEPT
|
||||||
@@ -80,7 +80,7 @@ if [ -f /etc/init.d/iptables ];then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ ! -f /etc/init.d/iptables ];then
|
if [ ! -f /usr/sbin/iptables ];then
|
||||||
echo y | pacman -Sy firewalld
|
echo y | pacman -Sy firewalld
|
||||||
systemctl enable firewalld
|
systemctl enable firewalld
|
||||||
systemctl start firewalld
|
systemctl start firewalld
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ if [ ! -d /root/.acme.sh ];then
|
|||||||
curl https://get.acme.sh | sh
|
curl https://get.acme.sh | sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /etc/init.d/iptables ];then
|
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 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 80 -j ACCEPT
|
||||||
@@ -50,7 +50,7 @@ if [ -f /etc/init.d/iptables ];then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ ! -f /etc/init.d/iptables ];then
|
if [ ! -f /usr/sbin/iptables ];then
|
||||||
yum install firewalld -y
|
yum install firewalld -y
|
||||||
systemctl enable firewalld
|
systemctl enable firewalld
|
||||||
#取消服务锁定
|
#取消服务锁定
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ if [ ! -d /root/.acme.sh ];then
|
|||||||
curl https://get.acme.sh | sh
|
curl https://get.acme.sh | sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /etc/init.d/iptables ];then
|
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 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 80 -j ACCEPT
|
||||||
@@ -46,7 +46,7 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
if [ "${isVersion}" == '' ];then
|
if [ "${isVersion}" == '' ];then
|
||||||
if [ ! -f "/etc/init.d/iptables" ];then
|
if [ ! -f "/usr/sbin/iptables" ];then
|
||||||
yum install firewalld -y
|
yum install firewalld -y
|
||||||
systemctl enable firewalld
|
systemctl enable firewalld
|
||||||
systemctl start firewalld
|
systemctl start firewalld
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ if [ ! -d /root/.acme.sh ];then
|
|||||||
curl https://get.acme.sh | sh
|
curl https://get.acme.sh | sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /etc/init.d/iptables ];then
|
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 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 80 -j ACCEPT
|
||||||
@@ -66,7 +66,7 @@ if [ -f /etc/init.d/iptables ];then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ ! -f /etc/init.d/iptables ];then
|
if [ ! -f /usr/sbin/iptables ];then
|
||||||
pkg install -y firewalld
|
pkg install -y firewalld
|
||||||
systemctl enable firewalld
|
systemctl enable firewalld
|
||||||
systemctl start firewalld
|
systemctl start firewalld
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ if [ ! -d /root/.acme.sh ];then
|
|||||||
curl https://get.acme.sh | sh
|
curl https://get.acme.sh | sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /etc/init.d/iptables ];then
|
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 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 80 -j ACCEPT
|
||||||
@@ -77,7 +77,7 @@ if [ -f /etc/init.d/iptables ];then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ ! -f /etc/init.d/iptables ];then
|
if [ ! -f /usr/sbin/iptables ];then
|
||||||
zypper install -y firewalld
|
zypper install -y firewalld
|
||||||
systemctl enable firewalld
|
systemctl enable firewalld
|
||||||
systemctl start firewalld
|
systemctl start firewalld
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ if [ ! -d /root/.acme.sh ];then
|
|||||||
curl https://get.acme.sh | sh
|
curl https://get.acme.sh | sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /etc/init.d/iptables ];then
|
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 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 80 -j ACCEPT
|
||||||
@@ -45,7 +45,7 @@ if [ -f /etc/init.d/iptables ];then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ ! -f /etc/init.d/iptables ];then
|
if [ ! -f /usr/sbin/iptables ];then
|
||||||
yum install firewalld -y
|
yum install firewalld -y
|
||||||
systemctl enable firewalld
|
systemctl enable firewalld
|
||||||
systemctl start firewalld
|
systemctl start firewalld
|
||||||
|
|||||||
Reference in New Issue
Block a user