|
|
@ -292,7 +292,7 @@ class firewall_api: |
|
|
|
status = request.form.get('status', '1') |
|
|
|
status = request.form.get('status', '1') |
|
|
|
if status == '1': |
|
|
|
if status == '1': |
|
|
|
if self.__isUfw: |
|
|
|
if self.__isUfw: |
|
|
|
mw.execShell('/usr/sbin/ufw stop') |
|
|
|
mw.execShell('/usr/sbin/ufw disable') |
|
|
|
if self.__isFirewalld: |
|
|
|
if self.__isFirewalld: |
|
|
|
mw.execShell('systemctl stop firewalld.service') |
|
|
|
mw.execShell('systemctl stop firewalld.service') |
|
|
|
mw.execShell('systemctl disable firewalld.service') |
|
|
|
mw.execShell('systemctl disable firewalld.service') |
|
|
@ -303,7 +303,7 @@ class firewall_api: |
|
|
|
mw.execShell('/etc/init.d/iptables stop') |
|
|
|
mw.execShell('/etc/init.d/iptables stop') |
|
|
|
else: |
|
|
|
else: |
|
|
|
if self.__isUfw: |
|
|
|
if self.__isUfw: |
|
|
|
mw.execShell('/usr/sbin/ufw start') |
|
|
|
mw.execShell("echo 'y'|sudo ufw enable") |
|
|
|
if self.__isFirewalld: |
|
|
|
if self.__isFirewalld: |
|
|
|
mw.execShell('systemctl start firewalld.service') |
|
|
|
mw.execShell('systemctl start firewalld.service') |
|
|
|
mw.execShell('systemctl enable firewalld.service') |
|
|
|
mw.execShell('systemctl enable firewalld.service') |
|
|
@ -390,7 +390,7 @@ class firewall_api: |
|
|
|
|
|
|
|
|
|
|
|
def getFwStatus(self): |
|
|
|
def getFwStatus(self): |
|
|
|
if self.__isUfw: |
|
|
|
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) |
|
|
|
data = mw.execShell(cmd) |
|
|
|
if data[0] == '': |
|
|
|
if data[0] == '': |
|
|
|
return False |
|
|
|
return False |
|
|
|