mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 17:39:25 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1282babb06 | ||
|
|
71770ec406 | ||
|
|
f36495f0fd | ||
|
|
1cc4813c52 | ||
|
|
2ae74d6199 | ||
|
|
92d83bb82d | ||
|
|
f14d55fcc6 | ||
|
|
062de09b3b | ||
|
|
5cbd53a667 | ||
|
|
cf645d1f20 | ||
|
|
5b8cf7bb0a | ||
|
|
f5161bca66 | ||
|
|
5934be02bd | ||
|
|
9e9f10b06f | ||
|
|
0fafeabcf0 | ||
|
|
f98e4db019 | ||
|
|
ec00e9d17e | ||
|
|
b236bd85c9 | ||
|
|
40a8620745 | ||
|
|
0307828a82 | ||
|
|
e7d2eddc20 | ||
|
|
8c41b4c3fa | ||
|
|
3ea67beea9 | ||
|
|
a346da07ad | ||
|
|
067ee597a7 | ||
|
|
aac7704208 | ||
|
|
3a10aa7809 | ||
|
|
1b4582574c | ||
|
|
51b8738cbc | ||
|
|
0dd3c1844e | ||
|
|
0dabfdacbd | ||
|
|
d0166f03bb | ||
|
|
b102d4dd1f | ||
|
|
576f553317 | ||
|
|
31a0903514 | ||
|
|
796c19b5dc | ||
|
|
b7902ae2d0 | ||
|
|
7deaf2822a | ||
|
|
7e78c2dac4 | ||
|
|
f341c80fbe | ||
|
|
b593cc4708 | ||
|
|
7a8c83ee90 | ||
|
|
8c410b272d | ||
|
|
ecacb44df8 | ||
|
|
dcfaa1a6c9 | ||
|
|
c51e50f815 | ||
|
|
84b0fbc8ef | ||
|
|
4d83c44a73 | ||
|
|
4d82835658 | ||
|
|
cf863662e0 | ||
|
|
4a66b76963 | ||
|
|
0da43b6ccb | ||
|
|
c2ad19a4de | ||
|
|
db6538b57c | ||
|
|
535f6ddc77 | ||
|
|
aa3950ccfe | ||
|
|
8a81f8bb83 | ||
|
|
55d987c0bd | ||
|
|
416e9e7cda | ||
|
|
eedaef7eec | ||
|
|
3265deed3d | ||
|
|
1c7db0e2ec | ||
|
|
7872891797 | ||
|
|
8b074090a7 | ||
|
|
50f198e2d3 | ||
|
|
07e017c9a7 | ||
|
|
ca0aed7240 | ||
|
|
0126bcb68c | ||
|
|
7c37df5dec | ||
|
|
33bc6e19e7 | ||
|
|
35d42a5603 | ||
|
|
8a79beab89 | ||
|
|
cafff1d522 | ||
|
|
e266d85c91 | ||
|
|
e873ea8639 | ||
|
|
0cdc23a096 | ||
|
|
2c0231155d | ||
|
|
5583db0c70 | ||
|
|
2eeef4d8bd | ||
|
|
5a93b07968 | ||
|
|
b5195ba685 | ||
|
|
4c05747942 | ||
|
|
3722f57347 | ||
|
|
b7a3c32d3f | ||
|
|
6c0cb42e35 | ||
|
|
a84e7a16a3 | ||
|
|
fab1cb1bbe | ||
|
|
b46d7c1dee | ||
|
|
8f4dda2d65 | ||
|
|
e21d17e342 | ||
|
|
87eab46ed6 | ||
|
|
e0ebed3080 | ||
|
|
372dbc8995 | ||
|
|
33faf1e54c | ||
|
|
47f67275d5 | ||
|
|
e45ebc5f11 | ||
|
|
9ee570e3bb | ||
|
|
cc80ec7839 | ||
|
|
e7174a2111 | ||
|
|
ef6adfd82d | ||
|
|
daf6c9bff8 | ||
|
|
9f02092788 | ||
|
|
b314ebeed3 | ||
|
|
38f8fe9a38 | ||
|
|
c0e1512195 | ||
|
|
b616854baa | ||
|
|
1ad9546ae4 | ||
|
|
fb3aac37ec | ||
|
|
598f964e91 | ||
|
|
d9e46f1065 | ||
|
|
565d011191 | ||
|
|
6ae6e5fafc | ||
|
|
eb1c0efda1 | ||
|
|
98bc816b21 | ||
|
|
85735287c3 | ||
|
|
d59022ae44 | ||
|
|
70a17af9d8 | ||
|
|
09feeb11d2 | ||
|
|
d95e1e68c4 | ||
|
|
6e484babe9 | ||
|
|
d37ff296f6 | ||
|
|
f95d25f080 | ||
|
|
fd35db3dd8 | ||
|
|
f22e10a496 | ||
|
|
52f80ec3b7 | ||
|
|
41fd11c0f4 | ||
|
|
f8a5e7dab5 |
@@ -122,6 +122,7 @@ data/datadir.pl
|
||||
data/502Task.pl
|
||||
data/default.pl
|
||||
data/backup.pl
|
||||
data/debug.pl
|
||||
data/default_site.pl
|
||||
lib/python*
|
||||
|
||||
@@ -151,6 +152,7 @@ plugins/gdrive
|
||||
plugins/mtproxy
|
||||
plugins/zimg
|
||||
plugins/bk_demo
|
||||
plugins/mail
|
||||
debug.out
|
||||
|
||||
|
||||
|
||||
@@ -67,6 +67,10 @@ PHP[53-72]支持phpMyAdmin[4.4.15]
|
||||
PHP[72-81]支持phpMyAdmin[5.2.0]
|
||||
```
|
||||
|
||||
# 特别赞助
|
||||
|
||||
- [找资源 - 阿里云盘资源搜索引擎](https://zhaoziyuan.la/)
|
||||
|
||||
# AD - VPS推荐 - 🙏
|
||||
|
||||
- [ZZZ评测](https://www.zzzvps.com/)
|
||||
@@ -86,18 +90,14 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
|
||||
```
|
||||
|
||||
|
||||
### 版本更新 0.9.9
|
||||
### 版本更新 0.9.11
|
||||
|
||||
* 更换Logo。
|
||||
* 增加amazon linux系统支持。
|
||||
* 修复rsyncd在debian或ubuntu下安装失败问题。
|
||||
* Readme加入一AD。
|
||||
* PHP-YUM|PHP-APT优化[性能调整]。
|
||||
* 优化Gogs使用MySQL的方式。
|
||||
* 配置模板添加一个whmcs。
|
||||
* MySQL和MariaDB无法直接卸载。
|
||||
* OpenResty加入http_realip_module模块。
|
||||
* PHP加入igbinary扩展。
|
||||
* 大文件解压优化。
|
||||
* 防火墙api优化。
|
||||
* mysql|mariadb安装删除冗余账户。
|
||||
* imail插件添加。
|
||||
* 安装面板初始化安装时不再固定端口[7200],优化为随机端口。
|
||||
* redis添加性能调整功能。
|
||||
|
||||
|
||||
### JSDelivr安装地址
|
||||
|
||||
@@ -15,7 +15,7 @@ from flask import request
|
||||
|
||||
class config_api:
|
||||
|
||||
__version = '0.9.9'
|
||||
__version = '0.9.11'
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
@@ -207,6 +207,14 @@ class config_api:
|
||||
mw.execShell("chown root.root " + filename)
|
||||
return mw.returnJson(True, '面板已关闭!')
|
||||
|
||||
def openDebugApi(self):
|
||||
filename = 'data/debug.pl'
|
||||
if os.path.exists(filename):
|
||||
os.remove(filename)
|
||||
return mw.returnJson(True, '开发模式关闭!')
|
||||
mw.writeFile(filename, 'True')
|
||||
return mw.returnJson(True, '开发模式开启!')
|
||||
|
||||
def setIpv6StatusApi(self):
|
||||
ipv6_file = 'data/ipv6.pl'
|
||||
if os.path.exists('data/ipv6.pl'):
|
||||
@@ -316,11 +324,17 @@ class config_api:
|
||||
data['admin_path'] = mw.readFile(admin_path_file)
|
||||
|
||||
ipv6_file = 'data/ipv6.pl'
|
||||
if os.path.exists('data/ipv6.pl'):
|
||||
if os.path.exists(ipv6_file):
|
||||
data['ipv6'] = 'checked'
|
||||
else:
|
||||
data['ipv6'] = ''
|
||||
|
||||
debug_file = 'data/debug.pl'
|
||||
if os.path.exists(debug_file):
|
||||
data['debug'] = 'checked'
|
||||
else:
|
||||
data['debug'] = ''
|
||||
|
||||
ssl_file = 'data/ssl.pl'
|
||||
if os.path.exists('data/ssl.pl'):
|
||||
data['ssl'] = 'checked'
|
||||
|
||||
@@ -167,7 +167,7 @@ class crontab_api:
|
||||
logFile = mw.getServerDir() + '/cron/' + echo['echo'] + '.log'
|
||||
if not os.path.exists(logFile):
|
||||
return mw.returnJson(False, '当前日志为空!')
|
||||
log = mw.getNumLines(logFile, 500)
|
||||
log = mw.getLastLine(logFile, 500)
|
||||
return mw.returnJson(True, log)
|
||||
|
||||
def addApi(self):
|
||||
|
||||
@@ -36,7 +36,7 @@ class files_api:
|
||||
return mw.returnJson(False, '文件不存在', (path,))
|
||||
|
||||
try:
|
||||
data = mw.getNumLines(path, int(line))
|
||||
data = mw.getLastLine(path, int(line))
|
||||
return mw.returnJson(True, 'OK', data)
|
||||
except Exception as ex:
|
||||
return mw.returnJson(False, u'无法正确读取文件!' + str(ex))
|
||||
@@ -759,7 +759,7 @@ class files_api:
|
||||
tmps = mw.getRunDir() + '/tmp/panelExec.log'
|
||||
if stype == 'zip':
|
||||
os.system("cd " + path + " && unzip -d '" + dfile +
|
||||
"' '" + sfile + "' > " + tmps + " 2>&1")
|
||||
"' '" + sfile + "' > " + tmps + " 2>&1 &")
|
||||
else:
|
||||
sfiles = ''
|
||||
for sfile in sfile.split(','):
|
||||
@@ -767,7 +767,7 @@ class files_api:
|
||||
continue
|
||||
sfiles += " '" + sfile + "'"
|
||||
os.system("cd " + path + " && tar -zxvf " + sfiles +
|
||||
" -C " + dfile + " > " + tmps + " 2>&1")
|
||||
" -C " + dfile + " > " + tmps + " 2>&1 &")
|
||||
self.setFileAccept(dfile)
|
||||
mw.writeLog("文件管理", '文件解压成功!', (sfile, dfile))
|
||||
return mw.returnJson(True, '文件解压成功!')
|
||||
|
||||
@@ -59,22 +59,30 @@ class firewall_api:
|
||||
|
||||
# 添加放行端口
|
||||
def addAcceptPortApi(self):
|
||||
|
||||
if not self.getFwStatus():
|
||||
return mw.returnJson(False, '防火墙启动时,才能添加规则!')
|
||||
|
||||
import re
|
||||
import time
|
||||
port = request.form.get('port', '').strip()
|
||||
ps = request.form.get('ps', '').strip()
|
||||
stype = request.form.get('type', '').strip()
|
||||
|
||||
data = self.addAcceptPortArgs(port, ps, stype)
|
||||
return mw.getJson(data)
|
||||
|
||||
# 添加放行端口
|
||||
def addAcceptPortArgs(self, port, ps, stype):
|
||||
import re
|
||||
import time
|
||||
|
||||
if not self.getFwStatus():
|
||||
self.setFw(0)
|
||||
|
||||
rep = "^\d{1,5}(:\d{1,5})?$"
|
||||
if not re.search(rep, port):
|
||||
return mw.returnJson(False, '端口范围不正确!')
|
||||
return mw.returnData(False, '端口范围不正确!')
|
||||
|
||||
if mw.M('firewall').where("port=?", (port,)).count() > 0:
|
||||
return mw.returnJson(False, '您要放行的端口已存在,无需重复放行!')
|
||||
return mw.returnData(False, '您要放行的端口已存在,无需重复放行!')
|
||||
|
||||
msg = mw.getInfo('放行端口[{1}]成功', (port,))
|
||||
mw.writeLog("防火墙管理", msg)
|
||||
@@ -83,7 +91,7 @@ class firewall_api:
|
||||
|
||||
self.addAcceptPort(port)
|
||||
self.firewallReload()
|
||||
return mw.returnJson(True, '添加放行(' + port + ')端口成功!')
|
||||
return mw.returnData(True, '添加放行(' + port + ')端口成功!')
|
||||
|
||||
# 删除IP屏蔽
|
||||
def delDropAddressApi(self):
|
||||
@@ -290,6 +298,9 @@ class firewall_api:
|
||||
return mw.returnJson(True, '开发机不能设置!')
|
||||
|
||||
status = request.form.get('status', '1')
|
||||
return mw.getJson(self.setFw(status))
|
||||
|
||||
def setFw(self, status):
|
||||
if status == '1':
|
||||
if self.__isUfw:
|
||||
mw.execShell('/usr/sbin/ufw disable')
|
||||
@@ -313,7 +324,7 @@ class firewall_api:
|
||||
mw.execShell('/etc/init.d/iptables save')
|
||||
mw.execShell('/etc/init.d/iptables restart')
|
||||
|
||||
return mw.returnJson(True, '设置成功!')
|
||||
return mw.returnData(True, '设置成功!')
|
||||
|
||||
def delPanelLogsApi(self):
|
||||
mw.M('logs').where('id>?', (0,)).delete()
|
||||
|
||||
+40
-5
@@ -167,13 +167,13 @@ def restartWeb():
|
||||
# systemd
|
||||
systemd = '/lib/systemd/system/openresty.service'
|
||||
if os.path.exists(systemd):
|
||||
execShell('systemctl restart openresty')
|
||||
execShell('systemctl reload openresty')
|
||||
return True
|
||||
|
||||
# initd
|
||||
initd = getServerDir() + '/openresty/init.d/openresty'
|
||||
if os.path.exists(initd):
|
||||
execShell(initd + ' ' + 'restart')
|
||||
execShell(initd + ' ' + 'reload')
|
||||
return True
|
||||
|
||||
return False
|
||||
@@ -406,6 +406,30 @@ def writeFile(filename, str):
|
||||
return False
|
||||
|
||||
|
||||
def backFile(self, file, act=None):
|
||||
"""
|
||||
@name 备份配置文件
|
||||
@param file 需要备份的文件
|
||||
@param act 如果存在,则备份一份作为默认配置
|
||||
"""
|
||||
file_type = "_bak"
|
||||
if act:
|
||||
file_type = "_def"
|
||||
execShell("/usr/bin/cp -p {0} {1}".format(file, file + file_type))
|
||||
|
||||
|
||||
def restoreFile(self, file, act=None):
|
||||
"""
|
||||
@name 还原配置文件
|
||||
@param file 需要还原的文件
|
||||
@param act 如果存在,则还原默认配置
|
||||
"""
|
||||
file_type = "_bak"
|
||||
if act:
|
||||
file_type = "_def"
|
||||
execShell("/usr/bin/cp -p {1} {0}".format(file, file + file_type))
|
||||
|
||||
|
||||
def HttpGet(url, timeout=10):
|
||||
"""
|
||||
发送GET请求
|
||||
@@ -609,7 +633,7 @@ def getNumLines(path, num, p=1):
|
||||
break
|
||||
fp.close()
|
||||
except Exception as e:
|
||||
return ''
|
||||
return str(e)
|
||||
|
||||
return "\n".join(data)
|
||||
|
||||
@@ -714,13 +738,24 @@ def getStrBetween(startStr, endStr, srcStr):
|
||||
|
||||
|
||||
def getCpuType():
|
||||
cpuType = ''
|
||||
if isAppleSystem():
|
||||
cmd = "system_profiler SPHardwareDataType | grep 'Processor Name' | awk -F ':' '{print $2}'"
|
||||
cpuinfo = execShell(cmd)
|
||||
return cpuinfo[0].strip()
|
||||
|
||||
# 取CPU类型
|
||||
cpuinfo = open('/proc/cpuinfo', 'r').read()
|
||||
rep = "model\s+name\s+:\s+(.+)"
|
||||
tmp = re.search(rep, cpuinfo)
|
||||
cpuType = None
|
||||
tmp = re.search(rep, cpuinfo, re.I)
|
||||
if tmp:
|
||||
cpuType = tmp.groups()[0]
|
||||
else:
|
||||
cpuinfo = execShell('LANG="en_US.UTF-8" && lscpu')[0]
|
||||
rep = "Model\s+name:\s+(.+)"
|
||||
tmp = re.search(rep, cpuinfo, re.I)
|
||||
if tmp:
|
||||
cpuType = tmp.groups()[0]
|
||||
return cpuType
|
||||
|
||||
|
||||
|
||||
+39
-24
@@ -340,10 +340,16 @@ class site_api:
|
||||
name = mw.M('sites').where("id=?", (mid,)).getField('name')
|
||||
data = {}
|
||||
data['logs'] = self.getLogsStatus(name)
|
||||
data['runPath'] = self.getSiteRunPath(mid)
|
||||
|
||||
data['userini'] = False
|
||||
if os.path.exists(path + '/.user.ini'):
|
||||
data['userini'] = True
|
||||
data['runPath'] = self.getSiteRunPath(mid)
|
||||
|
||||
if data['runPath']['runPath'] != '/':
|
||||
if os.path.exists(path + data['runPath']['runPath'] + '/.user.ini'):
|
||||
data['userini'] = True
|
||||
|
||||
data['pass'] = self.getHasPwd(name)
|
||||
data['path'] = path
|
||||
data['name'] = name
|
||||
@@ -351,15 +357,18 @@ class site_api:
|
||||
|
||||
def setDirUserIniApi(self):
|
||||
path = request.form.get('path', '')
|
||||
runPath = request.form.get('runPath', '')
|
||||
filename = path + '/.user.ini'
|
||||
self.delUserInI(path)
|
||||
|
||||
if os.path.exists(filename):
|
||||
self.delUserInI(path)
|
||||
mw.execShell("which chattr && chattr -i " + filename)
|
||||
os.remove(filename)
|
||||
return mw.returnJson(True, '已清除防跨站设置!')
|
||||
mw.writeFile(filename, 'open_basedir=' + path +
|
||||
'/:/www/server/php:/tmp/:/proc/')
|
||||
|
||||
self.setDirUserINI(path, runPath)
|
||||
mw.execShell("which chattr && chattr +i " + filename)
|
||||
|
||||
return mw.returnJson(True, '已打开防跨站设置!')
|
||||
|
||||
def logsOpenApi(self):
|
||||
@@ -730,11 +739,11 @@ class site_api:
|
||||
if conf.find('ssl_certificate') == -1:
|
||||
return mw.returnJson(False, '当前未开启SSL')
|
||||
to = """#error_page 404/404.html;
|
||||
#HTTP_TO_HTTPS_START
|
||||
# HTTP_TO_HTTPS_START
|
||||
if ($server_port !~ 443){
|
||||
rewrite ^(/.*)$ https://$host$1 permanent;
|
||||
}
|
||||
#HTTP_TO_HTTPS_END"""
|
||||
# HTTP_TO_HTTPS_END"""
|
||||
conf = conf.replace('#error_page 404/404.html;', to)
|
||||
mw.writeFile(file, conf)
|
||||
|
||||
@@ -1095,6 +1104,7 @@ class site_api:
|
||||
sitePath = mw.M('sites').where('id=?', (mid,)).getField('path')
|
||||
|
||||
newPath = sitePath + runPath
|
||||
|
||||
# 处理Nginx
|
||||
filename = self.getHostConf(siteName)
|
||||
if os.path.exists(filename):
|
||||
@@ -1104,8 +1114,7 @@ class site_api:
|
||||
conf = conf.replace(path, newPath)
|
||||
mw.writeFile(filename, conf)
|
||||
|
||||
self.delUserInI(sitePath)
|
||||
self.setDirUserINI(newPath)
|
||||
self.setDirUserINI(sitePath, runPath)
|
||||
|
||||
mw.restartWeb()
|
||||
return mw.returnJson(True, '设置成功!')
|
||||
@@ -1562,7 +1571,7 @@ class site_api:
|
||||
|
||||
# location ~* ^{from}(.*)$ {
|
||||
tpl = """
|
||||
# PROXY-START/
|
||||
#PROXY-START/
|
||||
location ^~ {from} {
|
||||
proxy_pass {to};
|
||||
proxy_set_header Host {host};
|
||||
@@ -1585,7 +1594,7 @@ location ^~ {from} {
|
||||
add_header Cache-Control no-cache;
|
||||
}
|
||||
}
|
||||
# PROXY-END/
|
||||
#PROXY-END/
|
||||
"""
|
||||
|
||||
# replace
|
||||
@@ -1829,13 +1838,13 @@ location ^~ {from} {
|
||||
logPath = mw.getLogsDir() + '/' + siteName + '.log'
|
||||
if not os.path.exists(logPath):
|
||||
return mw.returnJson(False, '日志为空')
|
||||
return mw.returnJson(True, mw.getNumLines(logPath, 100))
|
||||
return mw.returnJson(True, mw.getLastLine(logPath, 100))
|
||||
|
||||
def getErrorLogs(self, siteName):
|
||||
logPath = mw.getLogsDir() + '/' + siteName + '.error.log'
|
||||
if not os.path.exists(logPath):
|
||||
return mw.returnJson(False, '日志为空')
|
||||
return mw.returnJson(True, mw.getNumLines(logPath, 100))
|
||||
return mw.returnJson(True, mw.getLastLine(logPath, 100))
|
||||
|
||||
# 取日志状态
|
||||
def getLogsStatus(self, siteName):
|
||||
@@ -2094,12 +2103,16 @@ location ^~ {from} {
|
||||
return rewriteList
|
||||
|
||||
def createRootDir(self, path):
|
||||
autoInit = False
|
||||
if not os.path.exists(path):
|
||||
autoInit = True
|
||||
os.makedirs(path)
|
||||
if not mw.isAppleSystem():
|
||||
mw.execShell('chown -R www:www ' + path)
|
||||
mw.writeFile(path + '/index.html', 'Work has started!!!')
|
||||
mw.execShell('chmod -R 755 ' + path)
|
||||
|
||||
if autoInit:
|
||||
mw.writeFile(path + '/index.html', 'Work has started!!!')
|
||||
mw.execShell('chmod -R 755 ' + path)
|
||||
|
||||
def nginxAddDomain(self, webname, domain, port):
|
||||
file = self.getHostConf(webname)
|
||||
@@ -2182,19 +2195,16 @@ location ^~ {from} {
|
||||
return mw.returnJson(False, '您添加的域名已存在!')
|
||||
mw.M('domain').where('pid=?', (opid,)).delete()
|
||||
|
||||
self.createRootDir(self.sitePath)
|
||||
self.nginxAddConf()
|
||||
|
||||
# 添加更多域名
|
||||
for domain in siteMenu['domainlist']:
|
||||
sdomain = domain
|
||||
swebname = self.siteName
|
||||
spid = str(pid)
|
||||
self.addDomain(domain, webname, pid)
|
||||
self.addDomain(domain, self.siteName, pid)
|
||||
|
||||
mw.M('domain').add('pid,name,port,addtime',
|
||||
(pid, self.siteName, self.sitePort, mw.getDate()))
|
||||
|
||||
self.createRootDir(self.sitePath)
|
||||
self.nginxAddConf()
|
||||
|
||||
data = {}
|
||||
data['siteStatus'] = False
|
||||
mw.restartWeb()
|
||||
@@ -2350,7 +2360,9 @@ location ^~ {from} {
|
||||
return True
|
||||
|
||||
# 设置目录防御
|
||||
def setDirUserINI(self, newPath):
|
||||
def setDirUserINI(self, sitePath, runPath):
|
||||
newPath = sitePath + runPath
|
||||
|
||||
filename = newPath + '/.user.ini'
|
||||
if os.path.exists(filename):
|
||||
mw.execShell("chattr -i " + filename)
|
||||
@@ -2358,8 +2370,11 @@ location ^~ {from} {
|
||||
return mw.returnJson(True, '已清除防跨站设置!')
|
||||
|
||||
self.delUserInI(newPath)
|
||||
mw.writeFile(filename, 'open_basedir=' +
|
||||
newPath + '/:/www/server/php:/tmp/:/proc/')
|
||||
openPath = 'open_basedir={}/:{}/'.format(newPath, sitePath)
|
||||
if runPath == '/':
|
||||
openPath = 'open_basedir={}/'.format(sitePath)
|
||||
|
||||
mw.writeFile(filename, openPath + ':/www/server/php:/tmp/:/proc/')
|
||||
mw.execShell("chattr +i " + filename)
|
||||
|
||||
return mw.returnJson(True, '已打开防跨站设置!')
|
||||
|
||||
@@ -162,7 +162,7 @@ class system_api:
|
||||
except:
|
||||
port = mw.readFile('data/port.pl')
|
||||
except:
|
||||
port = '8888'
|
||||
port = '7200'
|
||||
domain = ''
|
||||
if os.path.exists('data/domain.conf'):
|
||||
domain = mw.readFile('data/domain.conf')
|
||||
@@ -201,9 +201,9 @@ class system_api:
|
||||
def getLoadAverage(self):
|
||||
c = os.getloadavg()
|
||||
data = {}
|
||||
data['one'] = float(c[0])
|
||||
data['five'] = float(c[1])
|
||||
data['fifteen'] = float(c[2])
|
||||
data['one'] = round(float(c[0]), 2)
|
||||
data['five'] = round(float(c[1]), 2)
|
||||
data['fifteen'] = round(float(c[2]), 2)
|
||||
data['max'] = psutil.cpu_count() * 2
|
||||
data['limit'] = data['max']
|
||||
data['safe'] = data['max'] * 0.75
|
||||
@@ -276,8 +276,17 @@ class system_api:
|
||||
def getCpuInfo(self, interval=1):
|
||||
# 取CPU信息
|
||||
cpuCount = psutil.cpu_count()
|
||||
cpuLogicalNum = psutil.cpu_count(logical=False)
|
||||
used = psutil.cpu_percent(interval=interval)
|
||||
return used, cpuCount
|
||||
|
||||
if os.path.exists('/proc/cpuinfo'):
|
||||
c_tmp = mw.readFile('/proc/cpuinfo')
|
||||
d_tmp = re.findall("physical id.+", c_tmp)
|
||||
cpuLogicalNum = len(set(d_tmp))
|
||||
|
||||
used_all = psutil.cpu_percent(percpu=True)
|
||||
cpu_name = mw.getCpuType() + " * {}".format(cpuLogicalNum)
|
||||
return used, cpuCount, used_all, cpu_name, cpuCount, cpuLogicalNum
|
||||
|
||||
def getMemInfo(self):
|
||||
# 取内存信息
|
||||
|
||||
@@ -13,7 +13,7 @@ service mw [start|stop|reload|restart|status]
|
||||
|
||||
```
|
||||
|
||||
sytemctl [start|stop|reload|restart|status] openresty
|
||||
systemctl [start|stop|reload|restart|status] openresty
|
||||
|
||||
```
|
||||
|
||||
@@ -21,7 +21,7 @@ sytemctl [start|stop|reload|restart|status] openresty
|
||||
|
||||
```
|
||||
|
||||
sytemctl [start|stop|reload|restart|status] mysql
|
||||
systemctl [start|stop|reload|restart|status] mysql
|
||||
|
||||
```
|
||||
|
||||
@@ -29,7 +29,7 @@ sytemctl [start|stop|reload|restart|status] mysql
|
||||
|
||||
```
|
||||
|
||||
sytemctl [start|stop|reload|restart|status] mariadb
|
||||
systemctl [start|stop|reload|restart|status] mariadb
|
||||
|
||||
```
|
||||
|
||||
@@ -37,16 +37,16 @@ sytemctl [start|stop|reload|restart|status] mariadb
|
||||
|
||||
```
|
||||
|
||||
sytemctl [start|stop|reload|restart|status] php[54-81]
|
||||
systemctl [start|stop|reload|restart|status] php[54-81]
|
||||
|
||||
sytemctl start php71
|
||||
systemctl start php71
|
||||
```
|
||||
|
||||
- Redis
|
||||
|
||||
```
|
||||
|
||||
sytemctl [start|stop|reload|restart|status] redis
|
||||
systemctl [start|stop|reload|restart|status] redis
|
||||
|
||||
```
|
||||
|
||||
@@ -54,7 +54,7 @@ sytemctl [start|stop|reload|restart|status] redis
|
||||
|
||||
```
|
||||
|
||||
sytemctl [start|stop|reload|restart|status] memcached
|
||||
systemctl [start|stop|reload|restart|status] memcached
|
||||
|
||||
```
|
||||
|
||||
@@ -63,6 +63,6 @@ sytemctl [start|stop|reload|restart|status] memcached
|
||||
|
||||
```
|
||||
|
||||
sytemctl [start|stop|reload|restart|status] sphinx
|
||||
systemctl [start|stop|reload|restart|status] sphinx
|
||||
|
||||
```
|
||||
|
||||
@@ -46,10 +46,9 @@ CREATE TABLE IF NOT EXISTS `firewall` (
|
||||
|
||||
INSERT INTO `firewall` (`id`, `port`, `ps`, `addtime`) VALUES
|
||||
(1, '80', '网站默认端口', '0000-00-00 00:00:00'),
|
||||
(2, '7200', 'WEB面板', '0000-00-00 00:00:00'),
|
||||
(3, '22', 'SSH远程管理服务', '0000-00-00 00:00:00'),
|
||||
(4, '888', 'phpMyAdmin默认端口', '0000-00-00 00:00:00'),
|
||||
(5, '443', 'HTTPS', '0000-00-00 00:00:00');
|
||||
(2, '22', 'SSH远程管理服务', '0000-00-00 00:00:00'),
|
||||
(3, '443', 'HTTPS', '0000-00-00 00:00:00'),
|
||||
(4, '888', 'phpMyAdmin默认端口', '0000-00-00 00:00:00');
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -240,7 +240,12 @@ def pMysqlDb(conf):
|
||||
|
||||
db.setPort(int(host[1]))
|
||||
db.setUser(conf['USER'])
|
||||
db.setPwd(conf['PASSWD'])
|
||||
|
||||
if 'PASSWD' in conf:
|
||||
db.setPwd(conf['PASSWD'])
|
||||
else:
|
||||
db.setPwd(conf['PASSWORD'])
|
||||
|
||||
db.setDbName(conf['NAME'])
|
||||
# db.setSocket(getSocketFile())
|
||||
db.setCharset("utf8")
|
||||
@@ -681,12 +686,7 @@ def getTotalStatistics():
|
||||
data = {}
|
||||
if st.strip() == 'start':
|
||||
list_count = pQuery('select count(id) as num from repository')
|
||||
|
||||
if list_count.find("error") > -1:
|
||||
data['status'] = False
|
||||
data['count'] = 0
|
||||
return mw.returnJson(False, 'fail', data)
|
||||
|
||||
count = list_count[0]["num"]
|
||||
data['status'] = True
|
||||
data['count'] = count
|
||||
data['ver'] = mw.readFile(getServerDir() + '/version.pl').strip()
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
Executable
BIN
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
Executable
+20
@@ -0,0 +1,20 @@
|
||||
<div class="bt-form">
|
||||
<div class="bt-w-main">
|
||||
<div class="bt-w-menu">
|
||||
<p class="bgw" onclick="pluginService('imail');">服务</p>
|
||||
<p onclick="pluginInitD('imail');">自启动</p>
|
||||
<p onclick="pluginConfig('imail',null, 'conf');">配置文件</p>
|
||||
<p onclick="pluginLogs('imail',null,'run_log', 50);">运行日志</p>
|
||||
</div>
|
||||
<div class="bt-w-con pd15">
|
||||
<div class="soft-man-con"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$.getScript( "/plugins/file?name=imail&f=js/imail.js", function(){
|
||||
mail.init();
|
||||
pluginService('imail');
|
||||
});
|
||||
</script>
|
||||
Executable
+218
@@ -0,0 +1,218 @@
|
||||
# coding:utf-8
|
||||
|
||||
import sys
|
||||
import io
|
||||
import os
|
||||
import time
|
||||
import re
|
||||
import socket
|
||||
import json
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
import mw
|
||||
|
||||
app_debug = False
|
||||
if mw.isAppleSystem():
|
||||
app_debug = True
|
||||
|
||||
|
||||
class App:
|
||||
__setupPath = '/www/server/imail'
|
||||
__SR = ''
|
||||
|
||||
def __init__(self):
|
||||
self.__setupPath = self.getServerDir()
|
||||
|
||||
self.__SR = '''#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
export USER=%s
|
||||
export HOME=%s && ''' % ( self.getRunUser(), self.getHomeDir())
|
||||
|
||||
def getArgs(self):
|
||||
args = sys.argv[3:]
|
||||
tmp = {}
|
||||
args_len = len(args)
|
||||
|
||||
if args_len == 1:
|
||||
t = args[0].strip('{').strip('}')
|
||||
t = t.split(':')
|
||||
tmp[t[0]] = t[1]
|
||||
elif args_len > 1:
|
||||
for i in range(len(args)):
|
||||
t = args[i].split(':')
|
||||
tmp[t[0]] = t[1]
|
||||
|
||||
return tmp
|
||||
|
||||
def __release_port(self, port):
|
||||
from collections import namedtuple
|
||||
try:
|
||||
import firewall_api
|
||||
firewall_api.firewall_api().addAcceptPortArgs(port, 'IMail-Server', 'port')
|
||||
return port
|
||||
except Exception as e:
|
||||
return "Release failed {}".format(e)
|
||||
|
||||
def openPort(self):
|
||||
for i in ["25", "110", "143", "465", "995", "993", "587"]:
|
||||
self.__release_port(i)
|
||||
return True
|
||||
|
||||
def getPluginName(self):
|
||||
return 'imail'
|
||||
|
||||
def getPluginDir(self):
|
||||
return mw.getPluginDir() + '/' + self.getPluginName()
|
||||
|
||||
def getServerDir(self):
|
||||
return mw.getServerDir() + '/' + self.getPluginName()
|
||||
|
||||
def getInitdConfTpl(self):
|
||||
path = self.getPluginDir() + "/init.d/imail.tpl"
|
||||
return path
|
||||
|
||||
def getHomeDir(self):
|
||||
if mw.isAppleSystem():
|
||||
user = mw.execShell(
|
||||
"who | sed -n '2, 1p' |awk '{print $1}'")[0].strip()
|
||||
return '/Users/' + user
|
||||
else:
|
||||
return '/root'
|
||||
|
||||
def getRunUser(self):
|
||||
if mw.isAppleSystem():
|
||||
user = mw.execShell(
|
||||
"who | sed -n '2, 1p' |awk '{print $1}'")[0].strip()
|
||||
return user
|
||||
else:
|
||||
return 'root'
|
||||
|
||||
def status(self):
|
||||
data = mw.execShell(
|
||||
"ps -ef|grep " + self.getPluginName() + " |grep -v grep | grep -v python | awk '{print $2}'")
|
||||
if data[0] == '':
|
||||
return 'stop'
|
||||
return 'start'
|
||||
|
||||
def contentReplace(self, content):
|
||||
|
||||
service_path = mw.getServerDir()
|
||||
content = content.replace('{$ROOT_PATH}', mw.getRootDir())
|
||||
content = content.replace('{$SERVER_PATH}', service_path)
|
||||
content = content.replace('{$RUN_USER}', self.getRunUser())
|
||||
content = content.replace('{$HOME_DIR}', self.getHomeDir())
|
||||
|
||||
return content
|
||||
|
||||
def initDreplace(self):
|
||||
|
||||
file_tpl = self.getInitdConfTpl()
|
||||
service_path = mw.getServerDir()
|
||||
|
||||
initD_path = self.getServerDir() + '/init.d'
|
||||
if not os.path.exists(initD_path):
|
||||
os.mkdir(initD_path)
|
||||
self.openPort()
|
||||
|
||||
file_bin = initD_path + '/' + self.getPluginName()
|
||||
|
||||
if not os.path.exists(file_bin):
|
||||
content = mw.readFile(file_tpl)
|
||||
content = self.contentReplace(content)
|
||||
mw.writeFile(file_bin, content)
|
||||
mw.execShell('chmod +x ' + file_bin)
|
||||
|
||||
# systemd
|
||||
systemDir = mw.systemdCfgDir()
|
||||
systemService = systemDir + '/imail.service'
|
||||
systemServiceTpl = self.getPluginDir() + '/init.d/imail.service.tpl'
|
||||
if os.path.exists(systemDir) and not os.path.exists(systemService):
|
||||
service_path = mw.getServerDir()
|
||||
se_content = mw.readFile(systemServiceTpl)
|
||||
se_content = se_content.replace('{$SERVER_PATH}', service_path)
|
||||
mw.writeFile(systemService, se_content)
|
||||
mw.execShell('systemctl daemon-reload')
|
||||
|
||||
log_path = self.getServerDir() + '/logs'
|
||||
if not os.path.exists(log_path):
|
||||
os.mkdir(log_path)
|
||||
|
||||
return file_bin
|
||||
|
||||
def imOp(self, method):
|
||||
file = self.initDreplace()
|
||||
|
||||
if not mw.isAppleSystem():
|
||||
cmd = 'systemctl {} {}'.format(method, self.getPluginName())
|
||||
data = mw.execShell(cmd)
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return 'fail'
|
||||
|
||||
data = mw.execShell(self.__SR + file + ' ' + method)
|
||||
if data[1] == '':
|
||||
return 'ok'
|
||||
return data[0]
|
||||
|
||||
def start(self):
|
||||
return self.imOp('start')
|
||||
|
||||
def stop(self):
|
||||
return self.imOp('stop')
|
||||
|
||||
def restart(self):
|
||||
return self.imOp('restart')
|
||||
|
||||
def reload(self):
|
||||
return self.imOp('reload')
|
||||
|
||||
def initd_status(self):
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
cmd = 'systemctl status imail | grep loaded | grep "enabled;"'
|
||||
data = mw.execShell(cmd)
|
||||
if data[0] == '':
|
||||
return 'fail'
|
||||
return 'ok'
|
||||
|
||||
def initd_install(self):
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
mw.execShell('systemctl enable imail')
|
||||
return 'ok'
|
||||
|
||||
def initd_uinstall(self):
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
mw.execShell('systemctl disable imail')
|
||||
return 'ok'
|
||||
|
||||
def conf(self):
|
||||
conf_path = self.getServerDir() + '/custom/conf/app.conf'
|
||||
if not os.path.exists(conf_path):
|
||||
return mw.returnJson(False, "请先安装初始化!<br/>默认地址:http://" + mw.getLocalIp() + ":1080")
|
||||
|
||||
return self.getServerDir() + '/custom/conf/app.conf'
|
||||
|
||||
def run_log(self):
|
||||
ilog = self.getServerDir() + '/logs/imail.log'
|
||||
if not os.path.exists(ilog):
|
||||
return mw.returnJson(False, "请先安装初始化!<br/>默认地址:http://" + mw.getLocalIp() + ":1080")
|
||||
|
||||
return self.getServerDir() + '/logs/imail.log'
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
func = sys.argv[1]
|
||||
classApp = App()
|
||||
try:
|
||||
data = eval("classApp." + func + "()")
|
||||
print(data)
|
||||
except Exception as e:
|
||||
print('error:' + str(e))
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"sort": 7,
|
||||
"ps": "简单邮件服务[DEV]",
|
||||
"name": "imail",
|
||||
"title": "邮件服务",
|
||||
"shell": "install.sh",
|
||||
"versions":["0.0.17"],
|
||||
"updates":["0.0.17"],
|
||||
"tip": "soft",
|
||||
"checks": "server/imail",
|
||||
"path": "server/imail",
|
||||
"display": 1,
|
||||
"author": "midoks",
|
||||
"date": "2022-09-26",
|
||||
"home": "https://github.com/midoks/mdserver-web",
|
||||
"type": 0,
|
||||
"pid": "5"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Imail Simple Mail Server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart={$SERVER_PATH}/imail/init.d/imail start
|
||||
ExecStop={$SERVER_PATH}/imail/init.d/imail stop
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,89 @@
|
||||
#!/bin/bash
|
||||
# chkconfig: 2345 55 25
|
||||
# description: Imail Service
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: bt
|
||||
# Required-Start: $all
|
||||
# Required-Stop: $all
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: starts Imail
|
||||
# Description: starts the Imail
|
||||
### END INIT INFO
|
||||
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
|
||||
# Source function library.
|
||||
if [ -f /etc/init.d/functions ];then
|
||||
. /etc/init.d/functions
|
||||
fi
|
||||
|
||||
if [ -f /etc/rc.d/init.d/functions ];then
|
||||
. /etc/rc.d/init.d/functions
|
||||
fi
|
||||
|
||||
app_path={$SERVER_PATH}/imail
|
||||
SERVICENAME="imail"
|
||||
|
||||
im_start(){
|
||||
isStart=`ps -ef|grep 'imail service' |grep -v grep|awk '{print $2}'`
|
||||
if [ "$isStart" == '' ];then
|
||||
echo -e "Starting imail... \c"
|
||||
cd $app_path && ${app_path}/imail service &
|
||||
isStart=""
|
||||
while [[ "$isStart" == "" ]];
|
||||
do
|
||||
echo -e ".\c"
|
||||
sleep 0.5
|
||||
isStart=$(lsof -n -P -i:25|grep LISTEN|grep -v grep|awk '{print $2}'|xargs)
|
||||
let n+=1
|
||||
if [ $n -gt 15 ];then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
if [ "$isStart" == '' ];then
|
||||
echo -e "\033[31mfailed\033[0m"
|
||||
echo '------------------------------------------------------'
|
||||
tail -n 20 ${app_path}/logs/run_away.log
|
||||
echo '------------------------------------------------------'
|
||||
echo -e "\033[31mError: ${SERVICENAME} service startup failed.\033[0m"
|
||||
return;
|
||||
fi
|
||||
echo -e "\033[32mdone\033[0m"
|
||||
else
|
||||
echo "Starting ${SERVICENAME}(pid $(echo $isStart)) already running"
|
||||
fi
|
||||
}
|
||||
|
||||
im_stop(){
|
||||
pids=`ps -ef|grep 'imail service' |grep -v grep|awk '{print $2}'`
|
||||
arr=($pids)
|
||||
echo -e "Stopping ${SERVICENAME}... \c"
|
||||
for p in ${arr[@]}
|
||||
do
|
||||
kill -9 $p
|
||||
done
|
||||
echo -e "\033[32mdone\033[0m"
|
||||
}
|
||||
|
||||
im_status(){
|
||||
isStart=`ps -ef|grep 'imail service' |grep -v grep|awk '{print $2}'`
|
||||
if [ "$isStart" == '' ];then
|
||||
echo -e "${SERVICENAME} not running"
|
||||
else
|
||||
echo -e "${SERVICENAME}(pid $(echo $isStart)) already running"
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
'start') im_start;;
|
||||
'stop') im_stop;;
|
||||
'status') im_status;;
|
||||
'reload')
|
||||
im_stop
|
||||
im_start;;
|
||||
'restart')
|
||||
im_stop
|
||||
im_start;;
|
||||
esac
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
action=$1
|
||||
type=$2
|
||||
|
||||
if [ "${2}" == "" ];then
|
||||
echo '缺少安装脚本...' > $install_tmp
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -d $curPath/versions/$2 ];then
|
||||
echo '缺少安装脚本2...' > $install_tmp
|
||||
exit 0
|
||||
fi
|
||||
|
||||
sh -x $curPath/versions/$2/install.sh $1
|
||||
Executable
+95
@@ -0,0 +1,95 @@
|
||||
var mail = {
|
||||
plugin_name: 'imail',
|
||||
init: function () {
|
||||
var _this = this;
|
||||
},
|
||||
|
||||
str2Obj:function(str){
|
||||
var data = {};
|
||||
kv = str.split('&');
|
||||
for(i in kv){
|
||||
v = kv[i].split('=');
|
||||
data[v[0]] = v[1];
|
||||
}
|
||||
return data;
|
||||
},
|
||||
|
||||
send:function(info){
|
||||
var tips = info['tips'];
|
||||
var method = info['method'];
|
||||
var args = info['data'];
|
||||
var callback = info['success'];
|
||||
|
||||
var loadT = layer.msg(tips, { icon: 16, time: 0, shade: 0.3 });
|
||||
|
||||
var data = {};
|
||||
data['name'] = 'mail';
|
||||
data['func'] = method;
|
||||
data['version'] = $('.plugin_version').attr('version');
|
||||
|
||||
if (typeof(args) == 'string'){
|
||||
data['args'] = JSON.stringify(this.str2Obj(args));
|
||||
} else {
|
||||
data['args'] = JSON.stringify(args);
|
||||
}
|
||||
|
||||
$.post('/plugins/run', data, function(res) {
|
||||
layer.close(loadT);
|
||||
if (!res.status){
|
||||
layer.msg(res.msg,{icon:2,time:10000});
|
||||
return;
|
||||
}
|
||||
|
||||
var ret_data = $.parseJSON(res.data);
|
||||
console.log("send:",ret_data);
|
||||
// if (!ret_data.status){
|
||||
// layer.msg(ret_data.msg,{icon:2,time:2000});
|
||||
// return;
|
||||
// }
|
||||
|
||||
// console.log("send2:",ret_data);
|
||||
|
||||
if(typeof(callback) == 'function'){
|
||||
callback(ret_data);
|
||||
}
|
||||
},'json');
|
||||
},
|
||||
postCallback:function(info){
|
||||
var tips = info['tips'];
|
||||
var method = info['method'];
|
||||
var args = info['data'];
|
||||
var callback = info['success'];
|
||||
|
||||
var loadT = layer.msg(tips, { icon: 16, time: 0, shade: 0.3 });
|
||||
|
||||
var data = {};
|
||||
data['name'] = 'mail';
|
||||
data['func'] = method;
|
||||
data['version'] = $('.plugin_version').attr('version');
|
||||
|
||||
if (typeof(args) == 'string'){
|
||||
data['args'] = JSON.stringify(this.str2Obj(args));
|
||||
} else {
|
||||
data['args'] = JSON.stringify(args);
|
||||
}
|
||||
|
||||
$.post('/plugins/callback', data, function(res) {
|
||||
|
||||
layer.close(loadT);
|
||||
if (!res.status){
|
||||
layer.msg(res.msg,{icon:2,time:10000});
|
||||
return;
|
||||
}
|
||||
|
||||
var ret_data = $.parseJSON(res.data);
|
||||
if (!ret_data.status){
|
||||
layer.msg(ret_data.msg,{icon:2,time:2000});
|
||||
return;
|
||||
}
|
||||
|
||||
if(typeof(callback) == 'function'){
|
||||
callback(res);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
}
|
||||
Executable
+109
@@ -0,0 +1,109 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
VERSION=0.0.17
|
||||
|
||||
# bash install.sh install 0.0.16
|
||||
## cd /www/server/mdserver-web/plugins/imail && bash install.sh install 0.0.16
|
||||
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
OSNAME_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
|
||||
ARCH="amd64"
|
||||
|
||||
get_arch() {
|
||||
|
||||
TMP_ARCH=`arch`
|
||||
if [ "$TMP_ARCH" == "x86_64" ];then
|
||||
ARCH="amd64"
|
||||
fi
|
||||
}
|
||||
|
||||
load_vars() {
|
||||
OS=$(uname | tr '[:upper:]' '[:lower:]')
|
||||
TARGET_DIR="$serverPath/imail"
|
||||
}
|
||||
|
||||
get_download_url() {
|
||||
DOWNLOAD_URL="https://github.com/midoks/imail/releases/download/$VERSION/imail_${VERSION}_${OS}_${ARCH}.tar.gz"
|
||||
}
|
||||
|
||||
# download file
|
||||
download_file() {
|
||||
url="${1}"
|
||||
destination="${2}"
|
||||
|
||||
printf "Fetching ${url} \n\n"
|
||||
|
||||
if test -x "$(command -v curl)"; then
|
||||
code=$(curl --connect-timeout 15 -w '%{http_code}' -L "${url}" -o "${destination}")
|
||||
elif test -x "$(command -v wget)"; then
|
||||
code=$(wget -t2 -T15 -O "${destination}" --server-response "${url}" 2>&1 | awk '/^ HTTP/{print $2}' | tail -1)
|
||||
else
|
||||
printf "\e[1;31mNeither curl nor wget was available to perform http requests.\e[0m\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "${code}" != 200 ]; then
|
||||
printf "\e[1;31mRequest failed with code %s\e[0m\n" $code
|
||||
exit 1
|
||||
else
|
||||
printf "\n\e[1;33mDownload succeeded\e[0m\n"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Install_App()
|
||||
{
|
||||
echo '正在安装脚本文件...' > $install_tmp
|
||||
mkdir -p $serverPath/source
|
||||
|
||||
load_vars
|
||||
get_arch
|
||||
get_download_url
|
||||
|
||||
DOWNLOAD_FILE="$(mktemp).tar.gz"
|
||||
download_file $DOWNLOAD_URL $DOWNLOAD_FILE
|
||||
|
||||
if [ ! -d "$TARGET_DIR" ]; then
|
||||
mkdir -p "$TARGET_DIR"
|
||||
fi
|
||||
|
||||
tar -C "$TARGET_DIR" -zxf $DOWNLOAD_FILE
|
||||
rm -rf $DOWNLOAD_FILE
|
||||
|
||||
pushd "$TARGET_DIR/scripts" >/dev/null 2>&1
|
||||
bash make.sh
|
||||
|
||||
if [ -d $serverPath/imail ];then
|
||||
echo "$VERSION" > $serverPath/imail/version.pl
|
||||
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/imail/index.py start
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/imail/index.py initd_install
|
||||
fi
|
||||
echo 'install successful' > $install_tmp
|
||||
}
|
||||
|
||||
Uninstall_App()
|
||||
{
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/imail/index.py initd_uninstall
|
||||
cd ${rootPath} && python3 ${rootPath}/plugins/imail/index.py stop
|
||||
rm -rf $serverPath/imail
|
||||
echo "install fail" > $install_tmp
|
||||
}
|
||||
|
||||
action=$1
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_App
|
||||
else
|
||||
Uninstall_App
|
||||
fi
|
||||
@@ -304,7 +304,7 @@ def getErrorLog():
|
||||
if 'close' in args:
|
||||
mw.writeFile(filename, '')
|
||||
return mw.returnJson(False, '日志已清空')
|
||||
info = mw.getNumLines(filename, 18)
|
||||
info = mw.getLastLine(filename, 18)
|
||||
return mw.returnJson(True, 'OK', info)
|
||||
|
||||
|
||||
@@ -343,6 +343,7 @@ def initMariaDbPwd():
|
||||
time.sleep(5)
|
||||
|
||||
serverdir = getServerDir()
|
||||
myconf = serverdir + "/etc/my.cnf"
|
||||
pwd = mw.getRandomString(16)
|
||||
|
||||
db_option = "-S " + serverdir + "/mysql.sock"
|
||||
@@ -363,6 +364,16 @@ def initMariaDbPwd():
|
||||
pwd + ' -e "drop database test";'
|
||||
mw.execShell(drop_test_db)
|
||||
|
||||
# 删除冗余账户
|
||||
hostname = mw.execShell('hostname')[0].strip()
|
||||
drop_hostname = serverdir + '/bin/mysql --defaults-file=' + \
|
||||
myconf + ' -uroot -p' + pwd + ' -e "drop user \'\'@\'' + hostname + '\'";'
|
||||
mw.execShell(drop_hostname)
|
||||
|
||||
drop_root_hostname = serverdir + '/bin/mysql --defaults-file=' + \
|
||||
myconf + ' -uroot -p' + pwd + ' -e "drop user \'root\'@\'' + hostname + '\'";'
|
||||
mw.execShell(drop_root_hostname)
|
||||
|
||||
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))
|
||||
return True
|
||||
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
[client]
|
||||
user = root
|
||||
#password = your_password
|
||||
port = 3306
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
|
||||
[mysqld]
|
||||
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf
|
||||
|
||||
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
|
||||
user = mysql
|
||||
port = 3306
|
||||
socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
basedir = {$SERVER_APP_PATH}
|
||||
datadir = {$SERVER_APP_PATH}/data
|
||||
log-error = {$SERVER_APP_PATH}/data/error.log
|
||||
server-id = {$SERVER_ID}
|
||||
|
||||
default_storage_engine = InnoDB
|
||||
|
||||
key_buffer_size = 8M
|
||||
max_allowed_packet = 100M
|
||||
|
||||
table_open_cache = 32
|
||||
sort_buffer_size = 256K
|
||||
net_buffer_length = 4K
|
||||
read_buffer_size = 128K
|
||||
read_rnd_buffer_size = 256K
|
||||
myisam_sort_buffer_size = 4M
|
||||
thread_cache_size = 4
|
||||
lower_case_table_names=0
|
||||
query_cache_size = 4M
|
||||
tmp_table_size = 8M
|
||||
|
||||
max_connections = 500
|
||||
max_connect_errors = 100
|
||||
open_files_limit = 65535
|
||||
|
||||
skip-name-resolve=1
|
||||
#skip-grant-tables
|
||||
#skip-networking
|
||||
#skip-external-locking
|
||||
#loose-skip-innodb
|
||||
|
||||
log-bin=mysql-bin
|
||||
binlog_format=mixed
|
||||
slow_query_log=1
|
||||
slow-query-log-file={$SERVER_APP_PATH}/data/mysql-slow.log
|
||||
long_query_time=10
|
||||
#log_queries_not_using_indexes=on
|
||||
#log_slow_admin_statements=1
|
||||
#log_slow_slave_statements=1
|
||||
expire_logs_days=30
|
||||
|
||||
relay-log=mdserver
|
||||
relay-log-index=mdserver
|
||||
|
||||
#master
|
||||
#binlog-do-db
|
||||
binlog-ignore-db = test
|
||||
binlog-ignore-db = mysql
|
||||
binlog-ignore-db = information_schema
|
||||
binlog-ignore-db = performance_schema
|
||||
|
||||
#slave
|
||||
log-slave-updates = 1
|
||||
skip-slave-start = 1
|
||||
#replicate-do-db
|
||||
replicate-ignore-db = information_schema
|
||||
replicate-ignore-db = performance_schema
|
||||
replicate-ignore-db = mysql
|
||||
replicate-ignore-db = test
|
||||
|
||||
|
||||
innodb_data_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_data_file_path = ibdata1:10M:autoextend
|
||||
innodb_log_group_home_dir = {$SERVER_APP_PATH}/data
|
||||
innodb_buffer_pool_size = 16M
|
||||
innodb_additional_mem_pool_size = 2M
|
||||
innodb_log_file_size = 5M
|
||||
innodb_log_buffer_size = 8M
|
||||
innodb_flush_log_at_trx_commit = 2
|
||||
innodb_lock_wait_timeout = 120
|
||||
innodb_max_dirty_pages_pct = 90
|
||||
innodb_read_io_threads = 1
|
||||
innodb_write_io_threads = 1
|
||||
innodb_file_per_table=1
|
||||
innodb_large_prefix = 1
|
||||
|
||||
|
||||
secure-file-priv={$SERVER_APP_PATH}/tmp
|
||||
|
||||
[mysqldump]
|
||||
quick
|
||||
max_allowed_packet = 16M
|
||||
|
||||
[mysql]
|
||||
no-auto-rehash
|
||||
|
||||
[myisamchk]
|
||||
key_buffer_size = 20M
|
||||
sort_buffer_size = 20M
|
||||
read_buffer = 2M
|
||||
write_buffer = 2M
|
||||
|
||||
[mysqlhotcopy]
|
||||
interactive-timeout
|
||||
@@ -7,8 +7,8 @@ socket = {$SERVER_APP_PATH}/mysql.sock
|
||||
[mysqld]
|
||||
!include {$SERVER_APP_PATH}/etc/mode/classic.cnf
|
||||
|
||||
;sha256_password_private_key_path=mysql.pem
|
||||
;sha256_password_public_key_path=mysql.pub
|
||||
sha256_password_private_key_path=mysql.pem
|
||||
sha256_password_public_key_path=mysql.pub
|
||||
|
||||
pid-file = {$SERVER_APP_PATH}/data/mysql.pid
|
||||
user = mysql
|
||||
+25
-2
@@ -333,7 +333,7 @@ def getErrorLog():
|
||||
if 'close' in args:
|
||||
mw.writeFile(filename, '')
|
||||
return mw.returnJson(False, '日志已清空')
|
||||
info = mw.getNumLines(filename, 18)
|
||||
info = mw.getLastLine(filename, 18)
|
||||
return mw.returnJson(True, 'OK', info)
|
||||
|
||||
|
||||
@@ -404,6 +404,7 @@ def initMysqlPwd():
|
||||
time.sleep(5)
|
||||
|
||||
serverdir = getServerDir()
|
||||
myconf = serverdir + "/etc/my.cnf"
|
||||
pwd = mw.getRandomString(16)
|
||||
# cmd_pass = serverdir + '/bin/mysqladmin -uroot password ' + pwd
|
||||
|
||||
@@ -426,6 +427,17 @@ def initMysqlPwd():
|
||||
pwd + ' -e "drop database test";'
|
||||
mw.execShell(drop_test_db)
|
||||
|
||||
# 删除冗余账户
|
||||
hostname = mw.execShell('hostname')[0].strip()
|
||||
|
||||
drop_hostname = serverdir + '/bin/mysql --defaults-file=' + \
|
||||
myconf + ' -uroot -p' + pwd + ' -e "drop user \'\'@\'' + hostname + '\'";'
|
||||
mw.execShell(drop_hostname)
|
||||
|
||||
drop_root_hostname = serverdir + '/bin/mysql --defaults-file=' + \
|
||||
myconf + ' -uroot -p' + pwd + ' -e "drop user \'root\'@\'' + hostname + '\'";'
|
||||
mw.execShell(drop_root_hostname)
|
||||
|
||||
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))
|
||||
return True
|
||||
|
||||
@@ -468,6 +480,17 @@ def initMysql8Pwd():
|
||||
myconf + ' -uroot -p' + pwd + ' -e "drop database test";'
|
||||
mw.execShell(drop_test_db)
|
||||
|
||||
# 删除冗余账户
|
||||
hostname = mw.execShell('hostname')[0].strip()
|
||||
|
||||
drop_hostname = serverdir + '/bin/mysql --defaults-file=' + \
|
||||
myconf + ' -uroot -p' + pwd + ' -e "drop user \'\'@\'' + hostname + '\'";'
|
||||
mw.execShell(drop_hostname)
|
||||
|
||||
drop_root_hostname = serverdir + '/bin/mysql --defaults-file=' + \
|
||||
myconf + ' -uroot -p' + pwd + ' -e "drop user \'root\'@\'' + hostname + '\'";'
|
||||
mw.execShell(drop_root_hostname)
|
||||
|
||||
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))
|
||||
|
||||
return True
|
||||
@@ -475,7 +498,7 @@ def initMysql8Pwd():
|
||||
|
||||
def myOp(version, method):
|
||||
# import commands
|
||||
init_file = initDreplace()
|
||||
init_file = initDreplace(version)
|
||||
try:
|
||||
isInited = initMysqlData()
|
||||
if not isInited:
|
||||
|
||||
@@ -74,7 +74,7 @@ Install_mysql()
|
||||
OPENSSL_VERSION=`openssl version|awk '{print $2}'|awk -F '.' '{print $1}'`
|
||||
if [ "${OPENSSL_VERSION}" -ge "3" ];then
|
||||
#openssl version to high
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash openssl.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash openssl.sh
|
||||
export PKG_CONFIG_PATH=$serverPath/lib/openssl/lib/pkgconfig
|
||||
OPTIONS="-DWITH_SSL=${serverPath}/lib/openssl"
|
||||
fi
|
||||
|
||||
@@ -61,7 +61,7 @@ Install_mysql()
|
||||
fi
|
||||
# ----- cpu end ------
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/mysql/lib && /bin/bash rpcgen.sh
|
||||
cd ${rootPath}/plugins/mysql/lib && /bin/bash rpcgen.sh
|
||||
|
||||
if [ ! -f ${mysqlDir}/mysql-boost-${VERSION}.tar.gz ];then
|
||||
wget -O ${mysqlDir}/mysql-boost-${VERSION}.tar.gz --tries=3 https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-boost-${VERSION}.tar.gz
|
||||
@@ -89,7 +89,7 @@ Install_mysql()
|
||||
OPENSSL_VERSION=`openssl version|awk '{print $2}'|awk -F '.' '{print $1}'`
|
||||
if [ "${OPENSSL_VERSION}" -ge "3" ];then
|
||||
#openssl version to high
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash openssl.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash openssl.sh
|
||||
export PKG_CONFIG_PATH=$serverPath/lib/openssl/lib/pkgconfig
|
||||
OPTIONS="-DWITH_SSL=${serverPath}/lib/openssl"
|
||||
fi
|
||||
|
||||
@@ -95,7 +95,7 @@ Install_mysql()
|
||||
fi
|
||||
# ----- cpu end ------
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/mysql/lib && /bin/bash rpcgen.sh
|
||||
cd ${rootPath}/plugins/mysql/lib && /bin/bash rpcgen.sh
|
||||
|
||||
INSTALL_CMD=cmake
|
||||
# check cmake version
|
||||
@@ -132,7 +132,7 @@ Install_mysql()
|
||||
OPENSSL_VERSION=`openssl version|awk '{print $2}'|awk -F '.' '{print $1}'`
|
||||
if [ "${OPENSSL_VERSION}" -ge "3" ];then
|
||||
#openssl version to high
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash openssl.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash openssl.sh
|
||||
export PKG_CONFIG_PATH=$serverPath/lib/openssl/lib/pkgconfig
|
||||
OPTIONS="-DWITH_SSL=${serverPath}/lib/openssl"
|
||||
fi
|
||||
|
||||
@@ -13,7 +13,10 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- <script type="text/javascript" src="/plugins/file?name=openresty&f=js/openresty.js"></script> -->
|
||||
<script type="text/javascript">
|
||||
|
||||
$.getScript( "/plugins/file?name=openresty&f=js/openresty.js", function(){
|
||||
orPluginService('openresty');
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@ import sys
|
||||
import io
|
||||
import os
|
||||
import time
|
||||
import threading
|
||||
import subprocess
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
@@ -216,6 +217,33 @@ def restyOp(method):
|
||||
return data[1]
|
||||
|
||||
|
||||
def op_submit_systemctl_restart():
|
||||
mw.execShell('systemctl restart openresty')
|
||||
|
||||
|
||||
def op_submit_init_restart(file):
|
||||
mw.execShell(file + ' restart')
|
||||
|
||||
|
||||
def restyOp_restart():
|
||||
file = initDreplace()
|
||||
|
||||
# 启动时,先检查一下配置文件
|
||||
check = getServerDir() + "/bin/openresty -t"
|
||||
check_data = mw.execShell(check)
|
||||
if not check_data[1].find('test is successful') > -1:
|
||||
return check_data[1]
|
||||
|
||||
if not mw.isAppleSystem():
|
||||
threading.Timer(2, op_submit_systemctl_restart, args=()).start()
|
||||
# submit_restart1()
|
||||
return 'ok'
|
||||
|
||||
threading.Timer(2, op_submit_init_restart, args=(file,)).start()
|
||||
# submit_restart2(file)
|
||||
return 'ok'
|
||||
|
||||
|
||||
def start():
|
||||
return restyOp('start')
|
||||
|
||||
@@ -225,7 +253,7 @@ def stop():
|
||||
|
||||
|
||||
def restart():
|
||||
return restyOp('restart')
|
||||
return restyOp_restart()
|
||||
|
||||
|
||||
def reload():
|
||||
|
||||
@@ -24,7 +24,6 @@ else
|
||||
useradd -g www -s /bin/bash www
|
||||
fi
|
||||
|
||||
# cd /www/server/mdserver-web/plugins/openresty && /bin/bash install.sh install 1.21.4.1
|
||||
Install_openresty()
|
||||
{
|
||||
# ----- cpu start ------
|
||||
|
||||
@@ -36,14 +36,14 @@ function orPluginSetService(_name ,status, version){
|
||||
(status?'#20a53a;':'red;')+
|
||||
' margin-left: 3px;" class="glyphicon ' + (status?'glyphicon glyphicon-play':'glyphicon-pause')+'"></span></p><div class="sfm-opt">\
|
||||
<button class="btn btn-default btn-sm" onclick="orPluginOpService(\''+_name+'\',\''+(status?'stop':'start')+'\',\''+version+'\')">'+(status?'停止':'启动')+'</button>\
|
||||
<button class="btn btn-default btn-sm" onclick="orPluginOpService(\''+_name+'\',\'restart\',\''+version+'\')">重启</button>\
|
||||
<button class="btn btn-default btn-sm" onclick="orPluginOpService(\''+_name+'\',\'restart\',\''+version+'\',\'yes\')">重启</button>\
|
||||
<button class="btn btn-default btn-sm" onclick="orPluginOpService(\''+_name+'\',\'reload\',\''+version+'\')">重载配置</button>\
|
||||
</div>';
|
||||
$(".soft-man-con").html(serviceCon);
|
||||
}
|
||||
|
||||
|
||||
function orPluginOpService(a, b, v) {
|
||||
function orPluginOpService(a, b, v,request_callback) {
|
||||
|
||||
var c = "name=" + a + "&func=" + b;
|
||||
if(v != ''){
|
||||
@@ -67,19 +67,25 @@ function orPluginOpService(a, b, v) {
|
||||
layer.close(index);
|
||||
var data = {'pwd':pwd};
|
||||
c += '&args='+JSON.stringify(data);
|
||||
orPluginOpServiceOp(a,b,c,d,a,v);
|
||||
orPluginOpServiceOp(a,b,c,d,a,v,request_callback);
|
||||
});
|
||||
} else {
|
||||
orPluginOpServiceOp(a,b,c,d,a,v);
|
||||
orPluginOpServiceOp(a,b,c,d,a,v,request_callback);
|
||||
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function orPluginOpServiceOp(a,b,c,d,a,v){
|
||||
function orPluginOpServiceOp(a,b,c,d,a,v,request_callback){
|
||||
|
||||
var request_path = "/plugins/run";
|
||||
if (request_callback == 'yes'){
|
||||
request_path = "/plugins/callback";
|
||||
}
|
||||
|
||||
var e = layer.msg(msgTpl('正在{1}{2}{3}服务,请稍候...',[d,a,v]), {icon: 16,time: 0});
|
||||
$.post("/plugins/run", c, function(g) {
|
||||
$.post(request_path, c, function(g) {
|
||||
layer.close(e);
|
||||
|
||||
var f = g.data == 'ok' ? msgTpl('{1}{2}服务已{3}',[a,v,d]) : msgTpl('{1}{2}服务{3}失败!',[a,v,d]);
|
||||
@@ -97,9 +103,6 @@ function orPluginOpServiceOp(a,b,c,d,a,v){
|
||||
layer.msg(g.data, {icon: 2,time: 10000,shade: 0.3});
|
||||
}
|
||||
|
||||
// setTimeout(function(){
|
||||
// location.reload();
|
||||
// },2000);
|
||||
},'json').error(function() {
|
||||
layer.close(e);
|
||||
layer.msg('操作异常!', {icon: 2});
|
||||
@@ -131,247 +134,3 @@ function getOpenrestyStatus() {
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
//nginx
|
||||
function nginxSoftMain(name, version) {
|
||||
var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.get('/system?action=GetConcifInfo', function(rdata) {
|
||||
layer.close(loadT);
|
||||
nameA = rdata['web'];
|
||||
var status = name == 'nginx' ? '<p onclick="GetNginxStatus()">' + lan.soft.nginx_status + '</p>' : '';
|
||||
var menu = '';
|
||||
if (version != undefined || version != '') {
|
||||
var menu = '<p onclick="softChangeVer(\'' + name + '\',\'' + version + '\')">' + lan.soft.nginx_version + '</p>';
|
||||
}
|
||||
|
||||
var waf = ''
|
||||
if (name == 'nginx') {
|
||||
waf = '<p onclick="waf()">' + lan.soft.waf_title + '</p>'
|
||||
}
|
||||
|
||||
var logsPath = (name == 'nginx') ? '/www/wwwlogs/nginx_error.log' : '/www/wwwlogs/error_log';
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: '640px',
|
||||
title: name + '管理',
|
||||
closeBtn: 2,
|
||||
shift: 0,
|
||||
content: '<div class="bt-w-main" style="width:640px;">\
|
||||
<div class="bt-w-menu">\
|
||||
<p class="bgw" onclick="service(\'' + name + '\',' + nameA.status + ')">' + lan.soft.web_service + '</p>\
|
||||
<p onclick="configChange(\'' + name + '\')">' + lan.soft.config_edit + '</p>\
|
||||
' + waf + '\
|
||||
' + menu + '\
|
||||
' + status + '\
|
||||
<p onclick="showLogs(\'' + logsPath + '\')">错误日志</p>\
|
||||
</div>\
|
||||
<div id="webEdit-con" class="bt-w-con pd15" style="height:555px;overflow:auto">\
|
||||
<div class="soft-man-con"></div>\
|
||||
</div>\
|
||||
</div>'
|
||||
});
|
||||
service(name, nameA.status);
|
||||
$(".bt-w-menu p").click(function() {
|
||||
//var i = $(this).index();
|
||||
$(this).addClass("bgw").siblings().removeClass("bgw");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//显示指定日志
|
||||
function showLogs(logPath) {
|
||||
var loadT = layer.msg(lan.public.the_get, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post('/ajax?action=GetOpeLogs', { path: logPath }, function(rdata) {
|
||||
layer.close(loadT);
|
||||
if (rdata.msg == '') rdata.msg = '当前没有日志!';
|
||||
var ebody = '<div class="soft-man-con"><textarea readonly="" style="margin: 0px;width: 500px;height: 520px;background-color: #333;color:#fff; padding:0 5px" id="error_log">' + rdata.msg + '</textarea></div>';
|
||||
$(".soft-man-con").html(ebody);
|
||||
var ob = document.getElementById('error_log');
|
||||
ob.scrollTop = ob.scrollHeight;
|
||||
});
|
||||
}
|
||||
|
||||
//WAF防火墙
|
||||
function waf() {
|
||||
var loadT = layer.msg(lan.public.the_get, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.get("/waf?action=GetConfig", function(rdata) {
|
||||
layer.close(loadT);
|
||||
if (rdata.status == -1) {
|
||||
layer.msg(lan.soft.waf_not, { icon: 5, time: 5000 });
|
||||
return;
|
||||
}
|
||||
|
||||
var whiteList = ""
|
||||
for (var i = 0; i < rdata.ipWhitelist.length; i++) {
|
||||
if (rdata.ipWhitelist[i] == "") continue;
|
||||
whiteList += "<tr><td>" + rdata.ipWhitelist[i] + "</td><td><a href=\"javascript:deleteWafKey('ipWhitelist','" + rdata.ipWhitelist[i] + "');\">" + lan.public.del + "</a></td></tr>";
|
||||
}
|
||||
|
||||
var blackList = ""
|
||||
for (var i = 0; i < rdata.ipBlocklist.length; i++) {
|
||||
if (rdata.ipBlocklist[i] == "") continue;
|
||||
blackList += "<tr><td>" + rdata.ipBlocklist[i] + "</td><td><a href=\"javascript:deleteWafKey('ipBlocklist','" + rdata.ipBlocklist[i] + "');\">" + lan.public.del + "</a></td></tr>";
|
||||
}
|
||||
|
||||
var cc = rdata.CCrate.split('/')
|
||||
|
||||
var con = "<div class='wafConf'>\
|
||||
<div class='wafConf-btn'>\
|
||||
<span>" + lan.soft.waf_title + "</span><div class='ssh-item'>\
|
||||
<input class='btswitch btswitch-ios' id='closeWaf' type='checkbox' " + (rdata.status == 1 ? 'checked' : '') + ">\
|
||||
<label class='btswitch-btn' for='closeWaf' onclick='CloseWaf()'></label>\
|
||||
</div>\
|
||||
<div class='pull-right'>\
|
||||
<button class='btn btn-default btn-sm' onclick='gzEdit()'>" + lan.soft.waf_edit + "</button>\
|
||||
<button class='btn btn-default btn-sm' onclick='upLimit()'>" + lan.soft.waf_up_title + "</button>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class='wafConf_checkbox label-input-group ptb10 relative'>\
|
||||
<input type='checkbox' id='waf_UrlDeny' " + (rdata['UrlDeny'] == 'on' ? 'checked' : '') + " onclick=\"SetWafConfig('UrlDeny','" + (rdata['UrlDeny'] == 'on' ? 'off' : 'on') + "')\" /><label for='waf_UrlDeny'>" + lan.soft.waf_input1 + "</label>\
|
||||
<input type='checkbox' id='waf_CookieMatch' " + (rdata['CookieMatch'] == 'on' ? 'checked' : '') + " onclick=\"SetWafConfig('CookieMatch','" + (rdata['CookieMatch'] == 'on' ? 'off' : 'on') + "')\" /><label for='waf_CookieMatch'>" + lan.soft.waf_input2 + "</label>\
|
||||
<input type='checkbox' id='waf_postMatch' " + (rdata['postMatch'] == 'on' ? 'checked' : '') + " onclick=\"SetWafConfig('postMatch','" + (rdata['postMatch'] == 'on' ? 'off' : 'on') + "')\" /><label for='waf_postMatch'>" + lan.soft.waf_input3 + "</label>\
|
||||
<input type='checkbox' id='waf_CCDeny' " + (rdata['CCDeny'] == 'on' ? 'checked' : '') + " onclick=\"SetWafConfig('CCDeny','" + (rdata['CCDeny'] == 'on' ? 'off' : 'on') + "')\" /><label for='waf_CCDeny'>" + lan.soft.waf_input4 + "</label>\
|
||||
<input type='checkbox' id='waf_attacklog' " + (rdata['attacklog'] == 'on' ? 'checked' : '') + " onclick=\"SetWafConfig('attacklog','" + (rdata['attacklog'] == 'on' ? 'off' : 'on') + "')\" /><label for='waf_attacklog'>" + lan.soft.waf_input5 + "</label>\
|
||||
<span class='glyphicon glyphicon-folder-open' style='position: absolute; right: 10px; top: 12px; color: orange;cursor: pointer' onclick='openPath(\"/www/wwwlogs/waf\")'></span>\
|
||||
</div>\
|
||||
<div class='wafConf_cc'>\
|
||||
<span>" + lan.soft.waf_input6 + "</span><input id='CCrate_1' class='bt-input-text' type='number' value='" + cc[0] + "' style='width:80px;margin-right:30px'/>\
|
||||
<span>" + lan.soft.waf_input7 + "(" + lan.bt.s + ")</span><input id='CCrate_2' class='bt-input-text' type='number' value='" + cc[1] + "' style='width:80px;'/>\
|
||||
<button onclick=\"SetWafConfig('CCrate','')\" class='btn btn-default btn-sm'>" + lan.public.ok + "</button>\
|
||||
</div>\
|
||||
<div class='wafConf_ip'>\
|
||||
<fieldset>\
|
||||
<legend>" + lan.soft.waf_input8 + "</legend>\
|
||||
<input type='text' id='ipWhitelist_val' class='bt-input-text mr5' placeholder='" + lan.soft.waf_ip + "' style='width:175px;' /><button onclick=\"addWafKey('ipWhitelist')\" class='btn btn-default btn-sm'>" + lan.public.add + "</button>\
|
||||
<div class='table-overflow'><table class='table table-hover'>" + whiteList + "</table></div>\
|
||||
</fieldset>\
|
||||
<fieldset>\
|
||||
<legend>" + lan.soft.waf_input9 + "</legend>\
|
||||
<input type='text' id='ipBlocklist_val' class='bt-input-text mr5' placeholder='" + lan.soft.waf_ip + "' style='width:175px;' /><button onclick=\"addWafKey('ipBlocklist')\" class='btn btn-default btn-sm'>" + lan.public.add + "</button>\
|
||||
<div class='table-overflow'><table class='table table-hover'>" + blackList + "</table></div>\
|
||||
</fieldset>\
|
||||
</div>\
|
||||
</div>"
|
||||
$(".soft-man-con").html(con);
|
||||
});
|
||||
}
|
||||
|
||||
//上传限制
|
||||
function upLimit() {
|
||||
var loadT = layer.msg(lan.public.the_get, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.get("/waf?action=GetConfig", function(rdata) {
|
||||
layer.close(loadT);
|
||||
var black_fileExt = ''
|
||||
for (var i = 0; i < rdata.black_fileExt.length; i++) {
|
||||
black_fileExt += "<tr><td>" + rdata.black_fileExt[i] + "</td><td><a style='float:right;' href=\"javascript:deleteWafKey('black_fileExt','" + rdata.black_fileExt[i] + "');\">" + lan.public.del + "</a></td></tr>";
|
||||
}
|
||||
|
||||
if ($("#blacktable").html() != undefined) {
|
||||
$("#blacktable").html(black_fileExt);
|
||||
$("#black_fileExt_val").val('');
|
||||
return;
|
||||
}
|
||||
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: '300px',
|
||||
title: lan.soft.waf_up_title,
|
||||
closeBtn: 2,
|
||||
shift: 0,
|
||||
content: "<div class='dirBinding mlr15'>" +
|
||||
"<input class='bt-input-text mr5' type='text' placeholder='" + lan.soft.waf_up_from1 + "' id='black_fileExt_val' style='height: 28px; border-radius: 3px;width: 219px;margin-top:15px' />" +
|
||||
"<button class='btn btn-success btn-sm' onclick=\"addWafKey('black_fileExt')\">" + lan.public.add + "</button>" +
|
||||
"</div>" +
|
||||
"<div class='divtable' style='margin:15px'><table class='table table-hover' width='100%' style='margin-bottom:0'>" +
|
||||
"<thead><tr><th>" + lan.soft.waf_up_from2 + "</th><th width='100' class='text-right'>" + lan.public.action + "</th></tr></thead>" +
|
||||
"<tbody id='blacktable'>" + black_fileExt + "</tbody>" +
|
||||
"</table></div>"
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//设置waf状态
|
||||
function closeWaf() {
|
||||
var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post('/waf?action=SetStatus', '', function(rdata) {
|
||||
layer.close(loadT)
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 5 });
|
||||
if (rdata.status) waf();
|
||||
});
|
||||
}
|
||||
|
||||
//取规则文件
|
||||
function getWafFile(name) {
|
||||
onlineEditFile(0, '/www/server/panel/vhost/wafconf/' + name);
|
||||
}
|
||||
//规则编辑
|
||||
function gzEdit() {
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: '360px',
|
||||
title: lan.soft.waf_edit,
|
||||
closeBtn: 2,
|
||||
shift: 0,
|
||||
content: "<div class='gzEdit'><button class='btn btn-default btn-sm' onclick=\"GetWafFile('cookie')\">Cookie</button>\
|
||||
<button class='btn btn-default btn-sm' onclick=\"GetWafFile('post')\">POST</button>\
|
||||
<button class='btn btn-default btn-sm' onclick=\"GetWafFile('url')\">URL</button>\
|
||||
<button class='btn btn-default btn-sm' onclick=\"GetWafFile('user-agent')\">User-Agent</button>\
|
||||
<button class='btn btn-default btn-sm' onclick=\"GetWafFile('args')\">Args</button>\
|
||||
<button class='btn btn-default btn-sm' onclick=\"GetWafFile('whiteurl')\">" + lan.soft.waf_url_white + "</button>\
|
||||
<button class='btn btn-default btn-sm' onclick=\"GetWafFile('returnhtml')\">" + lan.soft.waf_index + "</button>\
|
||||
<button class='btn btn-default btn-sm' onclick=\"updateWaf('returnhtml')\">" + lan.soft.waf_cloud + "</button></div>"
|
||||
});
|
||||
}
|
||||
|
||||
//更新WAF规则
|
||||
function updateWaf() {
|
||||
var loadT = layer.msg(lan.soft.waf_update, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post('/waf?action=updateWaf', '', function(rdata) {
|
||||
layer.close(loadT)
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 5 });
|
||||
});
|
||||
}
|
||||
|
||||
//设置WAF配置值
|
||||
function setWafConfig(name, value) {
|
||||
if (name == 'CCrate') {
|
||||
var CCrate_1 = $("#CCrate_1").val();
|
||||
var CCrate_2 = $("#CCrate_2").val();
|
||||
if (CCrate_1 < 1 || CCrate_1 > 3000 || CCrate_2 < 1 || CCrate_2 > 1800) {
|
||||
layer.msg(lan.soft.waf_cc_err, { icon: 5 });
|
||||
return;
|
||||
}
|
||||
value = CCrate_1 + '/' + CCrate_2;
|
||||
}
|
||||
var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post('/waf?action=SetConfigString', 'name=' + name + '&value=' + value, function(rdata) {
|
||||
layer.close(loadT)
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 5 });
|
||||
if (rdata.status) waf();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//删除WAF指定值
|
||||
function deleteWafKey(name, value) {
|
||||
var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post('/waf?action=SetConfigList&act=del', 'name=' + name + '&value=' + value, function(rdata) {
|
||||
layer.close(loadT)
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 5 });
|
||||
if (rdata.status) waf();
|
||||
if (name == 'black_fileExt') upLimit();
|
||||
});
|
||||
}
|
||||
|
||||
//删除WAF指定值
|
||||
function addWafKey(name) {
|
||||
var value = $('#' + name + '_val').val();
|
||||
var loadT = layer.msg(lan.public.the, { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post('/waf?action=SetConfigList&act=add', 'name=' + name + '&value=' + value, function(rdata) {
|
||||
layer.close(loadT)
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 5 });
|
||||
if (rdata.status) waf();
|
||||
if (name == 'black_fileExt') upLimit();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,18 +3,6 @@ export PATH=$PATH:/opt/local/bin:/opt/local/sbin:/opt/local/share/man:/usr/local
|
||||
DIR=$(cd "$(dirname "$0")"; pwd)
|
||||
|
||||
|
||||
|
||||
# cd /www/server/mdserver-web/scripts/quick && bash debug.sh
|
||||
# cd /www/server/mdserver-web/plugins/php && bash all_test.sh
|
||||
|
||||
|
||||
# cd /www/server/mdserver-web/plugins/php && bash install.sh install 71
|
||||
# cd /www/server/mdserver-web/plugins/php/versions/52/ && bash gd.sh install 52
|
||||
|
||||
# cd /www/server/mdserver-web/plugins/php/versions/52/ && bash openssl.sh install 52
|
||||
# cd /www/server/mdserver-web/plugins/php/versions/81/ && bash imagemagick.sh install 81
|
||||
# cd /www/server/mdserver-web/plugins/php/versions/70/ && bash imagemagick.sh install 70
|
||||
|
||||
PHP_VER=71
|
||||
echo "php${PHP_VER} -- start"
|
||||
cmd_ext=$(ls -l $DIR/versions/$PHP_VER/ |awk '{print $9}')
|
||||
|
||||
@@ -4,8 +4,8 @@ define('XHProf_Name', 'mdd');
|
||||
|
||||
/**
|
||||
* xhprof 配置,便于调试快速找到问题
|
||||
* author midoks@163.com
|
||||
*/
|
||||
|
||||
function app_xhprof_start() {
|
||||
$root = '{$ROOT_PATH}';
|
||||
$lib = $root . '/server/xhprof/xhprof_lib/utils/xhprof_lib.php';
|
||||
|
||||
@@ -10,8 +10,6 @@ rootPath=$(dirname "$rootPath")
|
||||
|
||||
# echo $rootPath
|
||||
|
||||
# cd /www/server/mdserver-web/plugins/php/lib && /bin/bash libmemcached.sh
|
||||
|
||||
SERVER_ROOT=$rootPath/lib
|
||||
SOURCE_ROOT=$rootPath/source/lib
|
||||
|
||||
|
||||
@@ -13,18 +13,6 @@ rootPath=$(dirname "$rootPath")
|
||||
SERVER_ROOT=$rootPath/lib
|
||||
SOURCE_ROOT=$rootPath/source/lib
|
||||
|
||||
# if [ ! -d ${SERVER_ROOT}/openssl ];then
|
||||
# cd ${SOURCE_ROOT}
|
||||
# if [ ! -f ${SOURCE_ROOT}/openssl-1.0.2q.tar.gz ];then
|
||||
# wget https://github.com/midoks/mdserver-web/releases/download/init/openssl-1.0.2q.tar.gz -T 20
|
||||
# fi
|
||||
# tar -zxf openssl-1.0.2q.tar.gz
|
||||
# cd openssl-1.0.2q
|
||||
# ./config --openssldir=${SERVER_ROOT}/openssl zlib-dynamic shared
|
||||
# make && make install
|
||||
# fi
|
||||
|
||||
|
||||
if [ ! -d ${SERVER_ROOT}/openssl ];then
|
||||
cd ${SOURCE_ROOT}
|
||||
if [ ! -f ${SOURCE_ROOT}/openssl-1.1.1p.tar.gz ];then
|
||||
|
||||
@@ -74,7 +74,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -21,7 +21,7 @@ echo "安装php-${version} ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
if [ ! -f $sourcePath/php/php-${version}.tar.gz ];then
|
||||
@@ -131,7 +131,6 @@ fi
|
||||
# ps -ef|grep php/52 |grep -v grep |awk '{print $2}'|xargs kill
|
||||
# /www/server/php/init.d/php52 start
|
||||
# /www/server/php/52/sbin/php-fpm start
|
||||
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 52
|
||||
mkdir -p $serverPath/php/${PHP_VER}/var/log
|
||||
mkdir -p $serverPath/php/${PHP_VER}/var/run
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ Install_lib()
|
||||
return
|
||||
fi
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash icu.sh
|
||||
cd $rootPath/plugins/php/lib && /bin/bash icu.sh
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ echo "安装php-5.3.29 ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
|
||||
|
||||
@@ -40,7 +40,7 @@ Install_lib()
|
||||
php_lib=$sourcePath/php_lib
|
||||
mkdir -p $php_lib
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash icu.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash icu.sh
|
||||
|
||||
wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
if [ ! -f $sourcePath/php/php-${version}.tar.gz ];then
|
||||
|
||||
@@ -19,8 +19,8 @@ echo "安装php-5.5.38 ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
|
||||
|
||||
@@ -19,8 +19,8 @@ echo "安装php-${version} ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
|
||||
|
||||
@@ -19,8 +19,8 @@ echo "安装php-${version} ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
|
||||
|
||||
@@ -19,8 +19,8 @@ echo "安装php-${version} ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
|
||||
|
||||
@@ -44,7 +44,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -20,8 +20,8 @@ echo "安装php-${version} ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
|
||||
|
||||
@@ -24,8 +24,8 @@ echo "安装php-${version} ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@ echo "安装php-${version} ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_new.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash libzip.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_new.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash libzip.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)"
|
||||
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
|
||||
|
||||
|
||||
version=8.0.22
|
||||
version=8.0.23
|
||||
PHP_VER=80
|
||||
Install_php()
|
||||
{
|
||||
@@ -25,8 +25,8 @@ echo "安装php-${version} ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_new.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_new.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)"
|
||||
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
|
||||
|
||||
|
||||
version=8.1.9
|
||||
version=8.1.10
|
||||
PHP_VER=81
|
||||
Install_php()
|
||||
{
|
||||
@@ -25,8 +25,8 @@ echo "安装php-${version} ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_new.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_new.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
|
||||
@@ -16,7 +16,7 @@ function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)"
|
||||
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
|
||||
|
||||
|
||||
version=8.2.0beta3
|
||||
version=8.2.0RC2
|
||||
PHP_VER=82
|
||||
Install_php()
|
||||
{
|
||||
@@ -25,14 +25,14 @@ echo "安装php-${version} ..." > $install_tmp
|
||||
mkdir -p $sourcePath/php
|
||||
mkdir -p $serverPath/php
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_new.sh
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_new.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
|
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
|
||||
|
||||
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
|
||||
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://downloads.php.net/~pierrick/php-8.2.0alpha2.tar.xz
|
||||
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://downloads.php.net/~sergey/php-${version}.tar.xz
|
||||
fi
|
||||
|
||||
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-${version}.tar.xz
|
||||
|
||||
@@ -49,7 +49,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -52,7 +52,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -49,7 +49,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -52,7 +52,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -40,7 +40,7 @@ else
|
||||
fi
|
||||
|
||||
|
||||
# cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
# cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
# OPTIONS="${OPTIONS} --with-freetype-dir=${serverPath}/lib/freetype_old"
|
||||
# OPTIONS="${OPTIONS} --with-gd --enable-gd-native-ttf"
|
||||
# OPTIONS="${OPTIONS} --with-jpeg --with-jpeg-dir=/usr/lib"
|
||||
@@ -55,12 +55,12 @@ Install_lib()
|
||||
return
|
||||
fi
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
Executable
+108
@@ -0,0 +1,108 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sourcePath=${serverPath}/source/php
|
||||
|
||||
actionType=$1
|
||||
version=$2
|
||||
|
||||
LIBNAME=gettext
|
||||
LIBV=0
|
||||
|
||||
LIB_PATH_NAME=lib/php
|
||||
if [ -d $serverPath/php/${version}/lib64 ];then
|
||||
LIB_PATH_NAME=lib64
|
||||
fi
|
||||
|
||||
NON_ZTS_FILENAME=`ls $serverPath/php/${version}/${LIB_PATH_NAME}/extensions | grep no-debug-non-zts`
|
||||
extFile=$serverPath/php/${version}/${LIB_PATH_NAME}/extensions/${NON_ZTS_FILENAME}/${LIBNAME}.so
|
||||
|
||||
sysName=`uname`
|
||||
if [ "$sysName" == "Darwin" ];then
|
||||
BAK='_bak'
|
||||
else
|
||||
BAK=''
|
||||
fi
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||
|
||||
FIND_C99=`cat Makefile|grep c99`
|
||||
if [ "$FIND_C99" == "" ];then
|
||||
sed -i $BAK 's/CFLAGS \=/CFLAGS \= -std=c99/g' Makefile
|
||||
fi
|
||||
|
||||
make clean && make && make install && make clean
|
||||
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo $serverPath/php/$version/etc/php.ini
|
||||
sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
|
||||
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
|
||||
|
||||
rm -f $extFile
|
||||
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -45,12 +45,12 @@ Install_lib()
|
||||
return
|
||||
fi
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash libiconv.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash libiconv.sh
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -34,7 +34,7 @@ fi
|
||||
|
||||
OPTIONS=''
|
||||
if [ "$version" -lt "71" ];then
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash icu.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash icu.sh
|
||||
OPTIONS="--with-icu-dir=${serverPath}/lib/icu"
|
||||
fi
|
||||
|
||||
@@ -51,7 +51,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -46,7 +46,7 @@ Install_lib()
|
||||
return
|
||||
fi
|
||||
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && bash libmcrypt.sh
|
||||
cd ${rootPath}/plugins/php/lib && bash libmcrypt.sh
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
|
||||
@@ -41,15 +41,15 @@ Install_lib()
|
||||
return
|
||||
fi
|
||||
|
||||
# cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash openssl_10.sh
|
||||
# cd ${rootPath}/plugins/php/lib && /bin/bash openssl_10.sh
|
||||
if [ "$version" -lt "70" ];then
|
||||
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash openssl_10.sh
|
||||
cd ${rootPath}/plugins/php/lib && /bin/bash openssl_10.sh
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -44,7 +44,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -54,7 +54,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -46,7 +46,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
if [ ! -d $sourcePath/php${version}/ext ];then
|
||||
cd $serverPath/mdserver-web/plugins/php && /bin/bash install.sh install ${version}
|
||||
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
|
||||
fi
|
||||
|
||||
cd $sourcePath/php${version}/ext/${LIBNAME}
|
||||
|
||||
@@ -219,6 +219,28 @@
|
||||
"shell": "igbinary.sh",
|
||||
"check": "igbinary.so"
|
||||
},
|
||||
{
|
||||
"name": "gettext",
|
||||
"versions": [
|
||||
"52",
|
||||
"53",
|
||||
"54",
|
||||
"55",
|
||||
"56",
|
||||
"70",
|
||||
"71",
|
||||
"72",
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "通用扩展",
|
||||
"msg": "国际化与本地化!",
|
||||
"shell": "gettext.sh",
|
||||
"check": "gettext.so"
|
||||
},
|
||||
{
|
||||
"name": "gd",
|
||||
"versions": [
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
daemonize yes
|
||||
pidfile {$SERVER_PATH}/redis/redis_6379.pid
|
||||
|
||||
bind 127.0.0.1
|
||||
port 6379
|
||||
requirepass admin
|
||||
|
||||
timeout 0
|
||||
tcp-keepalive 0
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
<div class="bt-form">
|
||||
<div class='plugin_version'></div>
|
||||
<div class="bt-w-main">
|
||||
<div class="bt-w-menu">
|
||||
<p class="bgw" onclick="pluginService('redis');">服务</p>
|
||||
<p onclick="pluginInitD('redis');">自启动</p>
|
||||
<p onclick="pluginConfig('redis');">配置修改</p>
|
||||
<p onclick="redisStatus();">负载状态</p>
|
||||
<p onclick="getRedisConfig($('.plugin_version').attr('version'));">性能调整</p>
|
||||
<p onclick="redisStatus($('.plugin_version').attr('version'));">负载状态</p>
|
||||
<p onclick="pluginLogs('redis','','run_log');">日志</p>
|
||||
</div>
|
||||
<div class="bt-w-con pd15">
|
||||
@@ -13,42 +15,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
pluginService('redis');
|
||||
|
||||
//redis负载状态 start
|
||||
function redisStatus() {
|
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||
$.post('/plugins/run', {name:'redis', func:'run_info'}, function(data) {
|
||||
layer.close(loadT);
|
||||
if (!data.status){
|
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
var rdata = $.parseJSON(data.data);
|
||||
hit = (parseInt(rdata.keyspace_hits) / (parseInt(rdata.keyspace_hits) + parseInt(rdata.keyspace_misses)) * 100).toFixed(2);
|
||||
var Con = '<div class="divtable">\
|
||||
<table class="table table-hover table-bordered" style="width: 490px;">\
|
||||
<thead><th>字段</th><th>当前值</th><th>说明</th></thead>\
|
||||
<tbody>\
|
||||
<tr><th>uptime_in_days</th><td>' + rdata.uptime_in_days + '</td><td>已运行天数</td></tr>\
|
||||
<tr><th>tcp_port</th><td>' + rdata.tcp_port + '</td><td>当前监听端口</td></tr>\
|
||||
<tr><th>connected_clients</th><td>' + rdata.connected_clients + '</td><td>连接的客户端数量</td></tr>\
|
||||
<tr><th>used_memory_rss</th><td>' + toSize(rdata.used_memory_rss) + '</td><td>Redis当前占用的系统内存总量</td></tr>\
|
||||
<tr><th>used_memory</th><td>' + toSize(rdata.used_memory) + '</td><td>Redis当前已分配的内存总量</td></tr>\
|
||||
<tr><th>used_memory_peak</th><td>' + toSize(rdata.used_memory_peak) + '</td><td>Redis历史分配内存的峰值</td></tr>\
|
||||
<tr><th>mem_fragmentation_ratio</th><td>' + rdata.mem_fragmentation_ratio + '%</td><td>内存碎片比率</td></tr>\
|
||||
<tr><th>total_connections_received</th><td>' + rdata.total_connections_received + '</td><td>运行以来连接过的客户端的总数量</td></tr>\
|
||||
<tr><th>total_commands_processed</th><td>' + rdata.total_commands_processed + '</td><td>运行以来执行过的命令的总数量</td></tr>\
|
||||
<tr><th>instantaneous_ops_per_sec</th><td>' + rdata.instantaneous_ops_per_sec + '</td><td>服务器每秒钟执行的命令数量</td></tr>\
|
||||
<tr><th>keyspace_hits</th><td>' + rdata.keyspace_hits + '</td><td>查找数据库键成功的次数</td></tr>\
|
||||
<tr><th>keyspace_misses</th><td>' + rdata.keyspace_misses + '</td><td>查找数据库键失败的次数</td></tr>\
|
||||
<tr><th>hit</th><td>' + hit + '%</td><td>查找数据库键命中率</td></tr>\
|
||||
<tr><th>latest_fork_usec</th><td>' + rdata.latest_fork_usec + '</td><td>最近一次 fork() 操作耗费的微秒数</td></tr>\
|
||||
<tbody>\
|
||||
</table></div>'
|
||||
$(".soft-man-con").html(Con);
|
||||
},'json');
|
||||
}
|
||||
//redis负载状态 end
|
||||
$.getScript( "/plugins/file?name=redis&f=js/redis.js", function(){
|
||||
pluginService('redis', $('.plugin_version').attr('version'));
|
||||
});
|
||||
</script>
|
||||
+81
-2
@@ -4,6 +4,7 @@ import sys
|
||||
import io
|
||||
import os
|
||||
import time
|
||||
import re
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
import mw
|
||||
@@ -47,7 +48,7 @@ def getInitDTpl():
|
||||
|
||||
|
||||
def getArgs():
|
||||
args = sys.argv[2:]
|
||||
args = sys.argv[3:]
|
||||
tmp = {}
|
||||
args_len = len(args)
|
||||
|
||||
@@ -153,7 +154,19 @@ def reload():
|
||||
|
||||
|
||||
def runInfo():
|
||||
requirepass = ""
|
||||
|
||||
conf = getServerDir() + '/redis.conf'
|
||||
content = mw.readFile(conf)
|
||||
rep = "^(requirepass" + ')\s*([.0-9A-Za-z_& ~]+)'
|
||||
tmp = re.search(rep, content, re.M)
|
||||
if tmp:
|
||||
requirepass = tmp.groups()[1]
|
||||
|
||||
cmd = getServerDir() + "/bin/redis-cli info"
|
||||
if requirepass != "":
|
||||
cmd = getServerDir() + '/bin/redis-cli -a "' + requirepass + '" info'
|
||||
|
||||
data = mw.execShell(cmd)[0]
|
||||
res = [
|
||||
'tcp_port',
|
||||
@@ -202,7 +215,6 @@ def initdInstall():
|
||||
|
||||
|
||||
def initdUinstall():
|
||||
|
||||
if mw.isAppleSystem():
|
||||
return "Apple Computer does not support"
|
||||
|
||||
@@ -213,6 +225,69 @@ def initdUinstall():
|
||||
def runLog():
|
||||
return getServerDir() + '/data/redis.log'
|
||||
|
||||
|
||||
def getRedisConfInfo():
|
||||
conf = getServerDir() + '/redis.conf'
|
||||
content = mw.readFile(conf)
|
||||
|
||||
gets = [
|
||||
{'name': 'bind', 'type': 2, 'ps': '绑定IP(修改绑定IP可能会存在安全隐患)'},
|
||||
{'name': 'port', 'type': 2, 'ps': '绑定端口'},
|
||||
{'name': 'timeout', 'type': 2, 'ps': '空闲链接超时时间,0表示不断开'},
|
||||
{'name': 'maxclients', 'type': 2, 'ps': '最大输入时间'},
|
||||
{'name': 'databases', 'type': 2, 'ps': '数据库数量'},
|
||||
{'name': 'requirepass', 'type': 2, 'ps': 'redis密码,留空代表没有设置密码'},
|
||||
{'name': 'maxmemory', 'type': 2, 'ps': 'MB,最大使用内存,0表示不限制'}
|
||||
]
|
||||
content = mw.readFile(conf)
|
||||
|
||||
result = []
|
||||
for g in gets:
|
||||
rep = "^(" + g['name'] + ')\s*([.0-9A-Za-z_& ~]+)'
|
||||
tmp = re.search(rep, content, re.M)
|
||||
if not tmp:
|
||||
g['value'] = ''
|
||||
result.append(g)
|
||||
continue
|
||||
g['value'] = tmp.groups()[1]
|
||||
if g['name'] == 'maxmemory':
|
||||
g['value'] = g['value'].strip("mb")
|
||||
result.append(g)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def getRedisConf():
|
||||
data = getRedisConfInfo()
|
||||
return mw.getJson(data)
|
||||
|
||||
|
||||
def submitRedisConf():
|
||||
gets = ['bind', 'port', 'timeout', 'maxclients',
|
||||
'databases', 'requirepass', 'maxmemory']
|
||||
args = getArgs()
|
||||
conf = getServerDir() + '/redis.conf'
|
||||
content = mw.readFile(conf)
|
||||
for g in gets:
|
||||
if g in args:
|
||||
rep = g + '\s*([.0-9A-Za-z_& ~]+)'
|
||||
val = g + ' ' + args[g]
|
||||
|
||||
if g == 'maxmemory':
|
||||
val = g + ' ' + args[g] + "mb"
|
||||
|
||||
if g == 'requirepass' and args[g] == '':
|
||||
content = re.sub('requirepass', '#requirepass', content)
|
||||
if g == 'requirepass' and args[g] != '':
|
||||
content = re.sub('#requirepass', 'requirepass', content)
|
||||
content = re.sub(rep, val, content)
|
||||
|
||||
if g != 'requirepass':
|
||||
content = re.sub(rep, val, content)
|
||||
mw.writeFile(conf, content)
|
||||
reload()
|
||||
return mw.returnJson(True, '设置成功')
|
||||
|
||||
if __name__ == "__main__":
|
||||
func = sys.argv[1]
|
||||
if func == 'status':
|
||||
@@ -237,5 +312,9 @@ if __name__ == "__main__":
|
||||
print(getConf())
|
||||
elif func == 'run_log':
|
||||
print(runLog())
|
||||
elif func == 'get_redis_conf':
|
||||
print(getRedisConf())
|
||||
elif func == 'submit_redis_conf':
|
||||
print(submitRedisConf())
|
||||
else:
|
||||
print('error')
|
||||
|
||||
Executable
+149
@@ -0,0 +1,149 @@
|
||||
|
||||
function str2Obj(str){
|
||||
var data = {};
|
||||
kv = str.split('&');
|
||||
for(i in kv){
|
||||
v = kv[i].split('=');
|
||||
data[v[0]] = v[1];
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
function redisPost(method, version, args,callback){
|
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||
|
||||
var req_data = {};
|
||||
req_data['name'] = 'redis';
|
||||
req_data['func'] = method;
|
||||
req_data['version'] = version;
|
||||
|
||||
if (typeof(args) == 'string'){
|
||||
req_data['args'] = JSON.stringify(str2Obj(args));
|
||||
} else {
|
||||
req_data['args'] = JSON.stringify(args);
|
||||
}
|
||||
|
||||
$.post('/plugins/run', req_data, function(data) {
|
||||
layer.close(loadT);
|
||||
if (!data.status){
|
||||
//错误展示10S
|
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [10, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
if(typeof(callback) == 'function'){
|
||||
callback(data);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
function redisPostCallbak(method, version, args,callback){
|
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
|
||||
|
||||
var req_data = {};
|
||||
req_data['name'] = 'redis';
|
||||
req_data['func'] = method;
|
||||
args['version'] = version;
|
||||
|
||||
if (typeof(args) == 'string'){
|
||||
req_data['args'] = JSON.stringify(str2Obj(args));
|
||||
} else {
|
||||
req_data['args'] = JSON.stringify(args);
|
||||
}
|
||||
|
||||
$.post('/plugins/callback', req_data, function(data) {
|
||||
layer.close(loadT);
|
||||
if (!data.status){
|
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
|
||||
if(typeof(callback) == 'function'){
|
||||
callback(data);
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
//redis负载状态 start
|
||||
function redisStatus(version) {
|
||||
|
||||
redisPost('run_info',version, {},function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
hit = (parseInt(rdata.keyspace_hits) / (parseInt(rdata.keyspace_hits) + parseInt(rdata.keyspace_misses)) * 100).toFixed(2);
|
||||
var con = '<div class="divtable">\
|
||||
<table class="table table-hover table-bordered" style="width: 490px;">\
|
||||
<thead><th>字段</th><th>当前值</th><th>说明</th></thead>\
|
||||
<tbody>\
|
||||
<tr><th>uptime_in_days</th><td>' + rdata.uptime_in_days + '</td><td>已运行天数</td></tr>\
|
||||
<tr><th>tcp_port</th><td>' + rdata.tcp_port + '</td><td>当前监听端口</td></tr>\
|
||||
<tr><th>connected_clients</th><td>' + rdata.connected_clients + '</td><td>连接的客户端数量</td></tr>\
|
||||
<tr><th>used_memory_rss</th><td>' + toSize(rdata.used_memory_rss) + '</td><td>Redis当前占用的系统内存总量</td></tr>\
|
||||
<tr><th>used_memory</th><td>' + toSize(rdata.used_memory) + '</td><td>Redis当前已分配的内存总量</td></tr>\
|
||||
<tr><th>used_memory_peak</th><td>' + toSize(rdata.used_memory_peak) + '</td><td>Redis历史分配内存的峰值</td></tr>\
|
||||
<tr><th>mem_fragmentation_ratio</th><td>' + rdata.mem_fragmentation_ratio + '%</td><td>内存碎片比率</td></tr>\
|
||||
<tr><th>total_connections_received</th><td>' + rdata.total_connections_received + '</td><td>运行以来连接过的客户端的总数量</td></tr>\
|
||||
<tr><th>total_commands_processed</th><td>' + rdata.total_commands_processed + '</td><td>运行以来执行过的命令的总数量</td></tr>\
|
||||
<tr><th>instantaneous_ops_per_sec</th><td>' + rdata.instantaneous_ops_per_sec + '</td><td>服务器每秒钟执行的命令数量</td></tr>\
|
||||
<tr><th>keyspace_hits</th><td>' + rdata.keyspace_hits + '</td><td>查找数据库键成功的次数</td></tr>\
|
||||
<tr><th>keyspace_misses</th><td>' + rdata.keyspace_misses + '</td><td>查找数据库键失败的次数</td></tr>\
|
||||
<tr><th>hit</th><td>' + hit + '%</td><td>查找数据库键命中率</td></tr>\
|
||||
<tr><th>latest_fork_usec</th><td>' + rdata.latest_fork_usec + '</td><td>最近一次 fork() 操作耗费的微秒数</td></tr>\
|
||||
<tbody>\
|
||||
</table></div>';
|
||||
$(".soft-man-con").html(con);
|
||||
});
|
||||
}
|
||||
//redis负载状态 end
|
||||
|
||||
//配置修改
|
||||
function getRedisConfig(version) {
|
||||
redisPost('get_redis_conf', version,'',function(data){
|
||||
// console.log(data);
|
||||
var rdata = $.parseJSON(data.data);
|
||||
// console.log(rdata);
|
||||
var mlist = '';
|
||||
for (var i = 0; i < rdata.length; i++) {
|
||||
var w = '70'
|
||||
if (rdata[i].name == 'error_reporting') w = '250';
|
||||
var ibody = '<input style="width: ' + w + 'px;" class="bt-input-text mr5" name="' + rdata[i].name + '" value="' + rdata[i].value + '" type="text" >';
|
||||
switch (rdata[i].type) {
|
||||
case 0:
|
||||
var selected_1 = (rdata[i].value == 1) ? 'selected' : '';
|
||||
var selected_0 = (rdata[i].value == 0) ? 'selected' : '';
|
||||
ibody = '<select class="bt-input-text mr5" name="' + rdata[i].name + '" style="width: ' + w + 'px;"><option value="1" ' + selected_1 + '>开启</option><option value="0" ' + selected_0 + '>关闭</option></select>'
|
||||
break;
|
||||
case 1:
|
||||
var selected_1 = (rdata[i].value == 'On') ? 'selected' : '';
|
||||
var selected_0 = (rdata[i].value == 'Off') ? 'selected' : '';
|
||||
ibody = '<select class="bt-input-text mr5" name="' + rdata[i].name + '" style="width: ' + w + 'px;"><option value="On" ' + selected_1 + '>开启</option><option value="Off" ' + selected_0 + '>关闭</option></select>'
|
||||
break;
|
||||
}
|
||||
mlist += '<p><span>' + rdata[i].name + '</span>' + ibody + ', <font>' + rdata[i].ps + '</font></p>'
|
||||
}
|
||||
var phpCon = '<style>.conf_p p{margin-bottom: 2px}</style><div class="conf_p" style="margin-bottom:0">' + mlist + '\
|
||||
<div style="margin-top:10px; padding-right:15px" class="text-right"><button class="btn btn-success btn-sm mr5" onclick="getRedisConfig(\'' + version + '\')">刷新</button>\
|
||||
<button class="btn btn-success btn-sm" onclick="submitConf(\'' + version + '\')">保存</button></div>\
|
||||
</div>'
|
||||
$(".soft-man-con").html(phpCon);
|
||||
});
|
||||
}
|
||||
|
||||
//提交PHP配置
|
||||
function submitConf(version) {
|
||||
var data = {
|
||||
version: version,
|
||||
bind: $("input[name='bind']").val(),
|
||||
'port': $("input[name='port']").val(),
|
||||
'timeout': $("input[name='timeout']").val(),
|
||||
maxclients: $("input[name='maxclients']").val(),
|
||||
databases: $("input[name='databases']").val(),
|
||||
requirepass: $("input[name='requirepass']").val(),
|
||||
maxmemory: $("input[name='maxmemory']").val(),
|
||||
};
|
||||
|
||||
redisPost('submit_redis_conf', version, data, function(ret_data){
|
||||
var rdata = $.parseJSON(ret_data.data);
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"shell":"install.sh",
|
||||
"checks":"server/rsyncd",
|
||||
"path": "server/rsyncd",
|
||||
"author":"midoks",
|
||||
"author":"samba",
|
||||
"home":"https://rsync.samba.org/",
|
||||
"date":"2019-03-05",
|
||||
"pid":"4"
|
||||
|
||||
@@ -103,7 +103,7 @@ def initDreplace():
|
||||
mw.writeFile(conf, conf_content)
|
||||
|
||||
if os.path.exists(systemDir) and not os.path.exists(systemService):
|
||||
activate_file = mw.getServerDir() + '/mdserver-web/bin/activate'
|
||||
activate_file = mw.getRunDir() + '/bin/activate'
|
||||
if os.path.exists(activate_file):
|
||||
supervisord_bin = mw.execShell(
|
||||
'source ' + activate_file + '&& which supervisord')[0].strip()
|
||||
@@ -472,7 +472,7 @@ def readConfigLogTpl():
|
||||
stdout_logfile = line.strip().split('=')[1]
|
||||
|
||||
if stdout_logfile != '':
|
||||
data = mw.getNumLines(stdout_logfile, int(line_log))
|
||||
data = mw.getLastLine(stdout_logfile, int(line_log))
|
||||
return mw.returnJson(True, 'OK', data)
|
||||
return mw.returnJson(False, 'OK', '')
|
||||
|
||||
@@ -494,7 +494,7 @@ def readConfigLogErrorTpl():
|
||||
stderr_logfile = line.strip().split('=')[1]
|
||||
|
||||
if stderr_logfile != '':
|
||||
data = mw.getNumLines(stderr_logfile, int(line_log))
|
||||
data = mw.getLastLine(stderr_logfile, int(line_log))
|
||||
return mw.returnJson(True, 'OK', data)
|
||||
return mw.returnJson(False, 'OK', '')
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"checks": "server/swap",
|
||||
"path": "server/swap",
|
||||
"display": 1,
|
||||
"author": "midoks",
|
||||
"author": "swap",
|
||||
"date": "2021-01-29",
|
||||
"home": "swap",
|
||||
"type": 0,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"shell":"install.sh",
|
||||
"checks":"server/webssh",
|
||||
"path": "server/webssh",
|
||||
"author":"midoks",
|
||||
"author":"ssh",
|
||||
"home":"",
|
||||
"date":"2018-12-20",
|
||||
"pid":"4"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"sort": 7,
|
||||
"ps": "[DEV]网站统计报表[此插件开发完成后,需要反馈问题,不当小白鼠,慎用!]",
|
||||
"ps": "[DEV]网站统计报表[此插件-需要小白鼠反馈问题,慎用!]",
|
||||
"name": "webstats",
|
||||
"title": "网站统计",
|
||||
"shell": "install.sh",
|
||||
|
||||
@@ -244,6 +244,25 @@ wsPost('get_global_conf', '' ,{}, function(rdata){
|
||||
wsGlobalSetting();
|
||||
});
|
||||
|
||||
|
||||
$('#setAll').click(function(){
|
||||
var args = "name=webstats&func=reload";
|
||||
layer.confirm('您真的要同步所有站点吗?', {icon:3,closeBtn: 2}, function() {
|
||||
var e = layer.msg('正在同步,请稍候...', {icon: 16,time: 0});
|
||||
$.post("/plugins/run", args, function(g) {
|
||||
layer.close(e);
|
||||
if( g.status && g.data != 'ok' ) {
|
||||
layer.msg(g.data, {icon: 2,time: 3000,shade: 0.3,shadeClose: true});
|
||||
} else {
|
||||
layer.msg('同步成功!', {icon: 1,time: 0});
|
||||
}
|
||||
},'json').error(function() {
|
||||
layer.close(e);
|
||||
layer.msg('操作异常!', {icon: 1});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
///////////////////////////////////////////////
|
||||
|
||||
@@ -61,7 +61,7 @@ def createBgTask():
|
||||
import crontab_api
|
||||
api = crontab_api.crontab_api()
|
||||
|
||||
cmd = "cd " + mw.getServerDir() + "/mdserver-web && nice -n 10 python3 " + \
|
||||
cmd = "cd " + mw.getRunDir() + " && nice -n 10 python3 " + \
|
||||
getPluginDir() + "/tool_task.py execute"
|
||||
params = {
|
||||
'name': name,
|
||||
|
||||
@@ -26,13 +26,26 @@ function closePanel(){
|
||||
}}, function() {
|
||||
$.post('/config/close_panel','',function(rdata){
|
||||
layer.msg(rdata.msg,{icon:rdata.status?1:2});
|
||||
setTimeout(function(){window.location.reload();},1000);
|
||||
setTimeout(function(){
|
||||
window.location.reload();
|
||||
},1000);
|
||||
},'json');
|
||||
},function(){
|
||||
$("#closePl").prop("checked",false);
|
||||
});
|
||||
}
|
||||
|
||||
//开发模式
|
||||
function debugMode(){
|
||||
var loadT = layer.msg('正在发送请求,请稍候...', { icon: 16, time: 0, shade: [0.3, '#000'] });
|
||||
$.post('/config/open_debug', {}, function (rdata) {
|
||||
layer.close(loadT);
|
||||
showMsg(rdata.msg, function(){
|
||||
window.location.reload();
|
||||
} ,{icon:rdata.status?1:2}, 1000);
|
||||
},'json');
|
||||
}
|
||||
|
||||
|
||||
function modifyAuthPath() {
|
||||
var auth_path = $("#admin_path").val();
|
||||
|
||||
@@ -201,8 +201,7 @@ function planAdd(){
|
||||
|
||||
var type = $(".plancycle").find("b").attr("val");
|
||||
$("#set-Config input[name='type']").val(type);
|
||||
|
||||
var where1 = $("#ptime input[name='where1']").val();
|
||||
|
||||
|
||||
var is1;
|
||||
var is2 = 1;
|
||||
@@ -304,6 +303,11 @@ function planAdd(){
|
||||
allAddCrontab(dataList,0,'');
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == 'minute-n'){
|
||||
var where1 = $("#ptime input[name='where1']").val();
|
||||
$("#set-Config input[name='where1']").val(where1);
|
||||
}
|
||||
|
||||
$("#set-Config input[name='sName']").val(sName);
|
||||
layer.msg('正在添加,请稍候...!',{icon:16,time:0,shade: [0.3, '#000']});
|
||||
|
||||
+35
-11
@@ -65,6 +65,7 @@ function getLoad(data) {
|
||||
$('#LoadList .circle').click(function() {
|
||||
getNet();
|
||||
});
|
||||
|
||||
$('#LoadList .mask').hover(function() {
|
||||
var one, five, fifteen;
|
||||
var that = this;
|
||||
@@ -78,6 +79,32 @@ $('#LoadList .mask').hover(function() {
|
||||
});
|
||||
|
||||
|
||||
function showCpuTips(rdata){
|
||||
$('#cpuChart .mask').unbind();
|
||||
$('#cpuChart .mask').hover(function() {
|
||||
var cpuText = '';
|
||||
|
||||
if (rdata.cpu[2].length == 1){
|
||||
var cpuUse = parseFloat(rdata.cpu[2][0] == 0 ? 0 : rdata.cpu[2][0]).toFixed(1);
|
||||
cpuText += 'CPU-1:' + cpuUse + '%'
|
||||
} else{
|
||||
for (var i = 1; i < rdata.cpu[2].length + 1; i++) {
|
||||
var cpuUse = parseFloat(rdata.cpu[2][i - 1] == 0 ? 0 : rdata.cpu[2][i - 1]).toFixed(1);
|
||||
if (i % 2 != 0) {
|
||||
cpuText += 'CPU-' + i + ':' + cpuUse + '% | '
|
||||
} else {
|
||||
cpuText += 'CPU-' + i + ':' + cpuUse + '%'
|
||||
cpuText += '\n'
|
||||
}
|
||||
}
|
||||
}
|
||||
layer.tips(rdata.cpu[3] + "</br>" + rdata.cpu[5] + "个物理CPU," + (rdata.cpu[4]) + "个物理核心," + rdata.cpu[1] + "个逻辑核心</br>" + cpuText, this, { time: 0, tips: [1, '#999'] });
|
||||
}, function() {
|
||||
layer.closeAll('tips');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function rocket(sum, m) {
|
||||
var n = sum - m;
|
||||
$(".mem-release").find(".mask span").text(n);
|
||||
@@ -249,9 +276,11 @@ function setcolor(pre, s, s1, s2, s3) {
|
||||
co.parent('.circle').css("background", LoadColor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function getNet() {
|
||||
var up;
|
||||
var down;
|
||||
var up, down;
|
||||
$.get("/system/network", function(net) {
|
||||
$("#InterfaceSpeed").html(lan.index.interfacespeed + ": 1.0Gbps");
|
||||
$("#upSpeed").html(net.up + ' KB');
|
||||
@@ -269,6 +298,8 @@ function getNet() {
|
||||
|
||||
// setMemImg(net.mem);
|
||||
setImg();
|
||||
|
||||
showCpuTips(net);
|
||||
},'json');
|
||||
}
|
||||
|
||||
@@ -457,6 +488,8 @@ function setImg() {
|
||||
$(this).find('.left').css('transform', "rotate(" + (num - 180) + "deg)");
|
||||
};
|
||||
});
|
||||
|
||||
$('.diskbox .mask').unbind();
|
||||
$('.diskbox .mask').hover(function() {
|
||||
layer.closeAll('tips');
|
||||
var that = this;
|
||||
@@ -478,16 +511,7 @@ setTimeout(function() {
|
||||
$('#toUpdate a').css("position","relative");
|
||||
return;
|
||||
}
|
||||
// $.get('/system?action=ReWeb', function() {});
|
||||
// layer.msg(rdata.msg, { icon: 1 });
|
||||
// setTimeout(function() {
|
||||
// window.location.reload();
|
||||
// }, 3000);
|
||||
},'json').error(function() {
|
||||
// $.get('/system?action=ReWeb', function() {});
|
||||
// setTimeout(function() {
|
||||
// window.location.reload();
|
||||
// }, 3000);
|
||||
});
|
||||
}, 3000);
|
||||
|
||||
|
||||
@@ -1698,12 +1698,22 @@ function pluginConfig(_name, version, func){
|
||||
<ul class="help-info-text c7 ptb15">\
|
||||
<li>此处为'+ _name + version +'主配置文件,若您不了解配置规则,请勿随意修改。</li>\
|
||||
</ul>';
|
||||
$(".soft-man-con").html(con);
|
||||
|
||||
|
||||
var loadT = layer.msg('配置文件路径获取中...',{icon:16,time:0,shade: [0.3, '#000']});
|
||||
$.post('/plugins/run', {name:_name, func:func_name,version:version},function (data) {
|
||||
layer.close(loadT);
|
||||
|
||||
try{
|
||||
var jdata = $.parseJSON(data.data);
|
||||
if (!jdata['status']){
|
||||
layer.msg(jdata.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
}catch(err){/*console.log(err);*/}
|
||||
|
||||
$(".soft-man-con").html(con);
|
||||
|
||||
var loadT2 = layer.msg('文件内容获取中...',{icon:16,time:0,shade: [0.3, '#000']});
|
||||
var fileName = data.data;
|
||||
$.post('/files/get_body', 'path=' + fileName, function(rdata) {
|
||||
@@ -1957,6 +1967,15 @@ function pluginLogs(_name, version, func, line){
|
||||
$.post('/plugins/run', {name:_name, func:func_name, version:version},function (data) {
|
||||
layer.close(loadT);
|
||||
|
||||
try{
|
||||
var jdata = $.parseJSON(data.data);
|
||||
if (!jdata['status']){
|
||||
layer.msg(jdata.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
return;
|
||||
}
|
||||
}catch(err){/*console.log(err);*/}
|
||||
|
||||
|
||||
var loadT2 = layer.msg('文件内容获取中...',{icon:16,time:0,shade: [0.3, '#000']});
|
||||
var fileName = data.data;
|
||||
$.post('/files/get_last_body', 'path=' + fileName+'&line='+file_line, function(rdata) {
|
||||
|
||||
@@ -338,6 +338,7 @@ function webPathEdit(id){
|
||||
var userini = data['data'];
|
||||
var webpath = userini['path'];
|
||||
var siteName = userini['name'];
|
||||
var runPath = userini['runPath']['runPath'];
|
||||
var userinicheckeds = userini.userini?'checked':'';
|
||||
var logscheckeds = userini.logs?'checked':'';
|
||||
var opt = ''
|
||||
@@ -385,7 +386,10 @@ function webPathEdit(id){
|
||||
|
||||
$("#webedit-con").html(webPathHtml);
|
||||
$("#userini").change(function(){
|
||||
$.post('/site/set_dir_user_ini','path='+webpath,function(userini){
|
||||
$.post('/site/set_dir_user_ini',{
|
||||
'path':webpath,
|
||||
'runPath':runPath,
|
||||
},function(userini){
|
||||
layer.msg(userini.msg+'<p style="color:red;">注意:设置防跨站需要重启PHP才能生效!</p>',{icon:userini.status?1:2});
|
||||
tryRestartPHP(siteName);
|
||||
},'json');
|
||||
@@ -2601,16 +2605,28 @@ function setSizeClassType(){
|
||||
// 尝试重启PHP
|
||||
function tryRestartPHP(siteName){
|
||||
$.post('/site/get_site_php_version','siteName='+siteName,function(data){
|
||||
var phpversion = data.phpversion;
|
||||
|
||||
if (data.phpversion == "00"){
|
||||
if (phpversion == "00"){
|
||||
return
|
||||
}
|
||||
|
||||
var reqData = {name:'php', func:'restart'}
|
||||
reqData['version'] = data.phpversion;
|
||||
var php_sign = 'php';
|
||||
if (phpversion.indexOf('yum') > -1){
|
||||
php_sign = 'php-yum';
|
||||
phpversion = phpversion.replace('yum','');
|
||||
}
|
||||
|
||||
if (phpversion.indexOf('apt') > -1){
|
||||
php_sign = 'php-apt';
|
||||
phpversion = phpversion.replace('apt','');
|
||||
}
|
||||
|
||||
var reqData = {name: php_sign, func:'restart'}
|
||||
reqData['version'] = phpversion;
|
||||
|
||||
// console.log(reqData);
|
||||
var loadT = layer.msg('尝试自动重启PHP['+data.phpversion+']...', { icon: 16, time: 0, shade: 0.3 });
|
||||
var loadT = layer.msg('尝试自动重启PHP['+phpversion+']...', { icon: 16, time: 0, shade: 0.3 });
|
||||
$.post('/plugins/run', reqData, function(data) {
|
||||
layer.close(loadT);
|
||||
layer.msg(data.msg,{icon:data.status?1:2,time:3000,shade: [0.3, '#000']});
|
||||
|
||||
@@ -18,6 +18,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ss-text pull-left mr50">
|
||||
<em>开发模式</em>
|
||||
<div class="ssh-item">
|
||||
<input class="btswitch btswitch-ios" id="debugMode" type="checkbox" {{data['debug']}}>
|
||||
<label class="btswitch-btn" for="debugMode" onclick="debugMode()"></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ss-text pull-left mr50">
|
||||
<em title="开启后允许使用ipv6访问面板">监听IPv6</em>
|
||||
<div class='ssh-item'>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
</div>
|
||||
<h4 id="LoadState" class="c5 f15">获取中...</h4>
|
||||
</li>
|
||||
<li class="col-xs-6 col-sm-3 col-md-3 col-lg-2 mtb20 circle-box text-center">
|
||||
<li class="col-xs-6 col-sm-3 col-md-3 col-lg-2 mtb20 circle-box text-center" id="cpuChart">
|
||||
<h3 class="c5 f15">CPU使用率</h3>
|
||||
<div class="circle">
|
||||
<div class="pie_left">
|
||||
|
||||
@@ -226,12 +226,13 @@ case "$1" in
|
||||
echo 'True' > $mw_path/data/ipv6.pl
|
||||
address="MW-Panel-Url: http://[$v6]:$port$auth_path"
|
||||
else
|
||||
address="No v4 or v6 available"
|
||||
address="MW-Panel-Url: http://you-network-ip:$port$auth_path"
|
||||
fi
|
||||
else
|
||||
address="MW-Panel-Url: http://$address:$port$auth_path"
|
||||
fi
|
||||
|
||||
show_panel_ip="$port|"
|
||||
echo -e "=================================================================="
|
||||
echo -e "\033[32mMW-Panel default info!\033[0m"
|
||||
echo -e "=================================================================="
|
||||
@@ -239,8 +240,8 @@ case "$1" in
|
||||
echo -e `python3 $mw_path/tools.py username`
|
||||
echo -e "password: $password"
|
||||
echo -e "\033[33mWarning:\033[0m"
|
||||
echo -e "\033[33mIf you cannot access the panel, \033[0m"
|
||||
echo -e "\033[33mrelease the following port (7200|888|80|443|22) in the security group\033[0m"
|
||||
echo -e "\033[33mIf you cannot access the panel. \033[0m"
|
||||
echo -e "\033[33mrelease the following port (${show_panel_ip}888|80|443|22) in the security group.\033[0m"
|
||||
echo -e "=================================================================="
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -26,7 +26,7 @@ if [ -f /etc/init.d/iptables ];then
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT
|
||||
service iptables save
|
||||
@@ -50,7 +50,7 @@ if [ ! -f /etc/init.d/iptables ];then
|
||||
firewall-cmd --permanent --zone=public --add-port=80/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=443/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=888/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ if [ -f /etc/init.d/iptables ];then
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT
|
||||
service iptables save
|
||||
@@ -60,7 +60,7 @@ if [ ! -f /etc/init.d/iptables ];then
|
||||
firewall-cmd --permanent --zone=public --add-port=80/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=443/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=888/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ if [ -f /etc/init.d/iptables ];then
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT
|
||||
service iptables save
|
||||
@@ -89,7 +89,7 @@ if [ ! -f /etc/init.d/iptables ];then
|
||||
firewall-cmd --permanent --zone=public --add-port=80/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=443/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=888/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ if [ -f /etc/init.d/iptables ];then
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT
|
||||
service iptables save
|
||||
@@ -61,7 +61,7 @@ if [ ! -f /etc/init.d/iptables ];then
|
||||
firewall-cmd --permanent --zone=public --add-port=80/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=443/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=888/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ apt install -y expect
|
||||
apt install -y locate
|
||||
locale-gen en_US.UTF-8
|
||||
localedef -v -c -i en_US -f UTF-8 en_US.UTF-8
|
||||
# sudo localedef -i en_US -f UTF-8 en_US.UTF-8
|
||||
|
||||
if [ ! -d /root/.acme.sh ];then
|
||||
curl https://get.acme.sh | sh
|
||||
@@ -41,7 +42,7 @@ if [ -f /usr/sbin/ufw ];then
|
||||
ufw allow 80/tcp
|
||||
ufw allow 443/tcp
|
||||
ufw allow 888/tcp
|
||||
ufw allow 7200/tcp
|
||||
# ufw allow 7200/tcp
|
||||
# ufw allow 3306/tcp
|
||||
# ufw allow 30000:40000/tcp
|
||||
|
||||
@@ -63,7 +64,7 @@ if [ ! -f /usr/sbin/ufw ];then
|
||||
firewall-cmd --permanent --zone=public --add-port=80/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=443/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=888/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ if [ -f /etc/init.d/iptables ];then
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT
|
||||
service iptables save
|
||||
@@ -55,7 +55,7 @@ if [ "${isVersion}" == '' ];then
|
||||
firewall-cmd --permanent --zone=public --add-port=80/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=443/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=888/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
|
||||
firewall-cmd --reload
|
||||
|
||||
@@ -51,7 +51,7 @@ if [ -f /etc/init.d/iptables ];then
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT
|
||||
service iptables save
|
||||
@@ -75,7 +75,7 @@ if [ ! -f /etc/init.d/iptables ];then
|
||||
firewall-cmd --permanent --zone=public --add-port=80/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=443/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=888/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ if [ -f /etc/init.d/iptables ];then
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT
|
||||
service iptables save
|
||||
@@ -86,7 +86,7 @@ if [ ! -f /etc/init.d/iptables ];then
|
||||
firewall-cmd --permanent --zone=public --add-port=80/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=443/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=888/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ if [ -f /etc/init.d/iptables ];then
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT
|
||||
service iptables save
|
||||
@@ -55,7 +55,7 @@ if [ ! -f /etc/init.d/iptables ];then
|
||||
firewall-cmd --permanent --zone=public --add-port=80/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=443/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=888/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ if [ -f /usr/sbin/ufw ];then
|
||||
ufw allow 80/tcp
|
||||
ufw allow 443/tcp
|
||||
ufw allow 888/tcp
|
||||
ufw allow 7200/tcp
|
||||
# ufw allow 7200/tcp
|
||||
# ufw allow 3306/tcp
|
||||
# ufw allow 30000:40000/tcp
|
||||
|
||||
@@ -51,7 +51,7 @@ if [ ! -f /usr/sbin/ufw ];then
|
||||
firewall-cmd --permanent --zone=public --add-port=80/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=443/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=888/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
|
||||
|
||||
|
||||
+2
-1
@@ -104,7 +104,8 @@ fi
|
||||
#面板需要的库
|
||||
|
||||
if [ ! -f /usr/local/bin/pip3 ];then
|
||||
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
|
||||
# python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
|
||||
python3 -m pip install --upgrade pip setuptools wheel -i https://pypi.python.org/pypi
|
||||
fi
|
||||
|
||||
pip install --upgrade pip
|
||||
|
||||
@@ -34,6 +34,14 @@ else
|
||||
echo "php74 alreay exist!"
|
||||
fi
|
||||
|
||||
|
||||
# swap
|
||||
if [ ! -d /www/server/swap ];then
|
||||
cd /www/server/mdserver-web/plugins/swap && bash install.sh install 1.1
|
||||
else
|
||||
echo "swap alreay exist!"
|
||||
fi
|
||||
|
||||
# mysql
|
||||
if [ ! -d /www/server/mysql ];then
|
||||
cd /www/server/mdserver-web/plugins/mysql && bash install.sh install 5.6
|
||||
|
||||
+13
-5
@@ -3,7 +3,9 @@
|
||||
|
||||
import time
|
||||
import sys
|
||||
import random
|
||||
import os
|
||||
|
||||
chdir = os.getcwd()
|
||||
sys.path.append(chdir + '/class/core')
|
||||
|
||||
@@ -22,8 +24,9 @@ cpu_info = system_api.system_api().getCpuInfo()
|
||||
workers = cpu_info[1]
|
||||
|
||||
|
||||
if not os.path.exists(os.getcwd() + '/logs'):
|
||||
os.mkdir(os.getcwd() + '/logs')
|
||||
log_dir = os.getcwd() + '/logs'
|
||||
if not os.path.exists(log_dir):
|
||||
os.mkdir(log_dir)
|
||||
|
||||
# default port
|
||||
mw_port = "7200"
|
||||
@@ -31,6 +34,11 @@ if os.path.exists("data/port.pl"):
|
||||
mw_port = mw.readFile('data/port.pl')
|
||||
mw_port.strip()
|
||||
else:
|
||||
import firewall_api
|
||||
import common
|
||||
common.initDB()
|
||||
mw_port = str(random.randint(10000, 65530))
|
||||
firewall_api.firewall_api().addAcceptPortArgs(mw_port, 'WEB面板', 'port')
|
||||
mw.writeFile('data/port.pl', mw_port)
|
||||
|
||||
bind = []
|
||||
@@ -53,9 +61,9 @@ preload_app = True
|
||||
capture_output = True
|
||||
access_log_format = '%(t)s %(p)s %(h)s "%(r)s" %(s)s %(L)s %(b)s %(f)s" "%(a)s"'
|
||||
loglevel = 'info'
|
||||
errorlog = chdir + '/logs/error.log'
|
||||
accesslog = chdir + '/logs/access.log'
|
||||
pidfile = chdir + '/logs/mw.pid'
|
||||
errorlog = log_dir + '/error.log'
|
||||
accesslog = log_dir + '/access.log'
|
||||
pidfile = log_dir + '/mw.pid'
|
||||
if os.path.exists(os.getcwd() + '/data/ssl.pl'):
|
||||
certfile = 'ssl/certificate.pem'
|
||||
keyfile = 'ssl/privateKey.pem'
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user