From 8bf9de5dc3f81bff84663bd3ed1e4dda46de44dd Mon Sep 17 00:00:00 2001 From: midoks Date: Sun, 12 Jun 2022 22:47:56 +0800 Subject: [PATCH] #16 --- class/core/firewall_api.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/class/core/firewall_api.py b/class/core/firewall_api.py index 2ea639af4..68a6da216 100755 --- a/class/core/firewall_api.py +++ b/class/core/firewall_api.py @@ -292,7 +292,7 @@ class firewall_api: status = request.form.get('status', '1') if status == '1': if self.__isUfw: - mw.execShell('/usr/sbin/ufw stop') + mw.execShell('/usr/sbin/ufw disable') if self.__isFirewalld: mw.execShell('systemctl stop firewalld.service') mw.execShell('systemctl disable firewalld.service') @@ -303,7 +303,7 @@ class firewall_api: mw.execShell('/etc/init.d/iptables stop') else: if self.__isUfw: - mw.execShell('/usr/sbin/ufw start') + mw.execShell("echo 'y'|sudo ufw enable") if self.__isFirewalld: mw.execShell('systemctl start firewalld.service') mw.execShell('systemctl enable firewalld.service') @@ -390,7 +390,7 @@ class firewall_api: def getFwStatus(self): if self.__isUfw: - cmd = "ps -ef|grep ufw |grep -v grep | awk '{print $2}'" + cmd = "/usr/sbin/ufw status | grep inactive" data = mw.execShell(cmd) if data[0] == '': return False