Fix iptables detection

This commit is contained in:
hiCasper
2022-12-10 02:09:27 +08:00
parent b3c8a6365f
commit cab35c7c28
9 changed files with 22 additions and 22 deletions
+6 -6
View File
@@ -352,8 +352,8 @@ class firewall_api:
elif self.__isMac:
pass
else:
mw.execShell('/etc/init.d/iptables save')
mw.execShell('/etc/init.d/iptables stop')
mw.execShell('service iptables save')
mw.execShell('service iptables stop')
else:
if self.__isUfw:
mw.execShell("echo 'y'| ufw enable")
@@ -363,8 +363,8 @@ class firewall_api:
elif self.__isMac:
pass
else:
mw.execShell('/etc/init.d/iptables save')
mw.execShell('/etc/init.d/iptables restart')
mw.execShell('service iptables save')
mw.execShell('service iptables restart')
return mw.returnData(True, '设置成功!')
@@ -437,8 +437,8 @@ class firewall_api:
elif self.__isMac:
pass
else:
mw.execShell('/etc/init.d/iptables save')
mw.execShell('/etc/init.d/iptables restart')
mw.execShell('service iptables save')
mw.execShell('service iptables restart')
def getFwStatus(self):
if self.__isUfw:
+2 -2
View File
@@ -20,7 +20,7 @@ if [ ! -d /root/.acme.sh ];then
curl https://get.acme.sh | sh
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 80 -j ACCEPT
@@ -41,7 +41,7 @@ if [ -f /etc/init.d/iptables ];then
fi
if [ ! -f /etc/init.d/iptables ];then
if [ ! -f /usr/sbin/iptables ];then
yum install firewalld -y
systemctl enable firewalld
systemctl start firewalld
+2 -2
View File
@@ -28,7 +28,7 @@ if [ ! -d /root/.acme.sh ];then
curl https://get.acme.sh | sh
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 80 -j ACCEPT
@@ -49,7 +49,7 @@ if [ -f /etc/init.d/iptables ];then
fi
if [ ! -f /etc/init.d/iptables ];then
if [ ! -f /usr/sbin/iptables ];then
yum install firewalld -y
systemctl enable firewalld
#取消服务锁定
+2 -2
View File
@@ -59,7 +59,7 @@ if [ ! -d /root/.acme.sh ];then
curl https://get.acme.sh | sh
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 80 -j ACCEPT
@@ -80,7 +80,7 @@ if [ -f /etc/init.d/iptables ];then
fi
if [ ! -f /etc/init.d/iptables ];then
if [ ! -f /usr/sbin/iptables ];then
echo y | pacman -Sy firewalld
systemctl enable firewalld
systemctl start firewalld
+2 -2
View File
@@ -29,7 +29,7 @@ if [ ! -d /root/.acme.sh ];then
curl https://get.acme.sh | sh
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 80 -j ACCEPT
@@ -50,7 +50,7 @@ if [ -f /etc/init.d/iptables ];then
fi
if [ ! -f /etc/init.d/iptables ];then
if [ ! -f /usr/sbin/iptables ];then
yum install firewalld -y
systemctl enable firewalld
#取消服务锁定
+2 -2
View File
@@ -23,7 +23,7 @@ if [ ! -d /root/.acme.sh ];then
curl https://get.acme.sh | sh
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 80 -j ACCEPT
@@ -46,7 +46,7 @@ fi
if [ "${isVersion}" == '' ];then
if [ ! -f "/etc/init.d/iptables" ];then
if [ ! -f "/usr/sbin/iptables" ];then
yum install firewalld -y
systemctl enable firewalld
systemctl start firewalld
+2 -2
View File
@@ -45,7 +45,7 @@ if [ ! -d /root/.acme.sh ];then
curl https://get.acme.sh | sh
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 80 -j ACCEPT
@@ -66,7 +66,7 @@ if [ -f /etc/init.d/iptables ];then
fi
if [ ! -f /etc/init.d/iptables ];then
if [ ! -f /usr/sbin/iptables ];then
pkg install -y firewalld
systemctl enable firewalld
systemctl start firewalld
+2 -2
View File
@@ -56,7 +56,7 @@ if [ ! -d /root/.acme.sh ];then
curl https://get.acme.sh | sh
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 80 -j ACCEPT
@@ -77,7 +77,7 @@ if [ -f /etc/init.d/iptables ];then
fi
if [ ! -f /etc/init.d/iptables ];then
if [ ! -f /usr/sbin/iptables ];then
zypper install -y firewalld
systemctl enable firewalld
systemctl start firewalld
+2 -2
View File
@@ -24,7 +24,7 @@ if [ ! -d /root/.acme.sh ];then
curl https://get.acme.sh | sh
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 80 -j ACCEPT
@@ -45,7 +45,7 @@ if [ -f /etc/init.d/iptables ];then
fi
if [ ! -f /etc/init.d/iptables ];then
if [ ! -f /usr/sbin/iptables ];then
yum install firewalld -y
systemctl enable firewalld
systemctl start firewalld