安装,自动放行端口

This commit is contained in:
midoks 2023-01-03 14:43:34 +08:00
parent 2f274ce202
commit b5cd0564cb
1 changed files with 14 additions and 0 deletions

View File

@ -80,6 +80,19 @@ def contentReplace(content):
content = content.replace('{$SERVER_PATH}', service_path)
return content
def __release_port(port):
from collections import namedtuple
try:
import firewall_api
firewall_api.firewall_api().addAcceptPortArgs(port, 'pure-ftpd', 'port')
return port
except Exception as e:
return "Release failed {}".format(e)
def openFtpPort():
for i in ["21", "39000:40000"]:
__release_port(i)
return True
def initDreplace():
@ -89,6 +102,7 @@ def initDreplace():
initD_path = getServerDir() + '/init.d'
if not os.path.exists(initD_path):
os.mkdir(initD_path)
openFtpPort()
file_bin = initD_path + '/' + getPluginName()
# initd replace