mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user