This commit is contained in:
parent
b79760d3bd
commit
081034ae4b
|
|
@ -139,6 +139,10 @@ class config_api:
|
|||
import system_api
|
||||
import firewall_api
|
||||
|
||||
if firewall_api.__isFirewalld:
|
||||
mw.execShell('systemctl start firewalld')
|
||||
time.sleep(1)
|
||||
|
||||
mw.setHostPort(port)
|
||||
|
||||
msg = mw.getInfo('放行端口[{1}]成功', (port,))
|
||||
|
|
|
|||
|
|
@ -365,16 +365,15 @@ class firewall_api:
|
|||
def addAcceptPort(self, port):
|
||||
if self.__isUfw:
|
||||
mw.execShell('ufw allow ' + port + '/tcp')
|
||||
elif self.__isFirewalld:
|
||||
port = port.replace(':', '-')
|
||||
cmd = 'firewall-cmd --permanent --zone=public --add-port=' + port + '/tcp'
|
||||
mw.execShell(cmd)
|
||||
elif self.__isMac:
|
||||
pass
|
||||
else:
|
||||
if self.__isFirewalld:
|
||||
port = port.replace(':', '-')
|
||||
cmd = 'firewall-cmd --permanent --zone=public --add-port=' + port + '/tcp'
|
||||
mw.execShell(cmd)
|
||||
elif self.__isMac:
|
||||
pass
|
||||
else:
|
||||
cmd = 'iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport ' + port + ' -j ACCEPT'
|
||||
mw.execShell(cmd)
|
||||
cmd = 'iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport ' + port + ' -j ACCEPT'
|
||||
mw.execShell(cmd)
|
||||
|
||||
def firewallReload(self):
|
||||
if self.__isUfw:
|
||||
|
|
|
|||
Loading…
Reference in New Issue