代码恢复

pull/128/head
midoks 3 years ago
parent af32792bf1
commit fbac71e542
  1. 30
      .github/ISSUE_TEMPLATE/ISSUE_TEMPLATE_1.md
  2. 14
      .github/ISSUE_TEMPLATE/ISSUE_TEMPLATE_2.md
  3. 2
      .gitignore
  4. 2
      LICENSE
  5. 35
      README.md
  6. 12
      app.py
  7. 7
      class/core/common.py
  8. 2
      class/core/config_api.py
  9. 53
      class/core/mw.py
  10. 7
      class/core/plugins_api.py
  11. 38
      class/core/site_api.py
  12. 7
      class/core/system_api.py
  13. 2
      class/core/task_api.py
  14. 2
      cli.sh
  15. 2
      data/sql/default.sql
  16. 81
      mw-cli
  17. 2
      plugins/gogs/class/mysqlDb.py
  18. 4
      plugins/gogs/hook/commit.tpl
  19. 2
      plugins/gogs/index.html
  20. 144
      plugins/gogs/index.py
  21. 29
      plugins/gogs/init.d/gogs.service.bak.tpl
  22. 26
      plugins/gogs/init.d/gogs.service.tpl
  23. 19
      plugins/gogs/install.sh
  24. 2
      plugins/gogs/js/gogs.js
  25. 4
      plugins/mongodb/info.json
  26. 2
      plugins/mysql/class/mysqlDb.py
  27. 2
      plugins/mysql/conf/my.cnf
  28. 2
      plugins/mysql/conf/my5.7.cnf
  29. 2
      plugins/mysql/conf/my8.0.cnf
  30. 140
      plugins/mysql/index.py
  31. 32
      plugins/mysql/js/mysql.js
  32. 28
      plugins/mysql/versions/5.5/install.sh
  33. 29
      plugins/mysql/versions/5.6/install.sh
  34. 35
      plugins/mysql/versions/5.7/install.sh
  35. 41
      plugins/mysql/versions/8.0/install.sh
  36. 4
      plugins/op_waf/install.sh
  37. 4
      plugins/op_waf/waf/html/cookie.html
  38. 4
      plugins/op_waf/waf/html/get.html
  39. 4
      plugins/op_waf/waf/html/other.html
  40. 4
      plugins/op_waf/waf/html/post.html
  41. 4
      plugins/op_waf/waf/html/user_agent.html
  42. 15
      plugins/op_waf/waf/lua/init.lua
  43. 25
      plugins/openresty/index.py
  44. 14
      plugins/openresty/install.sh
  45. 43
      plugins/php/index.py
  46. 3
      plugins/php/js/php.js
  47. 2
      plugins/php/lib/zlib.sh
  48. 46
      plugins/php/versions/52/install.sh
  49. 14
      plugins/php/versions/53/install.sh
  50. 34
      plugins/php/versions/54/install.sh
  51. 4
      plugins/php/versions/55/install.sh
  52. 5
      plugins/php/versions/56/install.sh
  53. 8
      plugins/php/versions/70/install.sh
  54. 5
      plugins/php/versions/71/install.sh
  55. 5
      plugins/php/versions/72/install.sh
  56. 4
      plugins/php/versions/73/install.sh
  57. 12
      plugins/php/versions/74/install.sh
  58. 8
      plugins/php/versions/80/install.sh
  59. 4
      plugins/php/versions/81/install.sh
  60. 1
      plugins/phpmyadmin/conf/config.inc.php
  61. 1
      plugins/phpmyadmin/index.html
  62. 16
      plugins/phpmyadmin/index.py
  63. 3
      plugins/phpmyadmin/install.sh
  64. 10
      plugins/pureftp/index.py
  65. 2
      plugins/pureftp/info.json
  66. 13
      plugins/pureftp/init.d/pureftp.service.tpl
  67. 43
      plugins/pureftp/install.sh
  68. 9
      plugins/redis/index.py
  69. 21
      plugins/ssh-no-login/check-ssh.sh
  70. 1
      plugins/varnish/index.html
  71. 46
      plugins/varnish/index.py
  72. 63
      plugins/varnish/js/varnish.js
  73. 1
      plugins/xhprof/install.sh
  74. 8
      requirements.txt
  75. 59
      route/__init__.py
  76. 2
      route/static/app/config.js
  77. 2
      route/static/app/files.js
  78. 11
      route/static/app/public.js
  79. 2
      route/static/app/site.js
  80. 10
      route/static/app/soft.js
  81. 2
      route/static/css/site.css
  82. BIN
      route/static/img/soft_ico/ico-upyun.png
  83. BIN
      route/static/img/weixin_zz.jpg
  84. 10
      route/static/js/socket.io.min.js
  85. 1
      route/static/js/socket.io.min.js.map
  86. 139
      scripts/init.d/mw.tpl
  87. 14
      scripts/install.sh
  88. 76
      scripts/install/alma.sh
  89. 56
      scripts/install/centos.sh
  90. 67
      scripts/install/debian.sh
  91. 31
      scripts/install/fedora.sh
  92. 3
      scripts/install/macos.sh
  93. 42
      scripts/install/rocky.sh
  94. 46
      scripts/install/ubuntu.sh
  95. 13
      scripts/install_cn.sh
  96. 16
      scripts/install_dev.sh
  97. 67
      scripts/lib.sh
  98. 42
      scripts/quick/app.sh
  99. 89
      scripts/quick/debug.sh
  100. 8
      scripts/rememory.sh
  101. Some files were not shown because too many files have changed in this diff Show More

@ -0,0 +1,30 @@
---
name: BUG提交
about: 问题描述
---
## 什么系统 ?
Debian x, Centos x, Centos x stream, Ubuntu x?
## 错误信息 ?
Ex:
```bash
................start mw success
bash: line 149: ./scripts/init.d/mw: No such file or directory
```
## 错误截图 ?
...
## 浏览器版本 ?
...
## 软件版本(插件/面板) ?
...

@ -0,0 +1,14 @@
---
name: 需求提交
about: 需求描述
---
## 需求
想开发一个什么插件?
想有什么功能?
## 提供参考
给开发者提供参考!

2
.gitignore vendored

@ -130,3 +130,5 @@ include
data/api_login.txt
data/sessions
data/ssl.pl
plugins/gdrive/
plugins/openlitespeed/

@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Copyright [midoks] [midoks 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.

@ -2,14 +2,6 @@
简单的Linux面板,感谢BT.CN写出如此好的web管理软件。我一看到,就知道这是我一直想要的页面化管理方式。
复制了后台管理界面,按照自己想要的方式写了一版。
```
为了兼容CentOS,Ubuntu,Debian,Fedora, 由chkconfig改systemd管理。原来都要重新安装。还在进行修改..
chkconfig 支持 Fedora,CentOS
update-rc.d 支持 Ubuntu,Debian | 功能不够
systemd 支持 CentOS,Ubuntu,Debian,Fedora...
```
![CentOS](https://img.shields.io/badge/LINUX-CentOS-blue?style=for-the-badge&logo=CentOS)
![Ubuntu](https://img.shields.io/badge/LINUX-Ubuntu-blue?style=for-the-badge&logo=Ubuntu)
@ -22,7 +14,6 @@ systemd 支持 CentOS,Ubuntu,Debian,Fedora...
* 面板收藏功能
* 网站子目录绑定
* 网站备份功能
* 自动更新优化
* 插件方式管理
基本上可以使用,后续会继续优化!欢迎提供意见!
@ -48,9 +39,8 @@ systemd 支持 CentOS,Ubuntu,Debian,Fedora...
### 问题
- Ubuntu 20 无法安装mysql5.7 && mysql 80.
- Ftp debian无法安装成功。
- php52,在debian无法安装成功。
- OP防火墙,暂不要开启。
### GW使用
@ -82,6 +72,14 @@ curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/update_cn.s
```
### 通用安装
```
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/quick/app.sh | bash
```
### DEV使用
- 自动安装
@ -96,6 +94,8 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/in
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh | bash
```
### 微信赞助
[![截图](/route/static/img/weixin_zz.jpg)](/route/static/img/weixin_zz.jpg)
### 无图不真相
@ -109,10 +109,9 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/up
如果你自己写了插件,想分享出来,也可以提Issue。
```
- 开发文档 - https://github.com/midoks/mdserver-web/wiki/%E6%8F%92%E4%BB%B6%E5%BC%80%E5%8F%91
- 简单例子 - https://github.com/mw-plugin/simple-plugin
- 插件地址 - https://github.com/mw-plugin
- 例子 - https://github.com/mw-plugin/simple-plugin
- 开发文档 - https://github.com/midoks/mdserver-web/wiki/插件开发
### Stargazers over time
@ -120,11 +119,9 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/up
[![Stargazers over time](https://starchart.cc/midoks/mdserver-web.svg)](https://starchart.cc/midoks/mdserver-web)
### 感谢
- 开发赞助
### 感谢开发赞助
[digitalvirt](https://digitalvirt.com/)
[![digitalvirt](https://digitalvirt.com/templates/BlueWhite/img/logo-dark.svg)](https://digitalvirt.com/)
### 授权许可

@ -14,13 +14,19 @@ from geventwebsocket.handler import WebSocketHandler
try:
if __name__ == "__main__":
f = open('data/port.pl')
PORT = int(f.read())
HOST = '0.0.0.0'
PORT = 7200
if os.path.exists('data/port.pl'):
f = open('data/port.pl')
PORT = int(f.read())
f.close()
HOST = '0.0.0.0'
http_server = WSGIServer(
(HOST, PORT), app, handler_class=WebSocketHandler)
http_server.serve_forever()
socketio.run(app, host=HOST, port=PORT)
except Exception as ex:
print(ex)

@ -20,10 +20,9 @@ from flask import redirect
def init():
initDB()
initInitD()
initUserInfo()
initInitD()
def local():
@ -57,7 +56,6 @@ def doContentReplace(src, dst):
def initInitD():
mw.setHostAddr(mw.getLocalIp())
# systemctl
# 有问题
@ -97,6 +95,9 @@ def initInitD():
mw.execShell('which chkconfig && chkconfig --add mw')
mw.execShell('which update-rc.d && update-rc.d -f mw defaults')
# 获取系统IPV4
mw.setHostAddr(mw.getLocalIp())
def initUserInfo():

@ -18,7 +18,7 @@ class config_api:
# 本版解决自启动问题
# 文件管理重命名
# 优化计划任务管理
__version = '0.8.6'
__version = '0.8.6.1'
def __init__(self):
pass

@ -98,6 +98,23 @@ def isAppleSystem():
return False
def isNumber(s):
try:
float(s)
return True
except ValueError:
pass
try:
import unicodedata
unicodedata.numeric(s)
return True
except (TypeError, ValueError):
pass
return False
def deleteFile(file):
if os.path.exists(file):
os.remove(file)
@ -111,9 +128,22 @@ def isInstalledWeb():
def restartWeb():
if isInstalledWeb():
initd = getServerDir() + '/openresty/init.d/openresty'
if not isInstalledWeb():
return False
# systemd
systemd = '/lib/systemd/system/openresty.service'
if os.path.exists(systemd):
execShell('systemctl restart openresty')
return True
# initd
initd = getServerDir() + '/openresty/init.d/openresty'
if os.path.exists(initd):
execShell(initd + ' ' + 'restart')
return True
return False
def restartMw():
@ -540,7 +570,7 @@ def downloadHook(count, blockSize, totalSize):
print('%02d%%' % (100.0 * count * blockSize / totalSize))
def getLocalIp():
def getLocalIpBack():
# 取本地外网IP
try:
import re
@ -561,6 +591,23 @@ def getLocalIp():
return '127.0.0.1'
def getLocalIp():
# 取本地外网IP
try:
import re
filename = 'data/iplist.txt'
ipaddress = readFile(filename)
if not ipaddress or ipaddress == '127.0.0.1':
import urllib
url = 'https://v6r.ipip.net/?format=text'
req = urllib.request.urlopen(url, timeout=10)
ipaddress = req.read().decode('utf-8')
writeFile(filename, ipaddress)
return ipaddress
except Exception as ex:
return '127.0.0.1'
def inArray(arrays, searchStr):
# 搜索数据中是否存在
for key in arrays:

@ -48,6 +48,13 @@ class plugins_api:
def listApi(self):
sType = request.args.get('type', '0')
sPage = request.args.get('p', '1')
if not mw.isNumber(sPage):
sPage = 1
if not mw.isNumber(sType):
sType = 0
# print sPage
data = self.getPluginList(sType, int(sPage))
return mw.getJson(data)

@ -599,7 +599,11 @@ class site_api:
if not os.path.exists(acem):
return mw.returnJson(False, '尝试自动安装ACME失败,请通过以下命令尝试手动安装<p>安装命令: curl https://get.acme.sh | sh</p>' + acem)
force_bool = False
# 避免频繁执行
checkAcmeRun = mw.execShell('ps -ef|grep acme.sh |grep -v grep')
if checkAcmeRun[0] != '':
return mw.returnJson(False, '正在申请或更新SSL中...')
if force == 'true':
force_bool = True
@ -973,7 +977,7 @@ class site_api:
"-START(.|\n)+BINDING-" + domain + "-END"
tmp = re.search(rep, conf).group()
dirConf = tmp.replace('rewrite/' + site['name'] + '.conf;', 'rewrite/' + site[
'name'] + '_' + find['path'] + '.conf;')
'name'] + '_' + find['path'] + '.conf;')
conf = conf.replace(tmp, dirConf)
mw.writeFile(file, conf)
data = {}
@ -1522,9 +1526,13 @@ class site_api:
def getSecurity(self, sid, name):
filename = self.getHostConf(name)
conf = mw.readFile(filename)
if type(conf) == bool:
return mw.returnJson(False, '读取配置文件失败!')
data = {}
if conf.find('SECURITY-START') != -1:
rep = "#SECURITY-START(\n|.){1,500}#SECURITY-END"
rep = "#SECURITY-START(.|\n)*#SECURITY-END"
tmp = re.search(rep, conf).group()
data['fix'] = re.search(
"\(.+\)\$", tmp).group().replace('(', '').replace(')$', '').replace('|', ',')
@ -1549,22 +1557,22 @@ class site_api:
if os.path.exists(file):
conf = mw.readFile(file)
if conf.find('SECURITY-START') != -1:
rep = "\s{0,4}#SECURITY-START(\n|.){1,500}#SECURITY-END\n?"
rep = "\s{0,4}#SECURITY-START(\n|.)*#SECURITY-END\n?"
conf = re.sub(rep, '', conf)
mw.writeLog('网站管理', '站点[' + name + ']已关闭防盗链设置!')
else:
rconf = '''#SECURITY-START 防盗链配置
location ~ .*\.(%s)$
{
expires 30d;
access_log /dev/null;
valid_referers none blocked %s;
if ($invalid_referer){
return 404;
location ~ .*\.(%s)$
{
expires 30d;
access_log /dev/null;
valid_referers none blocked %s;
if ($invalid_referer){
return 404;
}
}
}
# SECURITY-END
include enable-php-''' % (fix.strip().replace(',', '|'), domains.strip().replace(',', ' '))
#SECURITY-END
include enable-php-''' % (fix.strip().replace(',', '|'), domains.strip().replace(',', ' '))
conf = re.sub("include\s+enable-php-", rconf, conf)
mw.writeLog('网站管理', '站点[' + name + ']已开启防盗链!')
mw.writeFile(file, conf)
@ -1615,6 +1623,8 @@ include enable-php-''' % (fix.strip().replace(',', '|'), domains.strip().replace
os.makedirs(path)
if not mw.isAppleSystem():
mw.execShell('chown -R www:www ' + path)
mw.writeFile(path + '/index.html', '已经开始工作!!!')
mw.execShell('chmod -R 755 ' + path)
def nginxAddDomain(self, webname, domain, port):

@ -102,12 +102,9 @@ class system_api:
return mw.returnJson(True, '正在重启服务器!')
##### ----- end ----- ###
@mw_async
def restartMw(self):
sleep(0.3)
# cmd = mw.getRunDir() + '/scripts/init.d/mw restart'
# print cmd
mw.execShell('service mw restart')
mw.writeFile('data/restart.pl', 'True')
return True
@mw_async
def restartServer(self):

@ -42,6 +42,8 @@ class task_api:
_page['tojs'] = 'remind'
_page['p'] = p
# return data
_ret['count'] = count
_ret['page'] = mw.getPage(_page)
return mw.getJson(_ret)

@ -24,8 +24,8 @@ mw_start_debug(){
}
mw_start_debug2(){
gunicorn -c setting.py app:app
python3 task.py &
gunicorn -b :7200 -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker -w 1 app:app
}

@ -49,7 +49,7 @@ INSERT INTO `firewall` (`id`, `port`, `ps`, `addtime`) VALUES
(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, '3306', 'MySQL端口', '0000-00-00 00:00:00');
(5, '443', 'HTTPS', '0000-00-00 00:00:00');

@ -0,0 +1,81 @@
#!/www/server/mdserver-web/bin/python
# description: mdserver-web cli tools
# ln -s /www/server/mdserver-web/mw-cli /usr/bin/mw-cli
import os
import sys
def mw_start():
"""
Start mdserver-web
"""
os.system('systemctl start mw')
print("服务已启动")
def mw_stop():
"""
stop mdserver-web
"""
os.system('systemctl stop mw')
print("服务已停止")
def mw_restart():
"""
restart mdserver-web
"""
os.system('systemctl restart mw')
print("服务已重启")
def mw_reset_username():
"""
reset mdserver-web username
"""
from tools import set_panel_username
user_name = input("请输入新的用户名: ")
set_panel_username(user_name)
def mw_reset_pwd():
"""
reset mdserver-web password
"""
from tools import set_panel_pwd
pwd = input("请输入新的密码: ")
set_panel_pwd(pwd, True)
if __name__ == '__main__':
os.chdir("/www/server/mdserver-web")
sys.path.append(os.getcwd() + "/class/core")
try:
str = '''
==== mdserver-web cli tools ====
1. 启动服务 2. 停止服务
3. 重启服务 4. 修改用户名
5. 修改密码
=================================
'''
if len(sys.argv) == 2:
sw = sys.argv[1]
else:
print(str)
sw = input("请输入您要进行的操作: ")
if sw == '1':
mw_start()
elif sw == '2':
mw_stop()
elif sw == '3':
mw_restart()
elif sw == '4':
mw_reset_username()
elif sw == '5':
mw_reset_pwd()
else:
print("操作不存在")
except KeyboardInterrupt:
print("\n操作已终止")

@ -21,7 +21,7 @@ class mysqlDb:
def __Conn(self):
'''连接MYSQL数据库'''
try:
socket = '/tmp/mysql.sock'
socket = '/www/server/mysql/mysql.sock'
try:
import MySQLdb
except Exception as ex:

@ -2,7 +2,7 @@
echo `date`
GITADDR="{$GITROOTURL}/{$USERNAME}/{$PROJECT}"
GITADDR="{$GITROOTURL}/{$USERNAME}/{$PROJECT}.git"
GIT_SDIR="{$CODE_DIR}"
GIT_USER_DIR="${GIT_SDIR}/{$USERNAME}"
@ -24,7 +24,7 @@ cd $GIT_PROJECT_DIR && git pull
# cd $GIT_PROJECT_DIR && env -i git pull origin master
#更新的目的地址
WEB_PATH={$WEB_ROOT}/{$USERNAME}/{$PROJECT}
mkdir -p $WEB_PATH

@ -3,7 +3,7 @@
<div class="bt-w-menu">
<p class="bgw" onclick="pluginService('gogs');">服务</p>
<p onclick="pluginInitD('gogs');">自启动</p>
<p onclick="pluginConfig('gogs',null, 'init_conf');">启动配置</p>
<!-- <p onclick="pluginConfig('gogs',null, 'init_conf');">启动配置</p> -->
<p onclick="gogsEdit();">手动编辑</p>
<p onclick="pluginConfig('gogs',null, 'conf');">配置文件</p>
<p onclick="gogsSetConfig();">配置修改</p>

@ -11,10 +11,11 @@ sys.path.append(os.getcwd() + "/class/core")
import mw
cmd = 'ls /usr/local/lib/ | grep python | cut -d \\ -f 1 | awk \'END {print}\''
info = mw.execShell(cmd)
p = "/usr/local/lib/" + info[0].strip() + "/site-packages"
sys.path.append(p)
# cmd = 'ls /usr/local/lib/ | grep python | cut -d \\ -f 1 | awk \'END {print}\''
# info = mw.execShell(cmd)
# p = "/usr/local/lib/" + info[0].strip() + "/site-packages"
# sys.path.append(p)
import psutil
@ -61,6 +62,13 @@ def getArgs():
return tmp
def checkArgs(data, ck=[]):
for i in range(len(ck)):
if not ck[i] in data:
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!'))
return (True, mw.returnJson(True, 'ok'))
def getInitdConfTpl():
path = getPluginDir() + "/init.d/gogs.tpl"
return path
@ -170,9 +178,14 @@ def getRootUrl():
content = mw.readFile(getConf())
rep = 'ROOT_URL\s*=\s*(.*)'
tmp = re.search(rep, content)
if not tmp:
return ''
return tmp.groups()[0]
if tmp:
return tmp.groups()[0]
rep = 'EXTERNAL_URL\s*=\s*(.*)'
tmp = re.search(rep, content)
if tmp:
return tmp.groups()[0]
return ''
def getSshPort():
@ -218,8 +231,7 @@ def getDbConfValue():
return r
def pMysqlDb():
conf = getDbConfValue()
def pMysqlDb(conf):
host = conf['HOST'].split(':')
conn = mysqlDb.mysqlDb()
@ -232,6 +244,53 @@ def pMysqlDb():
return conn
def pSqliteDb(conf):
# print(conf)
import db
psDb = db.Sql()
# 默认
gsdir = getServerDir() + '/data'
dbname = 'gogs'
if conf['PATH'][0] == '/':
# 绝对路径
pass
else:
path = conf['PATH'].split('/')
gsdir = getServerDir() + '/' + path[0]
dbname = path[1].split('.')[0]
# print(gsdir, dbname)
psDb.dbPos(gsdir, dbname)
return psDb
def getGogsDbType(conf):
if 'DB_TYPE' in conf:
return conf['DB_TYPE']
if 'TYPE' in conf:
return conf['TYPE']
return 'NONE'
def pQuery(sql):
conf = getDbConfValue()
gtype = getGogsDbType(conf)
if gtype == 'sqlite3':
db = pSqliteDb(conf)
data = db.query(sql, []).fetchall()
return data
elif gtype == 'mysql':
db = pMysqlDb(conf)
return db.query(sql)
print("仅支持mysql|sqlite3配置")
exit(0)
def isSqlError(mysqlMsg):
# 检测数据库执行错误
_mysqlMsg = str(mysqlMsg)
@ -255,37 +314,35 @@ def isSqlError(mysqlMsg):
return mw.returnData(True, 'OK')
def start():
def gogsOp(method):
file = initDreplace()
data = mw.execShell(__SR + file + ' start')
if not mw.isAppleSystem():
data = mw.execShell('systemctl ' + method + ' gogs')
if data[1] == '':
return 'ok'
return 'fail'
data = mw.execShell(__SR + file + ' ' + method)
if data[1] == '':
return 'ok'
return data[0]
def start():
return gogsOp('start')
def stop():
file = initDreplace()
data = mw.execShell(__SR + file + ' stop')
if data[1] == '':
return 'ok'
return data[1]
return gogsOp('stop')
def restart():
file = initDreplace()
data = mw.execShell(__SR + file + ' restart')
if data[1] == '':
return 'ok'
return data[1]
return gogsOp('restart')
def reload():
file = initDreplace()
data = mw.execShell(__SR + file + ' reload')
if data[1] == '':
return 'ok'
return data[1]
return gogsOp('reload')
def initdStatus():
@ -391,15 +448,13 @@ def userList():
import math
args = getArgs()
page = 1
page_size = 10
search = ''
if 'page' in args:
page = int(args['page'])
if 'page_size' in args:
page_size = int(args['page_size'])
data = checkArgs(args, ['page', 'page_size'])
if not data[0]:
return data[1]
page = int(args['page'])
page_size = int(args['page_size'])
search = ''
if 'search' in args:
search = args['search']
@ -407,17 +462,13 @@ def userList():
data['root_url'] = getRootUrl()
pm = pMysqlDb()
start = (page - 1) * page_size
list_count = pm.query('select count(id) as num from user')
list_count = pQuery('select count(id) as num from user')
count = list_count[0][0]
list_data = pm.query(
list_data = pQuery(
'select id,name,email from user order by id desc limit ' + str(start) + ',' + str(page_size))
page_info = {'count': count, 'p': page,
'row': page_size, 'tojs': 'gogsUserList'}
data['list'] = mw.getPage(page_info)
data['list'] = mw.getPage({'count': count, 'p': page,
'row': page_size, 'tojs': 'gogsUserList'})
data['page'] = page
data['page_size'] = page_size
data['page_count'] = int(math.ceil(count / page_size))
@ -542,8 +593,8 @@ def projectScriptLoad():
cc_content = mw.readFile(commit_tpl)
sshUrl = 'http://127.0.0.1:' + getHttpPort()
cc_content = cc_content.replace('{$GITROOTURL}', sshUrl)
gitPath = getRootPath()
cc_content = cc_content.replace('{$GITROOTURL}', gitPath)
cc_content = cc_content.replace('{$CODE_DIR}', codeDir)
cc_content = cc_content.replace('{$USERNAME}', user)
cc_content = cc_content.replace('{$PROJECT}', args['name'])
@ -620,8 +671,7 @@ def getTotalStatistics():
st = status()
data = {}
if st.strip() == 'start':
pm = pMysqlDb()
list_count = pm.query('select count(id) as num from repository')
list_count = pQuery('select count(id) as num from repository')
if list_count.find("error") > -1:
data['status'] = False

@ -0,0 +1,29 @@
[Unit]
Description=Gogs
After=network.target
[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
Type=simple
User=git
Group=git
WorkingDirectory={$SERVER_PATH}/gogs
ExecStart={$SERVER_PATH}/gogs/gogs web
ExecReload=/bin/kill -USR2 $MAINPID
Restart=always
Environment=USER=git HOME=/home/git
# Some distributions may not support these hardening directives. If you cannot start the service due
# to an unknown option, comment out the ones not supported by your version of systemd.
ProtectSystem=full
PrivateDevices=yes
PrivateTmp=yes
NoNewPrivileges=true
[Install]
WantedBy=multi-user.target

@ -1,30 +1,12 @@
[Unit]
Description=Gogs
After=syslog.target
After=network.target
After=mariadb.service mysqld.service postgresql.service memcached.service redis.service
[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
Type=simple
User=root
Group=root
WorkingDirectory={$SERVER_PATH}/gogs
ExecStart={$SERVER_PATH}/gogs/gogs web
Restart=always
Environment=USER=git HOME=/home/git
# Some distributions may not support these hardening directives. If you cannot start the service due
# to an unknown option, comment out the ones not supported by your version of systemd.
ProtectSystem=full
PrivateDevices=yes
PrivateTmp=yes
NoNewPrivileges=true
Type=forking
ExecStart={$SERVER_PATH}/gogs/init.d/gogs start
ExecStop={$SERVER_PATH}/gogs/init.d/gogs stop
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target

@ -35,6 +35,16 @@ Install_gogs()
version=$1
os=`getOs`
# if id git &> /dev/null ;then
# echo "git uid is `id -u git`"
# echo "git shell is `grep "^git:" /etc/passwd |cut -d':' -f7 `"
# else
# groupadd git
# useradd -g git git
# fi
git config --global push.default simple
if [ "darwin" == "$os" ];then
file=gogs_${version}_darwin_amd64.zip
else
@ -47,8 +57,11 @@ Install_gogs()
cd $serverPath/source/gogs && unzip -o $file -d gogs_${version}
mv $serverPath/source/gogs/gogs_${version}/gogs/ $serverPath/gogs
echo $version > $serverPath/gogs/version.pl
if [ -d $serverPath/gogs ];then
echo $version > $serverPath/gogs/version.pl
fi
# if id -u gogs > /dev/null 2>&1; then
# echo "gogs user exists"
# else
@ -63,6 +76,10 @@ Install_gogs()
Uninstall_gogs()
{
rm -rf $serverPath/gogs
if [ -f /usr/lib/systemd/system/gogs.service ];then
systemctl stop gogs
rm -rf /usr/lib/systemd/system/gogs.service
fi
echo 'uninstall success' > $install_tmp
}

@ -317,7 +317,7 @@ function getRsaPublic(){
var rdata = $.parseJSON(data.data);
var con = '<div class="tab-con">\
<div class="myKeyCon ptb15">\
<textarea style="margin:0px;width:580px;height:110px;outline:none;" spellcheck="false">'+rdata.public+'</textarea>\
<textarea style="margin:0px;width:580px;height:110px;outline:none;" spellcheck="false">'+rdata.mw+'</textarea>\
</div>\
<ul class="help-info-text c7 pull-left"></ul>\
</div>'

@ -4,8 +4,8 @@
"name": "mongodb",
"title": "Mongodb",
"shell": "install.sh",
"versions":["4.4.14","5.0.9"],
"updates":["4.4.14","5.0.9"],
"versions":["4.4.14","5.0.4"],
"updates":["4.4.14","5.0.4"],
"tip": "soft",
"checks": "server/mongodb",
"path": "server/mongodb",

@ -30,7 +30,7 @@ class mysqlDb:
'''连接MYSQL数据库'''
try:
import mw
socket = '/tmp/mysql.sock'
socket = '/www/server/mysql/mysql.sock'
try:
import MySQLdb
except Exception as ex:

@ -80,7 +80,7 @@ innodb_write_io_threads = 1
innodb_file_per_table=1
secure-file-priv=/tmp
secure-file-priv={$SERVER_APP_PATH}/tmp
[mysqldump]
quick

@ -76,7 +76,7 @@ innodb_read_io_threads = 1
innodb_write_io_threads = 1
innodb_file_per_table=1
secure-file-priv=/tmp
secure-file-priv={$SERVER_APP_PATH}/tmp
[mysqldump]
quick

@ -77,7 +77,7 @@ innodb_write_io_threads = 1
innodb_file_per_table=1
binlog_expire_logs_seconds=2592000
secure-file-priv=/tmp
secure-file-priv={$SERVER_APP_PATH}/tmp
[mysqldump]
quick

@ -103,6 +103,8 @@ def getConf():
def getInitdTpl(version=''):
path = getPluginDir() + '/init.d/mysql' + version + '.tpl'
if not os.path.exists(path):
path = getPluginDir() + '/init.d/mysql.tpl'
return path
@ -161,6 +163,11 @@ def initDreplace(version=''):
if not os.path.exists(mysql_conf_dir):
os.mkdir(mysql_conf_dir)
mysql_tmp = getServerDir() + '/tmp'
if not os.path.exists(mysql_tmp):
os.mkdir(mysql_tmp)
mw.execShell("chown -R mysql:mysql " + mysql_tmp)
mysql_conf = mysql_conf_dir + '/my.cnf'
if not os.path.exists(mysql_conf):
mysql_conf_tpl = getPluginDir() + '/conf/my' + version + '.cnf'
@ -291,8 +298,8 @@ def initMysqlData():
cmd = 'cd ' + serverdir + ' && ./scripts/mysql_install_db --user=' + \
user + ' --basedir=' + serverdir + ' --ldata=' + datadir
mw.execShell(cmd)
return 0
return 1
return False
return True
def initMysql57Data():
@ -302,10 +309,10 @@ def initMysql57Data():
myconf = serverdir + "/etc/my.cnf"
user = pGetDbUser()
cmd = 'cd ' + serverdir + ' && ./bin/mysqld --defaults-file=' + myconf + \
' --initialize --explicit_defaults_for_timestamp'
' --initialize-insecure --explicit_defaults_for_timestamp'
mw.execShell(cmd)
return 0
return 1
return False
return True
def initMysql8Data():
@ -313,12 +320,16 @@ def initMysql8Data():
if not os.path.exists(datadir + '/mysql'):
serverdir = getServerDir()
user = pGetDbUser()
# cmd = 'cd ' + serverdir + ' && ./bin/mysqld --basedir=' + serverdir + ' --datadir=' + \
# datadir + ' --initialize'
cmd = 'cd ' + serverdir + ' && ./bin/mysqld --basedir=' + serverdir + ' --datadir=' + \
datadir + ' --initialize'
datadir + ' --initialize-insecure'
# print(cmd)
mw.execShell(cmd)
return 0
return 1
return False
return True
def initMysqlPwd():
@ -328,8 +339,8 @@ def initMysqlPwd():
pwd = mw.getRandomString(16)
cmd_pass = serverdir + '/bin/mysqladmin -uroot password ' + pwd
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))
mw.execShell(cmd_pass)
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))
return True
@ -347,62 +358,29 @@ def mysql8IsInitedPasswd():
def initMysql8Pwd():
is_start = False
for x in range(60):
data = mw.execShell(
"ps -ef|grep mysql|grep -v grep|grep -v py|grep -v init.d|awk '{print $2}'")
if data[0] != "":
# print("mysql start ok!")
is_start = True
break
time.sleep(0.5)
if not is_start:
# print("mysql start fail!")
return False
time.sleep(2)
serverdir = getServerDir()
pwd = mw.getRandomString(16)
pass_cmd = "cat " + serverdir + \
"/data/error.log | grep root@localhost | awk -F 'root@localhost:' '{print $2}'"
passdata = mw.execShell(pass_cmd)
password = passdata[0].strip()
if len(password) == 0:
return True
# print('localhost', 3306, 'root', password,
# "/www/server/mysql/mysql.sock")
# import MySQLdb as mdb
# dbconn = mdb.connect(host='localhost', port=3306, user='root',
# passwd=password, unix_socket="/www/server/mysql/mysql.sock")
# dbconn.autocommit(True)
# dbcurr = dbconn.cursor()
# dbcurr.execute('SET NAMES UTF8MB4')
# # with mysql_native_password
alter_root_pwd = 'flush privileges;'
alter_root_pwd = alter_root_pwd + \
"alter user 'root'@'localhost' IDENTIFIED by '" + pwd + "';"
alter_root_pwd = alter_root_pwd + \
"alter user 'root'@'localhost' IDENTIFIED WITH mysql_native_password by '" + pwd + "';"
alter_root_pwd = alter_root_pwd + "flush privileges;"
# dbcurr.execute(alter_root_pwd)
cmd_pass = serverdir + '/bin/mysqladmin -uroot password root'
data = mw.execShell(cmd_pass)
# print(data)
tmp_file = "/tmp/mysql_init_tmp.log"
mw.writeFile(tmp_file, alter_root_pwd)
cmd_pass = serverdir + '/bin/mysql --connect-expired-password -uroot -p"' + \
password + '" < ' + tmp_file
# print(cmd_pass)
cmd_pass = serverdir + '/bin/mysql -uroot -proot < ' + tmp_file
data = mw.execShell(cmd_pass)
if data[1].find("ERROR") != -1:
# print(data[1])
pass
else:
mw.writeFile(serverdir + "/data/error.log", "")
os.remove(tmp_file)
# print(data)
os.remove(tmp_file)
pSqliteDb('config').where('id=?', (1,)).save('mysql_root', (pwd,))
@ -413,9 +391,11 @@ def myOp(version, method):
# import commands
init_file = initDreplace()
try:
initData = initMysqlData()
if initData == 0:
isInited = initMysqlData()
if not isInited:
mw.execShell('systemctl start mysql')
initMysqlPwd()
mw.execShell('systemctl stop mysql')
mw.execShell('systemctl ' + method + ' mysql')
return 'ok'
@ -424,39 +404,46 @@ def myOp(version, method):
def my8cmd(version, method):
# mysql 8.0 and 5.7 ok
# mysql 8.0 and 5.7
init_file = initDreplace(version)
if version == '5.7':
initMysql57Data()
elif version == '8.0':
initMysql8Data()
cmd = init_file + ' ' + method
try:
if version == '5.7':
isInited = initMysql57Data()
elif version == '8.0':
isInited = initMysql8Data()
if not isInited:
if mw.isAppleSystem():
cmd_init_start = init_file + ' start'
subprocess.Popen(cmd_init_start, stdout=subprocess.PIPE, shell=True,
bufsize=4096, stderr=subprocess.PIPE)
if not mysql8IsInitedPasswd():
setSkipGrantTables(True)
cmd_init_start = init_file + ' start'
subprocess.Popen(cmd_init_start, stdout=subprocess.PIPE, shell=True,
bufsize=4096, stderr=subprocess.PIPE)
time.sleep(6)
else:
mw.execShell('systemctl start mysql')
time.sleep(6)
initMysql8Pwd()
cmd_init_stop = init_file + ' stop'
subprocess.Popen(cmd_init_stop, stdout=subprocess.PIPE, shell=True,
bufsize=4096, stderr=subprocess.PIPE)
setSkipGrantTables(False)
if mw.isAppleSystem():
cmd_init_stop = init_file + ' stop'
subprocess.Popen(cmd_init_stop, stdout=subprocess.PIPE, shell=True,
bufsize=4096, stderr=subprocess.PIPE)
time.sleep(3)
else:
mw.execShell('systemctl stop mysql')
time.sleep(3)
my8cmd(version, method)
if mw.isAppleSystem():
sub = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True,
bufsize=4096, stderr=subprocess.PIPE)
sub.wait(5)
else:
mw.execShell('systemctl ' + method + ' mysql')
return 'ok'
except Exception as e:
return str(e)
return 'fail'
def appCMD(version, action):
if version == '8.0' or version == '5.7':
@ -481,9 +468,8 @@ def reload(version=''):
def initdStatus():
if not app_debug:
if mw.isAppleSystem():
return "Apple Computer does not support"
if mw.isAppleSystem():
return "Apple Computer does not support"
shell_cmd = 'systemctl status mysql | grep loaded | grep "enabled;"'
data = mw.execShell(shell_cmd)
@ -673,7 +659,7 @@ def isSqlError(mysqlMsg):
# 检测数据库执行错误
mysqlMsg = str(mysqlMsg)
if "MySQLdb" in mysqlMsg:
return mw.returnJson(False, 'MySQLdb组件缺失! <br>进入SSH命令行输入: pip install mysql-python')
return mw.returnJson(False, 'MySQLdb组件缺失! <br>进入SSH命令行输入: pip install mysql-python | pip install mysqlclient==2.0.3')
if "2002," in mysqlMsg:
return mw.returnJson(False, '数据库连接失败,请检查数据库服务是否启动!')
if "2003," in mysqlMsg:

@ -805,6 +805,8 @@ function setDbPs(id, name, obj) {
function openPhpmyadmin(name,username,password){
data = syncPost('/plugins/check',{'name':'phpmyadmin'});
if (!data.status){
layer.msg(data.msg,{icon:2,shade: [0.3, '#000']});
return;
@ -815,7 +817,7 @@ function openPhpmyadmin(name,username,password){
layer.msg('phpMyAdmin未启动',{icon:2,shade: [0.3, '#000']});
return;
}
// console.log(data);
data = syncPost('/plugins/run',{'name':'phpmyadmin','func':'get_home_page'});
var rdata = $.parseJSON(data.data);
if (!rdata.status){
@ -830,16 +832,28 @@ function openPhpmyadmin(name,username,password){
return;
}
var murl = $("#toPHPMyAdmin").attr('action');
$("#pma_username").val(username);
$("#pma_password").val(password);
$("#db").val(name);
//检查版本
data = syncPost('/plugins/run',{'name':'phpmyadmin','func':'version'});
bigVer = data.data.split('.')[0]
if (bigVer>=5){
layer.msg('正在打开phpMyAdmin',{icon:16,shade: [0.3, '#000'],time:1000});
setTimeout(function(){
$("#toPHPMyAdmin").submit();
},3000);
layer.msg('phpMyAdmin['+data.data+']需要手动登录😭',{icon:16,shade: [0.3, '#000'],time:4000});
} else{
var murl = $("#toPHPMyAdmin").attr('action');
$("#pma_username").val(username);
$("#pma_password").val(password);
$("#db").val(name);
layer.msg('正在打开phpMyAdmin',{icon:16,shade: [0.3, '#000'],time:2000});
setTimeout(function(){
$("#toPHPMyAdmin").submit();
},2000);
setTimeout(function(){
$("#toPHPMyAdmin").submit();
},3000);
}
}
function delBackup(filename,name){

@ -14,16 +14,23 @@ sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
mysqlDir=${serverPath}/source/mysql
Install_mysql()
{
mkdir -p ${mysqlDir}
echo '正在安装脚本文件...' > $install_tmp
if id mysql &> /dev/null ;then
echo "mysql UID is `id -u www`"
echo "mysql Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
else
groupadd mysql
useradd -g mysql mysql
fi
if [ "$sysName" != "Darwin" ];then
mkdir -p /var/log/mariadb
touch /var/log/mariadb/mariadb.log
groupadd mysql
useradd -g mysql mysql
fi
if [ ! -f ${mysqlDir}/mysql-5.5.62.tar.gz ];then
@ -47,11 +54,18 @@ Install_mysql()
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
&& make && make install && make clean \
&& echo '5.5' > $serverPath/mysql/version.pl
echo '安装完成' > $install_tmp
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DCMAKE_C_COMPILER=/usr/bin/gcc \
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \
&& make ${MAKEJN:--j2} && make install && make clean
if [ -d $serverPath/mysql ];then
echo '5.5' > $serverPath/mysql/version.pl
echo '安装完成' > $install_tmp
else
echo '安装失败' > $install_tmp
fi
fi
}

@ -17,16 +17,23 @@ sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
mysqlDir=${serverPath}/source/mysql
Install_mysql()
{
mkdir -p ${mysqlDir}
echo '正在安装脚本文件...' > $install_tmp
if id mysql &> /dev/null ;then
echo "mysql UID is `id -u www`"
echo "mysql Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
else
groupadd mysql
useradd -g mysql mysql
fi
if [ "$sysName" != "Darwin" ];then
mkdir -p /var/log/mariadb
touch /var/log/mariadb/mariadb.log
groupadd mysql
useradd -g mysql mysql
fi
@ -51,11 +58,19 @@ Install_mysql()
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
&& make && make install && make clean
echo '5.6' > $serverPath/mysql/version.pl
echo '安装完成' > $install_tmp
-DDEFAULT_CHARSET=utf8mb4 \
-DCMAKE_C_COMPILER=/usr/bin/gcc \
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
&& make ${MAKEJN:--j2} && make install && make clean
if [ -d $serverPath/mysql ];then
echo '5.6' > $serverPath/mysql/version.pl
echo '安装完成' > $install_tmp
else
echo '安装失败' > $install_tmp
fi
fi
}

@ -19,22 +19,43 @@ mysqlDir=${serverPath}/source/mysql
VERSION="5.7.37"
Install_mysql()
{
mkdir -p ${mysqlDir}
echo '正在安装脚本文件...' > $install_tmp
if id mysql &> /dev/null ;then
echo "mysql UID is `id -u www`"
echo "mysql Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
else
groupadd mysql
useradd -g mysql mysql
fi
if [ "$sysName" != "Darwin" ];then
mkdir -p /var/log/mariadb
touch /var/log/mariadb/mariadb.log
groupadd mysql
useradd -g mysql mysql
fi
fi
if [ ! -f ${mysqlDir}/mysql-boost-${VERSION}.tar.gz ];then
wget -O ${mysqlDir}/mysql-boost-${VERSION}.tar.gz https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-boost-${VERSION}.tar.gz
fi
#检测文件是否损坏.
md5_mysql_ok=d0489fc3880248a58759c50bfb286dbb
if [ -f ${mysqlDir}/mysql-boost-${VERSION}.tar.gz ];then
md5_mysql=`md5sum ${mysqlDir}/mysql-boost-${VERSION}.tar.gz | awk '{print $1}'`
if [ "${md5_mysql_ok}" == "${md5_mysql}" ]; then
echo "mysql5.7 file check ok"
else
# 重新下载
rm -rf ${mysqlDir}/mysql-${VERSION}
wget -O ${mysqlDir}/mysql-boost-${VERSION}.tar.gz https://cdn.mysql.com/Downloads/MySQL-5.7/mysql-boost-${VERSION}.tar.gz
fi
fi
if [ ! -d ${mysqlDir}/mysql-${VERSION} ];then
cd ${mysqlDir} && tar -zxvf ${mysqlDir}/mysql-boost-${VERSION}.tar.gz
fi
@ -51,11 +72,13 @@ Install_mysql()
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DDOWNLOAD_BOOST=1 \
-DCMAKE_C_COMPILER=/usr/bin/gcc \
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \
-DWITH_BOOST=${mysqlDir}/mysql-${VERSION}/boost/
make && make install && make clean
make ${MAKEJN:--j2} && make install && make clean
echo '5.7' > $serverPath/mysql/version.pl
echo '安装完成' > $install_tmp
fi

@ -1,3 +1,5 @@
export MAKEJN=-j12
# -*- coding: utf-8 -*-
#!/bin/bash
@ -22,13 +24,19 @@ Install_mysql()
mkdir -p ${mysqlDir}
echo '正在安装脚本文件...' > $install_tmp
if id mysql &> /dev/null ;then
echo "mysql UID is `id -u www`"
echo "mysql Shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
else
groupadd mysql
useradd -g mysql mysql
fi
INSTALL_CMD=cmake
if [ "$sysName" != "Darwin" ];then
mkdir -p /var/log/mariadb
touch /var/log/mariadb/mariadb.log
groupadd mysql
useradd -g mysql mysql
INSTALL_CMD=cmake
fi
@ -36,10 +44,24 @@ Install_mysql()
wget -O ${mysqlDir}/mysql-boost-8.0.25.tar.gz https://cdn.mysql.com/archives/mysql-8.0/mysql-boost-8.0.25.tar.gz
fi
#检测文件是否损坏.
md5_mysql_ok=e142c2058313b4646c36fa9bb1b38493
if [ -f ${mysqlDir}/mysql-boost-8.0.25.tar.gz ];then
md5_mysql=`md5sum ${mysqlDir}/mysql-boost-8.0.25.tar.gz | awk '{print $1}'`
if [ "${md5_mysql_ok}" == "${md5_mysql}" ]; then
echo "mysql8.0 file check ok"
else
# 重新下载
rm -rf ${mysqlDir}/mysql-8.0.25
wget -O ${mysqlDir}/mysql-boost-8.0.25.tar.gz https://cdn.mysql.com/archives/mysql-8.0/mysql-boost-8.0.25.tar.gz
fi
fi
if [ ! -d ${mysqlDir}/mysql-8.0.25 ];then
cd ${mysqlDir} && tar -zxvf ${mysqlDir}/mysql-boost-8.0.25.tar.gz
fi
if [ ! -d $serverPath/mysql ];then
cd ${mysqlDir}/mysql-8.0.25 && ${INSTALL_CMD} \
-DCMAKE_INSTALL_PREFIX=$serverPath/mysql \
@ -52,13 +74,18 @@ Install_mysql()
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DDOWNLOAD_BOOST=1 \
-DFORCE_INSOURCE_BUILD=1 \
-DCMAKE_C_COMPILER=/usr/bin/gcc \
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \
-DWITH_BOOST=${mysqlDir}/mysql-8.0.25/boost/
make && make install && make clean
echo '8.0' > $serverPath/mysql/version.pl
make ${MAKEJN:--j2} && make install && make clean
if [ -d $serverPath/mysql ];then
echo '8.0' > $serverPath/mysql/version.pl
fi
echo '安装完成' > $install_tmp
fi
}

@ -15,8 +15,10 @@ Install_of(){
echo '正在安装脚本文件...' > $install_tmp
mkdir -p $serverPath/op_waf
mkdir -p $rootPath/wwwlogs/waf
if [ -f $serverPath/openresty ];then
mkdir -p $serverPath/openresty/nginx/conf/waf
fi
echo '0.1' > $serverPath/op_waf/version.pl
echo 'install ok' > $install_tmp
}

@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<title>网站防火墙</title>
<title>OP网站防火墙</title>
<style>
*{margin:0;padding:0;color:#444}
body{font-size:14px;font-family:"宋体"}
@ -18,7 +18,7 @@ ol li{line-height:30px}
<body>
<div class="main">
<div class="title">网站防火墙</div>
<div class="title">OP网站防火墙</div>
<div class="content">
<p class="t1">您的请求带有不合法参数,已被网站管理员设置拦截!</p>
<p class="t2">可能原因:</p>

@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<title>网站防火墙</title>
<title>OP网站防火墙</title>
<style>
*{margin:0;padding:0;color:#444}
body{font-size:14px;font-family:"宋体"}
@ -18,7 +18,7 @@ ol li{line-height:30px}
<body>
<div class="main">
<div class="title">网站防火墙</div>
<div class="title">OP网站防火墙</div>
<div class="content">
<p class="t1">您的请求带有不合法参数,已被网站管理员设置拦截!</p>
<p class="t2">可能原因:</p>

@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<title>网站防火墙</title>
<title>OP网站防火墙</title>
<style>
*{margin:0;padding:0;color:#444}
body{font-size:14px;font-family:"宋体"}
@ -18,7 +18,7 @@ ol li{line-height:30px}
<body>
<div class="main">
<div class="title">网站防火墙</div>
<div class="title">OP网站防火墙</div>
<div class="content">
<p class="t1">您的请求带有不合法参数,已被网站管理员设置拦截!</p>
<p class="t2">可能原因:</p>

@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<title>网站防火墙</title>
<title>OP网站防火墙</title>
<style>
*{margin:0;padding:0;color:#444}
body{font-size:14px;font-family:"宋体"}
@ -18,7 +18,7 @@ ol li{line-height:30px}
<body>
<div class="main">
<div class="title">网站防火墙</div>
<div class="title">OP网站防火墙</div>
<div class="content">
<p class="t1">您的请求带有不合法参数,已被网站管理员设置拦截!</p>
<p class="t2">可能原因:</p>

@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<title>网站防火墙</title>
<title>OP网站防火墙</title>
<style>
*{margin:0;padding:0;color:#444}
body{font-size:14px;font-family:"宋体"}
@ -18,7 +18,7 @@ ol li{line-height:30px}
<body>
<div class="main">
<div class="title">网站防火墙</div>
<div class="title">OP网站防火墙</div>
<div class="content">
<p class="t1">您的请求带有不合法参数,已被网站管理员设置拦截!</p>
<p class="t2">可能原因:</p>

@ -317,26 +317,35 @@ function post_data_chekc()
if C:return_post_data() then return false end
request_args = ngx.req.get_post_args()
if not request_args then return false end
if not request_header['Content-Type'] then return false end
av=string.match(request_header['Content-Type'],"=.+")
if request_header then
if not request_header['Content-Type'] then return false end
av = string.match(request_header['Content-Type'],"=.+")
end
if not av then return false end
ac=split(av,'=')
ac = split(av,'=')
if not ac then return false end
list_list=nil
for i,v in ipairs(ac)
do
list_list='--'..v
end
if not list_list then return false end
aaa=nil
for k,v in pairs(request_args)
do
aaa=v
end
if not aaa then return false end
if tostring(aaa) == 'true' then return false end
if type(aaa) ~= "string" then return false end
data_len=split(aaa,list_list)
--return return_message(200,data_len)
if not data_len then return false end
if arrlen(data_len) ==0 then return false end

@ -131,11 +131,14 @@ def confReplace():
content = content.replace('{$OS_USER}', user)
content = content.replace('{$OS_USER_GROUP}', user_group)
# 主配置文件
nconf = getServerDir() + '/nginx/conf/nginx.conf'
mw.writeFile(nconf, content)
__content = mw.readFile(nconf)
if __content.find('#user'):
mw.writeFile(getServerDir() + '/nginx/conf/nginx.conf', content)
# 静态配置
static_conf = getServerDir() + '/nginx/conf/enable-php-00.conf'
if not os.path.exists(static_conf):
mw.writeFile(static_conf, '')
# give nginx root permission
ng_exe_bin = getServerDir() + "/nginx/sbin/nginx"
@ -262,7 +265,21 @@ def initdUinstall():
def runInfo():
# 取Openresty负载状态
try:
result = mw.httpGet('http://127.0.0.1/nginx_status')
url = 'http://' + mw.getHostAddr() + '/nginx_status'
result = mw.httpGet(url)
tmp = result.split()
data = {}
data['active'] = tmp[2]
data['accepts'] = tmp[9]
data['handled'] = tmp[7]
data['requests'] = tmp[8]
data['Reading'] = tmp[11]
data['Writing'] = tmp[13]
data['Waiting'] = tmp[15]
return mw.getJson(data)
except Exception as e:
url = 'http://127.0.0.1/nginx_status'
result = mw.httpGet(url)
tmp = result.split()
data = {}
data['active'] = tmp[2]

@ -24,6 +24,7 @@ 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()
{
mkdir -p ${openrestyDir}
@ -37,14 +38,19 @@ Install_openresty()
cd ${openrestyDir} && tar -zxvf openresty-${VERSION}.tar.gz
# --with-openssl=$serverPath/source/lib/openssl-1.0.2q
cd ${openrestyDir}/openresty-${VERSION} && ./configure --prefix=$serverPath/openresty \
cd ${openrestyDir}/openresty-${VERSION} && ./configure \
--prefix=$serverPath/openresty \
--with-http_v2_module \
--with-http_ssl_module \
--with-http_slice_module \
--with-http_stub_status_module && make && make install && \
echo "${VERSION}" > $serverPath/openresty/version.pl
--with-http_stub_status_module
make && make install && make clean
if [ -d $serverPath/openresty ];then
echo "${VERSION}" > $serverPath/openresty/version.pl
echo "" > $serverPath/openresty/nginx/conf/enable-php-00.conf
fi
echo '安装完成' > $install_tmp
}

@ -521,25 +521,38 @@ def setFpmConfig(version):
def checkFpmStatusFile(version):
if mw.isInstalledWeb():
sdir = mw.getServerDir()
dfile = sdir + '/openresty/nginx/conf/php_status/phpfpm_status_' + version + '.conf'
if not os.path.exists(dfile):
tpl = getPluginDir() + '/conf/phpfpm_status.conf'
content = mw.readFile(tpl)
content = contentReplace(content, version)
mw.writeFile(dfile, content)
mw.restartWeb()
if not mw.isInstalledWeb():
return False
dfile = getServerDir() + '/nginx/conf/php_status/phpfpm_status_' + version + '.conf'
if not os.path.exists(dfile):
tpl = getPluginDir() + '/conf/phpfpm_status.conf'
content = mw.readFile(tpl)
content = contentReplace(content, version)
mw.writeFile(dfile, content)
mw.restartWeb()
return True
def getFpmStatus(version):
checkFpmStatusFile(version)
result = mw.httpGet(
'http://127.0.0.1/phpfpm_status_' + version + '?json')
tmp = json.loads(result)
fTime = time.localtime(int(tmp['start time']))
tmp['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime)
return mw.getJson(tmp)
try:
url = 'http://' + mw.getHostAddr() + '/phpfpm_status_' + version + '?json'
result = mw.httpGet(url)
data = json.loads(result)
fTime = time.localtime(int(data['start time']))
data['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime)
except Exception as e:
url = 'http://127.0.0.1/phpfpm_status_' + version + '?json'
result = mw.httpGet(url)
data = json.loads(result)
fTime = time.localtime(int(data['start time']))
data['start time'] = time.strftime('%Y-%m-%d %H:%M:%S', fTime)
except Exception as e:
data = {}
return mw.getJson(data)
def getDisableFunc(version):

@ -26,7 +26,8 @@ function phpPost(method, version, args,callback){
$.post('/plugins/run', req_data, function(data) {
layer.close(loadT);
if (!data.status){
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']});
//错误展示10S
layer.msg(data.msg,{icon:0,time:2000,shade: [10, '#000']});
return;
}

@ -13,7 +13,7 @@ rootPath=$(dirname "$rootPath")
SERVER_ROOT=$rootPath/lib
SOURCE_ROOT=$rootPath/source/lib
if [ ! -d ${SERVER_ROOT}/libiconv ];then
if [ ! -d ${SERVER_ROOT}/zlib ];then
cd $SOURCE_ROOT
if [ ! -f ${SOURCE_ROOT}/zlib-1.2.11.tar.gz ];then

@ -11,6 +11,46 @@ sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
_os=`uname`
echo "use system: ${_os}"
if [ ${_os} == "Darwin" ]; then
OSNAME='macos'
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
OSNAME='centos'
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
OSNAME='fedora'
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
OSNAME='rocky'
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then
OSNAME='alma'
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
OSNAME='debian'
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
OSNAME='ubuntu'
elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then
OSNAME='raspbian'
else
OSNAME='unknow'
fi
if [ "$OSNAME" == 'ubuntu' ] || [ "$OSNAME" == 'debian' ] ;then
apt install bison=2.4.1
if [ "$?" != "0" ]; then
echo 'The system version is too high to install'
exit 1
fi
apt install flex=2.5.4
if [ "$?" != "0" ]; then
echo 'The system version is too high to install'
exit 1
fi
fi
version=5.2.17
PHP_VER=52
Install_php()
@ -30,16 +70,16 @@ if [ ! -d $sourcePath/php/php${PHP_VER} ];then
fi
if [ ! -f $sourcePath/php/php-5.2.17-fpm-0.5.14.diff.gz ]; then
wget -O $sourcePath/php/php-5.2.17-fpm-0.5.14.diff.gz http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz
wget --no-check-certificate -O $sourcePath/php/php-5.2.17-fpm-0.5.14.diff.gz http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz
fi
if [ ! -f $sourcePath/php/php-5.2.17-max-input-vars.patch ]; then
wget -O $sourcePath/php/php-5.2.17-max-input-vars.patch https://raw.github.com/laruence/laruence.github.com/master/php-5.2-max-input-vars/php-5.2.17-max-input-vars.patch
wget --no-check-certificate -O $sourcePath/php/php-5.2.17-max-input-vars.patch https://raw.github.com/laruence/laruence.github.com/master/php-5.2-max-input-vars/php-5.2.17-max-input-vars.patch
fi
if [ ! -f $sourcePath/php/php-5.x.x.patch ]; then
wget -O $sourcePath/php/php-5.x.x.patch https://mail.gnome.org/archives/xml/2012-August/txtbgxGXAvz4N.txt
wget --no-check-certificate -O $sourcePath/php/php-5.x.x.patch https://mail.gnome.org/archives/xml/2012-August/txtbgxGXAvz4N.txt
fi

@ -11,6 +11,7 @@ sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
version=5.3.29
PHP_VER=53
Install_php()
@ -34,15 +35,6 @@ if [ ! -d $sourcePath/php/php${PHP_VER} ];then
fi
if [ -f $serverPath/php/53/bin/php.dSYM ];then
mv $serverPath/php/53/bin/php.dSYM $serverPath/php/53/bin/php
fi
if [ -f $serverPath/php/53/sbin/php-fpm.dSYM ];then
mv $serverPath/php/53/sbin/php-fpm.dSYM $serverPath/php/53/sbin/php-fpm
fi
if [ -f $serverPath/php/53/bin/php ];then
return
fi
@ -92,8 +84,8 @@ if [ ! -d $serverPath/php/53 ];then
--enable-sysvshm \
--disable-fileinfo \
$OPTIONS \
--enable-fpm \
&& make && make install && make clean
--enable-fpm
make clean && make ${MAKEJN:--j2} && make install && make clean
fi

@ -45,6 +45,7 @@ else
OPTIONS="${OPTIONS} --with-curl"
fi
if [ ! -d $serverPath/php/${PHP_VER} ];then
cd $sourcePath/php/php${PHP_VER} && ./configure \
--prefix=$serverPath/php/${PHP_VER} \
@ -67,8 +68,37 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then
--enable-sysvshm \
--disable-fileinfo \
$OPTIONS \
--enable-fpm \
&& make && make install && make clean
--enable-fpm
make clean && make ${MAKEJN:--j2}
#debian11,没有生成php54 man
if [ ! -f sapi/cli/php.1 ];then
cp -rf sapi/cli/php.1.in sapi/cli/php.1
fi
if [ ! -f sapi/cgi/php-cgi.1 ];then
cp -rf sapi/cgi/php-cgi.1.in sapi/cgi/php-cgi.1
fi
if [ ! -f scripts/man1/phpize.1 ];then
cp -rf scripts/man1/phpize.1.in scripts/man1/phpize.1
fi
if [ ! -f scripts/man1/php-config.1 ];then
cp -rf scripts/man1/php-config.1.in scripts/man1/php-config.1
fi
if [ ! -f ext/phar/phar.1 ];then
cp -rf ext/phar/phar.1.in ext/phar/phar.1
fi
if [ ! -f ext/phar/phar.phar.1 ];then
cp -rf ext/phar/phar.phar.1.in ext/phar/phar.phar.1
fi
make install && make clean
fi
#------------------------ install end ------------------------------------#

@ -67,8 +67,8 @@ if [ ! -d $serverPath/php/55 ];then
--disable-intl \
--disable-fileinfo \
$OPTIONS \
--enable-fpm \
&& make && make install && make clean
--enable-fpm
make clean && make ${MAKEJN:--j2} && make install && make clean
fi
#------------------------ install end ------------------------------------#

@ -44,6 +44,7 @@ else
OPTIONS="${OPTIONS} --with-curl"
fi
if [ ! -d $serverPath/php/56 ];then
cd $sourcePath/php/php${PHP_VER} && ./configure \
--prefix=$serverPath/php/56 \
@ -69,8 +70,8 @@ if [ ! -d $serverPath/php/56 ];then
--disable-intl \
--disable-fileinfo \
$OPTIONS \
--enable-fpm \
&& make clean && make && make install && make clean
--enable-fpm
make clean && make ${MAKEJN:--j2} && make install && make clean
fi
#------------------------ install end ------------------------------------#

@ -10,7 +10,7 @@ sourcePath=${serverPath}/source
sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
version=7.0.30
version=7.0.33
PHP_VER=70
Install_php()
{
@ -25,7 +25,7 @@ cd $serverPath/mdserver-web/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 http://au1.php.net/distributions/php-${version}.tar.xz
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php7/php-${version}.tar.xz
fi
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-${version}.tar.xz
@ -66,8 +66,8 @@ if [ ! -d $serverPath/php/70 ];then
--disable-intl \
--disable-fileinfo \
$OPTIONS \
--enable-fpm \
&& make && make install && make clean
--enable-fpm
make clean && make ${MAKEJN:--j2} && make install && make clean
fi
#------------------------ install end ------------------------------------#

@ -43,6 +43,7 @@ else
OPTIONS="${OPTIONS} --with-curl"
fi
if [ ! -d $serverPath/php/71 ];then
cd $sourcePath/php/php${PHP_VER} && ./configure \
--prefix=$serverPath/php/71 \
@ -65,8 +66,8 @@ if [ ! -d $serverPath/php/71 ];then
--disable-intl \
--disable-fileinfo \
$OPTIONS \
--enable-fpm \
&& make && make install && make clean
--enable-fpm
make clean && make ${MAKEJN:--j2} && make install && make clean
fi
#------------------------ install end ------------------------------------#

@ -44,6 +44,7 @@ else
OPTIONS="${OPTIONS} --with-curl"
fi
if [ ! -d $serverPath/php/72 ];then
cd $sourcePath/php/php${PHP_VER} && ./configure \
--prefix=$serverPath/php/72 \
@ -66,8 +67,8 @@ if [ ! -d $serverPath/php/72 ];then
--disable-intl \
--disable-fileinfo \
$OPTIONS \
--enable-fpm \
&& make && make install && make clean
--enable-fpm
make clean && make ${MAKEJN:--j2} && make install && make clean
fi
#------------------------ install end ------------------------------------#

@ -71,8 +71,8 @@ if [ ! -d $serverPath/php/73 ];then
--disable-intl \
--disable-fileinfo \
$OPTIONS \
--enable-fpm \
&& make && make install && make clean
--enable-fpm
make clean && make ${MAKEJN:--j2} && make install && make clean
fi
#------------------------ install end ------------------------------------#

@ -11,7 +11,7 @@ sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
version=7.4.30
version=7.4.26
PHP_VER=74
Install_php()
{
@ -28,7 +28,7 @@ cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash libzip.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 http://au1.php.net/distributions/php-${version}.tar.xz
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php7/php-${version}.tar.xz
fi
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-${version}.tar.xz
@ -49,13 +49,11 @@ if [ $sysName == 'Darwin' ]; then
export LDFLAGS="-L/usr/local/opt/libxml2/lib"
else
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
OPTIONS="${OPTIONS} --with-freetype-dir=${serverPath}/lib/freetype"
OPTIONS="${OPTIONS} --with-gd --enable-gd-native-ttf"
OPTIONS="${OPTIONS} --with-curl"
OPTIONS="${OPTIONS} --with-libzip=${serverPath}/lib/libzip"
fi
echo "$sourcePath/php/php${PHP_VER}"
if [ ! -d $serverPath/php/${PHP_VER} ];then
@ -81,8 +79,8 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then
--disable-intl \
--disable-fileinfo \
$OPTIONS \
--enable-fpm \
&& make && make install && make clean
--enable-fpm
make ${MAKEJN:--j2} && make install && make clean
fi
#------------------------ install end ------------------------------------#
}

@ -49,13 +49,9 @@ if [ $sysName == 'Darwin' ]; then
export LDFLAGS="-L/usr/local/opt/libxml2/lib"
else
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
OPTIONS="${OPTIONS} --with-freetype-dir=${serverPath}/lib/freetype"
OPTIONS="${OPTIONS} --with-gd"
OPTIONS="${OPTIONS} --with-curl"
OPTIONS="${OPTIONS} --with-libzip=${serverPath}/lib/libzip"
fi
echo "$sourcePath/php/php${PHP_VER}"
if [ ! -d $serverPath/php/${PHP_VER} ];then
@ -81,8 +77,8 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then
--disable-intl \
--disable-fileinfo \
$OPTIONS \
--enable-fpm \
&& make && make install && make clean
--enable-fpm
make clean && make ${MAKEJN:--j2} && make install && make clean
fi
#------------------------ install end ------------------------------------#
}

@ -82,8 +82,8 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then
--disable-intl \
--disable-fileinfo \
$OPTIONS \
--enable-fpm \
&& make && make install && make clean
--enable-fpm
make clean && make ${MAKEJN:--j2} && make install && make clean
fi
#------------------------ install end ------------------------------------#
}

@ -7,6 +7,7 @@ $cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['TempDir'] = '/www/server/phpmyadmin/tmp';
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
?>

@ -8,6 +8,7 @@
<p onclick="safeConf();">安全设置</p>
<p onclick="pluginLogs('phpmyadmin','','access_log');">访问日志</p>
<p onclick="pluginLogs('phpmyadmin','','error_log');">错误日志</p>
<p onclick="pluginConfig('phpmyadmin','','config_inc');" title="config.inc.php">配置</p>
</div>
<div class="bt-w-con pd15">
<div class="soft-man-con"></div>

@ -48,6 +48,10 @@ def getConf():
return mw.getServerDir() + '/web_conf/nginx/vhost/phpmyadmin.conf'
def getConfInc():
return getServerDir() + '/phpmyadmin/config.inc.php'
def getPort():
file = getConf()
content = mw.readFile(file)
@ -116,6 +120,10 @@ def start():
centent = contentReplace(centent)
mw.writeFile(file_run, centent)
tmp = getServerDir() + '/phpmyadmin/tmp'
if not os.path.exists(tmp):
os.mkdir(tmp)
conf_run = getServerDir() + '/phpmyadmin/config.inc.php'
if not os.path.exists(conf_run):
conf_tpl = getPluginDir() + '/conf/config.inc.php'
@ -208,6 +216,10 @@ def errorLog():
return '/www/server/phpmyadmin/error.log'
def Version():
return mw.readFile(getServerDir() + '/version.pl')
if __name__ == "__main__":
func = sys.argv[1]
if func == 'status':
@ -222,6 +234,10 @@ if __name__ == "__main__":
print(reload())
elif func == 'conf':
print(getConf())
elif func == 'version':
print(Version())
elif func == 'config_inc':
print(getConfInc())
elif func == 'get_home_page':
print(getHomePage())
elif func == 'set_php_ver':

@ -31,6 +31,9 @@ Install_phpmyadmin()
cp -r $serverPath/source/phpmyadmin/$FDIR $serverPath/phpmyadmin/
cd $serverPath/phpmyadmin/ && mv $FDIR phpmyadmin
mkdir -p $serverPath/phpmyadmin/tmp
chown -R www:www $serverPath/phpmyadmin/tmp
echo "${1}" > ${serverPath}/phpmyadmin/version.pl
echo '安装完成' > $install_tmp

@ -109,6 +109,16 @@ def initDreplace():
content = contentReplace(content)
mw.writeFile(pureFtpdConfig, content)
# systemd
systemDir = '/lib/systemd/system'
systemService = systemDir + '/pureftp.service'
systemServiceTpl = getPluginDir() + '/init.d/pureftp.service.tpl'
if os.path.exists(systemDir) and not os.path.exists(systemService):
se_content = mw.readFile(systemServiceTpl)
se_content = se_content.replace('{$SERVER_PATH}', service_path)
mw.writeFile(systemService, se_content)
mw.execShell('systemctl daemon-reload')
return file_bin

@ -3,7 +3,7 @@
"tip":"soft",
"name":"pureftp",
"ps":"一款免费FTP服务器软件",
"versions": "1.0.51",
"versions": "1.0.49",
"shell":"install.sh",
"checks":"server/pureftp",
"path":"server/pureftp",

@ -0,0 +1,13 @@
[Unit]
Description=Pure-FTPd is a fast, production-quality, standard-conformant FTP server
After=network.target
[Service]
Type=forking
ExecStart={$SERVER_PATH}/pureftp/sbin/pure-ftpd {$SERVER_PATH}/pureftp/etc/pure-ftpd.conf --daemonize
ExecStop=/bin/kill -HUP $MAINPID
ExecReload=/bin/kill -USR2 $MAINPID
Restart=on-failure
[Install]
WantedBy=multi-user.target

@ -30,28 +30,49 @@ fi
Install_pureftp()
{
mkdir -p ${serverPath}/pureftp
# mkdir -p ${serverPath}/pureftp
mkdir -p ${serverPath}/source/pureftp
# https://github.com/jedisct1/pure-ftpd/releases/download/1.0.49/pure-ftpd-1.0.49.tar.gz
# https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.49.tar.gz
# DOWNLOAD=https://github.com/jedisct1/pure-ftpd/releases/download/${VER}/pure-ftpd-${VER}.tar.gz
VER=$1
FILE=pure-ftpd-${VER}.tar.gz
FDIR=pure-ftpd-${VER}
DOWNLOAD=https://download.pureftpd.org/pub/pure-ftpd/releases/$FILE
DOWNLOAD=https://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-${VER}.tar.gz
if [ ! -f $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz ];then
wget --no-check-certificate -O $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz $DOWNLOAD
fi
if [ ! -f $serverPath/source/pureftp/$FILE ];then
wget -O $serverPath/source/pureftp/$FILE $DOWNLOAD
#检测文件是否损坏.
md5_ok=451879495ba61c1d7dcfca8dd231119f
if [ -f $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz ];then
md5_check=`md5sum $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz | awk '{print $1}'`
if [ "${md5_ok}" == "${md5_check}" ]; then
echo "pure-ftpd file check ok"
else
# 重新下载
rm -rf $serverPath/source/pureftp/pure-ftpd-${VER}
wget --no-check-certificate -O $serverPath/source/pureftp/pure-ftpd-${VER}.tar.gz $DOWNLOAD
fi
fi
if [ ! -d $serverPath/source/pureftp/$FDIR ];then
cd $serverPath/source/pureftp && tar zxvf $FILE
if [ ! -d $serverPath/source/pureftp/pure-ftpd-${VER} ];then
cd $serverPath/source/pureftp && tar zxvf pure-ftpd-${VER}.tar.gz
fi
cd $serverPath/source/pureftp/$FDIR && ./configure --prefix=${serverPath}/pureftp \
cd $serverPath/source/pureftp/pure-ftpd-${VER} && ./configure --prefix=${serverPath}/pureftp \
   --with-everything && make && make install && make clean
echo "${1}" > ${serverPath}/pureftp/version.pl
echo '安装完成' > $install_tmp
if [ -d ${serverPath}/pureftp ];then
echo "${1}" > ${serverPath}/pureftp/version.pl
echo '安装完成' > $install_tmp
else
echo '安装失败' > $install_tmp
fi
}
Uninstall_pureftp()

@ -96,9 +96,12 @@ def initDreplace():
# config replace
dst_conf = getServerDir() + '/redis.conf'
conf_content = mw.readFile(getConfTpl())
conf_content = conf_content.replace('{$SERVER_PATH}', service_path)
mw.writeFile(dst_conf, conf_content)
dst_conf_init = getServerDir() + '/init.pl'
if not os.path.exists(dst_conf_init):
conf_content = mw.readFile(getConfTpl())
conf_content = conf_content.replace('{$SERVER_PATH}', service_path)
mw.writeFile(dst_conf, conf_content)
mw.writeFile(dst_conf_init, 'ok')
# systemd
systemDir = '/lib/systemd/system'

@ -1,21 +0,0 @@
#! /bin/bash
#禁止弱口令登录改良版
cat /var/log/secure|awk '/Failed/{print $(NF-3)}'|sort|uniq -c|awk '{print $2"="$1;}' > black.txt #尝试登录的次数和ip
DEFINE="5" #单个ip尝试登录最大值
for i in `cat /root/black.txt`
do
IP=`echo $i |awk -F= '{print $1}'`
NUM=`echo $i|awk -F= '{print $2}'`
if [ $NUM -gt $DEFINE ]; then
grep $IP /etc/hosts.deny > /dev/null
if [ $? -gt 0 ]; then
echo "sshd:$IP" >> /etc/hosts.deny #扔到hosts文件中
fi
fi
done

@ -4,6 +4,7 @@
<p class="bgw" onclick="pluginService('varnish');">服务</p>
<p onclick="pluginInitD('varnish');">自启动</p>
<p onclick="pluginConfigTpl('varnish');">VCL</p>
<p onclick="varnishPluginConfig('varnish','','conf_service');">服务配置</p>
<p onclick="pluginLogs('varnish','','run_log');">日志</p>
<p onclick="varnishStatus();">状态</p>
</div>

@ -81,33 +81,29 @@ def status():
return 'start'
def start():
data = mw.execShell('systemctl start ' + getPluginName())
def vaOp(method):
mw.execShell("systemctl daemon-reload")
data = mw.execShell('systemctl ' + method + ' ' + getPluginName())
if data[1] == '':
return 'ok'
return 'fail'
def start():
return vaOp('start')
def stop():
data = mw.execShell('systemctl stop ' + getPluginName())
if data[1] == '':
return 'ok'
return 'fail'
return vaOp('stop')
def restart():
data = mw.execShell('systemctl restart ' + getPluginName())
if data[1] == '':
return 'ok'
return 'fail'
return vaOp('restart')
def reload():
# file = initDreplace()
data = mw.execShell('systemctl reload ' + getPluginName())
if data[1] == '':
return 'ok'
return 'fail'
return vaOp('reload')
def runInfo():
@ -138,9 +134,8 @@ def readConfigTpl():
def initdStatus():
if not app_debug:
if mw.isAppleSystem():
return "Apple Computer does not support"
if mw.isAppleSystem():
return "Apple Computer does not support"
shell_cmd = 'systemctl status ' + \
getPluginName() + ' | grep loaded | grep "enabled;"'
@ -151,19 +146,16 @@ def initdStatus():
def initdInstall():
import shutil
if not app_debug:
if mw.isAppleSystem():
return "Apple Computer does not support"
if mw.isAppleSystem():
return "Apple Computer does not support"
mw.execShell('systemctl enable ' + getPluginName())
return 'ok'
def initdUinstall():
if not app_debug:
if mw.isAppleSystem():
return "Apple Computer does not support"
if mw.isAppleSystem():
return "Apple Computer does not support"
mw.execShell('systemctl disable ' + getPluginName())
return 'ok'
@ -172,6 +164,10 @@ def initdUinstall():
def runLog():
return "/var/log/varnish/varnishncsa.log"
def confService():
return '/lib/systemd/system/varnish.service'
if __name__ == "__main__":
func = sys.argv[1]
if func == 'status':
@ -194,6 +190,8 @@ if __name__ == "__main__":
print(runInfo())
elif func == 'conf':
print(getConf())
elif func == 'conf_service':
print(confService())
elif func == 'run_log':
print(runLog())
elif func == 'config_tpl':

@ -9,7 +9,7 @@ function pRead(){
}
//redis负载状态 start
//varnish负载状态 start
function varnishStatus() {
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 });
$.post('/plugins/run', {name:'varnish', func:'run_info'}, function(data) {
@ -20,7 +20,7 @@ function varnishStatus() {
}
var rdata = $.parseJSON(data.data);
// console.log(rdata);
console.log(rdata);
var tmp = "";
for (let i in rdata) {
@ -41,4 +41,61 @@ function varnishStatus() {
$(".soft-man-con").html(Con);
},'json');
}
//redis负载状态 end
//varnish负载状态 end
//varnish service ---
function varnishPluginConfig(_name, version, func){
if ( typeof(version) == 'undefined' ){
version = '';
}
var func_name = 'conf';
if ( typeof(func) != 'undefined' ){
func_name = func;
}
var con = '<p style="color: #666; margin-bottom: 7px">提示Ctrl+F 搜索关键字Ctrl+G 查找下一个Ctrl+S 保存Ctrl+Shift+R 查找替换!</p>\
<textarea class="bt-input-text" style="height: 320px; line-height:18px;" id="textBody"></textarea>\
<button id="onlineEditFileBtn" class="btn btn-success btn-sm" style="margin-top:10px;">保存</button>\
<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);
var loadT2 = layer.msg('文件内容获取中...',{icon:16,time:0,shade: [0.3, '#000']});
var fileName = data.data;
$.post('/files/get_body', 'path=' + fileName, function(rdata) {
layer.close(loadT2);
if (!rdata.status){
layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']});
return;
}
$("#textBody").empty().text(rdata.data.data);
$(".CodeMirror").remove();
var editor = CodeMirror.fromTextArea(document.getElementById("textBody"), {
extraKeys: {
"Ctrl-Space": "autocomplete",
"Ctrl-F": "findPersistent",
"Ctrl-H": "replaceAll",
"Ctrl-S": function() {
$("#textBody").text(editor.getValue());
pluginConfigSave(fileName);
}
},
lineNumbers: true,
matchBrackets:true,
});
editor.focus();
$(".CodeMirror-scroll").css({"height":"300px","margin":0,"padding":0});
$("#onlineEditFileBtn").click(function(){
$("#textBody").text(editor.getValue());
pluginConfigSave(fileName);
});
},'json');
},'json');
}

@ -26,6 +26,7 @@ Uninstall_xh()
{
rm -rf ${serverPath}/xhprof
cd /tmp/xhprof && rm -rf *.xhprof
rm -f /www/server/web_conf/nginx/vhost/xhprof.conf
echo '卸载完成' > $install_tmp
}

@ -15,13 +15,13 @@ flask-sqlalchemy==2.3.2
cryptography==3.3.2
requests==2.20.0
ConfigParser==5.2.0
python-engineio==3.13.2
python-socketio==4.2.0
Flask-SocketIO==3.0.2
python-engineio==4.3.2
python-socketio>=4.2.0
flask-socketio==5.2.0
zmq==0.0.0
paramiko>=2.8.0
pymongo
pillow
Jinja2>=2.11.2
mysqlclient>=2.0.3
flask-caching>=1.10.1
mysql-connector-python

@ -315,7 +315,7 @@ def index(reqClass=None, reqAction=None, reqData=None):
'plugins_api', 'system_api', 'site_api', 'task_api')
className = reqClass + '_api'
if not className in classFile:
return "error"
return "api request error"
eval_str = "__import__('" + className + "')." + className + '()'
newInstance = eval(eval_str)
@ -323,13 +323,9 @@ def index(reqClass=None, reqAction=None, reqData=None):
return publicObject(newInstance, reqAction)
##################### ssh start ###########################
ssh = None
shell = None
try:
import paramiko
ssh = paramiko.SSHClient()
except:
mw.execShell('pip3 install paramiko &')
def create_rsa():
@ -340,12 +336,21 @@ def create_rsa():
def clear_ssh():
# 服务器IP
ip = mw.getHostAddr()
sh = '''
#!/bin/bash
PLIST=`who | grep localhost | awk '{print $2}'`
for i in $PLIST
do
ps -t /dev/$i |grep -v TTY |awk '{print $1}' | xargs kill -9
ps -t /dev/$i |grep -v TTY | awk '{print $1}' | xargs kill -9
done
#getHostAddr
PLIST=`who | grep "${ip}" | awk '{print $2}'`
for i in $PLIST
do
ps -t /dev/$i |grep -v TTY | awk '{print $1}' | xargs kill -9
done
'''
if not mw.isAppleSystem():
@ -355,21 +360,32 @@ done
def connect_ssh():
# print 'connect_ssh ....'
clear_ssh()
# clear_ssh()
global shell, ssh
if not os.path.exists('/root/.ssh/authorized_keys') or not os.path.exists('/root/.ssh/id_rsa') or not os.path.exists('/root/.ssh/id_rsa.pub'):
create_rsa()
# 检查是否写入authorized_keys
data = mw.execShell("cat /root/.ssh/id_rsa.pub | awk '{print $3}'")
if data[0] != "":
ak_data = mw.execShell(
"cat /root/.ssh/authorized_keys | grep " + data[0])
if ak_data[0] == "":
mw.execShell(
'cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys')
mw.execShell('chmod 600 /root/.ssh/authorized_keys')
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
ssh.connect('localhost', mw.getSSHPort())
ssh.connect(mw.getHostAddr(), mw.getSSHPort(), timeout=5)
except Exception as e:
if mw.getSSHStatus():
try:
ssh.connect('127.0.0.1', mw.getSSHPort())
except:
return False
ssh.connect('127.0.0.1', mw.getSSHPort())
except Exception as e:
ssh.connect('localhost', mw.getSSHPort())
except Exception as e:
return False
shell = ssh.invoke_shell(term='xterm', width=83, height=21)
shell.setblocking(0)
return True
@ -420,6 +436,7 @@ def connected_msg(msg):
ssh_success = True
if not shell:
ssh_success = connect_ssh()
# print(ssh_success)
if not ssh_success:
emit('server_response', {'data': '连接SSH服务失败!\r\n'})
return
@ -430,3 +447,17 @@ def connected_msg(msg):
except Exception as e:
pass
# print 'connected_msg:' + str(e)
if not mw.isAppleSystem():
try:
import paramiko
ssh = paramiko.SSHClient()
# 启动尝试时连接
# connect_ssh()
except Exception as e:
print("本地终端无法使用")
##################### ssh end ###########################

@ -209,7 +209,7 @@ function setIPv6() {
$.post('/config/set_ipv6_status', {}, function (rdata) {
layer.close(loadT);
layer.msg(rdata.msg, {icon:rdata.status?1:2});
setTimeout(function(){window.location.reload();},1500);
setTimeout(function(){window.location.reload();},5000);
},'json');
}

@ -1310,7 +1310,7 @@ function setChmod(action,fileName){
var chown = $("#chown").val();
var data = 'filename='+ encodeURIComponent(fileName)+'&user='+chown+'&access='+chmod;
var loadT = layer.msg('正在设置...',{icon:16,time:0,shade: [0.3, '#000']});
$.post('files/set_file_access',data,function(rdata){
$.post('/files/set_file_access',data,function(rdata){
layer.close(loadT);
if(rdata.status) layer.closeAll();
layer.msg(rdata.msg,{icon:rdata.status?1:2});

@ -1088,15 +1088,17 @@ function execLog(){
function remind(a){
a = a == undefined ? 1 : a;
$.post("/task/list", "table=tasks&result=2,4,6,8&limit=10&p=" + a, function(g) {
// console.log(g);
var e = "";
var f = false;
var task_count = 0;
for(var d = 0; d < g.data.length; d++) {
if(g.data[d].status != '1'){
task_count++;
continue;
e += '<tr><td><input type="checkbox"></td><td><div class="titlename c3">'+g.data[d].name+'</span><span class="rs-status">【'+lan.bt.task_the+'】<span><span class="rs-time">'+ lan.bt.time + (g.data[d].end - g.data[d].start) + lan.bt.s+'</span></div></td><td class="text-right c3">'+g.data[d].addtime+'</td></tr>'
} else{
e += '<tr><td><input type="checkbox"></td><td><div class="titlename c3">'+g.data[d].name+'</span><span class="rs-status">【'+lan.bt.task_ok+'】<span><span class="rs-time">'+ lan.bt.time + (g.data[d].end - g.data[d].start) + lan.bt.s+'</span></div></td><td class="text-right c3">'+g.data[d].addtime+'</td></tr>';
}
e += '<tr><td><input type="checkbox"></td><td><div class="titlename c3">'+g.data[d].name+'</span><span class="rs-status">【'+lan.bt.task_ok+'】<span><span class="rs-time">'+ lan.bt.time + (g.data[d].end - g.data[d].start) + lan.bt.s+'</span></div></td><td class="text-right c3">'+g.data[d].addtime+'</td></tr>'
}
var con = '<div class="divtable"><table class="table table-hover">\
<thead><tr><th width="20"><input id="Rs-checkAll" type="checkbox" onclick="RscheckSelect()"></th><th>'+lan.bt.task_name+'</th><th class="text-right">'+lan.bt.task_time+'</th></tr></thead>\
@ -1112,7 +1114,7 @@ function remind(a){
</div>';
$(".task_count").text(task_count);
$(".msg_count").text(g.data.length);
$(".msg_count").text(g.count);
$(".taskcon").html(con);
$("#taskPage").html(g.page);
@ -1592,7 +1594,8 @@ function pluginOpService(a, b, v) {
}
setTimeout(function(){
location.reload();
// location.reload();
getSList();
},2000);
},'json').error(function() {
layer.close(e);

@ -1085,7 +1085,7 @@ function setSecurity(name,id){
$.post('/site/set_security',data,function(rdata){
layer.close(loadT);
layer.msg(rdata.msg,{icon:rdata.status?1:2});
if(rdata.status) setTimeout(function(){Security(id,name);},1000);
if(rdata.status) setTimeout(function(){security(id,name);},1000);
},'json');
}

@ -33,7 +33,7 @@ function getSList(isdisplay) {
var loadT = layer.msg('正在获取列表...', { icon: 16, time: 0, shade: [0.3, '#000'] })
}
if (!isdisplay || isdisplay === true)
isdisplay = getCookie('p' + getCookie('softType'));
isdisplay = getCookie('p' + getCookie('soft_type'));
if (isdisplay == true || isdisplay == 'true') isdisplay = 1;
var search = $("#SearchValue").val();
@ -41,7 +41,7 @@ function getSList(isdisplay) {
search = '&search=' + search;
}
var type = '';
var istype = getCookie('softType');
var istype = getCookie('soft_type');
if (istype == 'undefined' || istype == 'null' || !istype) {
istype = '0';
}
@ -50,7 +50,7 @@ function getSList(isdisplay) {
var page = '';
if (isdisplay) {
page = '&p=' + isdisplay;
setCookie('p' + getCookie('softType'), isdisplay);
setCookie('p' + getCookie('soft_type'), isdisplay);
}
var condition = (search + type + page).slice(1);
@ -106,7 +106,7 @@ function getSList(isdisplay) {
var mupdate = '';//(plugin.versions[n] == plugin.updates[n]) '' : '<a class="btlink" onclick="SoftUpdate(\'' + plugin.name + '\',\'' + plugin.versions[n].version + '\',\'' + plugin.updates[n] + '\')">更新</a> | ';
// if (plugin.versions[n] == '') mupdate = '';
handle = mupdate + '<a class="btlink" onclick="softMain(\'' + plugin.name + '\',\'' + plugin.setup_version + '\')">设置</a> | <a class="btlink" onclick="uninstallVersion(\'' + plugin.name + '\',\'' + plugin.setup_version + '\')">卸载</a>';
titleClick = 'onclick="softMain(\'' + plugin.name + '\',\'' + version_info + '\')" style="cursor:pointer"';
titleClick = 'onclick="softMain(\'' + plugin.name + '\',\'' + plugin.setup_version + '\')" style="cursor:pointer"';
softPath = '<span class="glyphicon glyphicon-folder-open" title="' + plugin.path + '" onclick="openPath(\'' + plugin.path + '\')"></span>';
if (plugin.coexist){
@ -162,7 +162,7 @@ function getSList(isdisplay) {
sBody += pBody;
$("#softList").html(sBody);
$(".menu-sub span").click(function() {
setCookie('softType', $(this).attr('typeid'));
setCookie('soft_type', $(this).attr('typeid'));
$(this).addClass("on").siblings().removeClass("on");
getSList();
});

@ -331,7 +331,7 @@ html {
cursor: pointer;
border:transparent 1px solid;
min-height: 20px;
min-width: 150px;
/*min-width: 150px;*/
display: inline-block;
}
.input-edit:hover{

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -26,62 +26,71 @@ else
echo ""
fi
mw_start(){
isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'`
if [ "$isStart" == '' ];then
echo -e "Starting mw... \c"
cd $mw_path && gunicorn -c setting.py app:app
port=$(cat ${mw_path}/data/port.pl)
isStart=""
while [[ "$isStart" == "" ]];
do
echo -e ".\c"
sleep 0.5
isStart=$(lsof -n -P -i:$port|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 ${mw_path}/logs/error.log
echo '------------------------------------------------------'
echo -e "\033[31mError: mw service startup failed.\033[0m"
return;
mw_start_panel()
{
isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'`
if [ "$isStart" == '' ];then
echo -e "Starting mw-panel... \c"
cd $mw_path && gunicorn -c setting.py app:app
port=$(cat ${mw_path}/data/port.pl)
isStart=""
while [[ "$isStart" == "" ]];
do
echo -e ".\c"
sleep 0.5
isStart=$(lsof -n -P -i:$port|grep LISTEN|grep -v grep|awk '{print $2}'|xargs)
let n+=1
if [ $n -gt 15 ];then
break;
fi
echo -e "\033[32mdone\033[0m"
done
if [ "$isStart" == '' ];then
echo -e "\033[31mfailed\033[0m"
echo '------------------------------------------------------'
tail -n 20 ${mw_path}/logs/error.log
echo '------------------------------------------------------'
echo -e "\033[31mError: mw-panel service startup failed.\033[0m"
return;
fi
echo -e "\033[32mdone\033[0m"
else
echo "Starting mw... mw(pid $(echo $isStart)) already running"
echo "Starting mw-panel... mw(pid $(echo $isStart)) already running"
fi
}
mw_start_task()
{
isStart=$(ps aux |grep 'task.py'|grep -v grep|awk '{print $2}')
if [ "$isStart" == '' ];then
echo -e "Starting mw-tasks... \c"
cd $mw_path && python3 task.py >> ${mw_path}/logs/task.log 2>&1 &
sleep 0.3
isStart=$(ps aux |grep 'task.py'|grep -v grep|awk '{print $2}')
if [ "$isStart" == '' ];then
echo -e "\033[31mfailed\033[0m"
echo '------------------------------------------------------'
tail -n 20 $mw_path/logs/task.log
echo '------------------------------------------------------'
echo -e "\033[31mError: mw-tasks service startup failed.\033[0m"
return;
fi
echo -e "\033[32mdone\033[0m"
echo -e "Starting mw-tasks... \c"
cd $mw_path && python3 task.py >> ${mw_path}/logs/task.log 2>&1 &
sleep 0.3
isStart=$(ps aux |grep 'task.py'|grep -v grep|awk '{print $2}')
if [ "$isStart" == '' ];then
echo -e "\033[31mfailed\033[0m"
echo '------------------------------------------------------'
tail -n 20 $mw_path/logs/task.log
echo '------------------------------------------------------'
echo -e "\033[31mError: mw-tasks service startup failed.\033[0m"
return;
fi
echo -e "\033[32mdone\033[0m"
else
echo "Starting mw-tasks... mw-tasks (pid $isStart) already running"
echo "Starting mw-tasks... mw-tasks (pid $isStart) already running"
fi
}
mw_start()
{
mw_start_panel
mw_start_task
}
mw_stop()
mw_stop_task()
{
echo -e "Stopping mw-tasks... \c";
echo -e "Stopping mw-tasks... \c";
pids=$(ps aux | grep 'task.py'|grep -v grep|awk '{print $2}')
arr=($pids)
@ -90,20 +99,29 @@ mw_stop()
kill -9 $p
done
echo -e "\033[32mdone\033[0m"
}
echo -e "Stopping mw... \c";
mw_stop_panel()
{
echo -e "Stopping mw-panel... \c";
arr=`ps aux|grep 'gunicorn -c setting.py app:app'|grep -v grep|awk '{print $2}'`
for p in ${arr[@]}
for p in ${arr[@]}
do
kill -9 $p &>/dev/null
done
if [ -f $pidfile ];then
rm -f $pidfile
rm -f $pidfile
fi
echo -e "\033[32mdone\033[0m"
}
mw_stop()
{
mw_stop_panel
mw_stop_task
}
mw_status()
{
isStart=$(ps aux|grep 'gunicorn -c setting.py app:app'|grep -v grep|awk '{print $2}')
@ -163,6 +181,9 @@ case "$1" in
'restart')
mw_stop
mw_start;;
'restart_panel')
mw_stop_panel
mw_start_panel;;
'status') mw_status;;
'logs') error_logs;;
'default')
@ -175,7 +196,7 @@ case "$1" in
if [ ! -f $mw_path/data/default.pl ];then
echo -e "\033[33mInstall Failed\033[0m"
exit 0
exit 1
fi
password=$(cat $mw_path/data/default.pl)
@ -185,18 +206,34 @@ case "$1" in
if [ -f $mw_path/data/admin_path.pl ];then
auth_path=$(cat $mw_path/data/admin_path.pl)
fi
if [ "$address" = "" ];then
address=$(curl -sS --connect-timeout 10 -m 60 https://www.bt.cn/Api/getIpAddress)
v4=$(python3 $mw_path/tools.py getServerIp 4)
v6=$(python3 $mw_path/tools.py getServerIp 6)
if [ "$v4" != "" ] && [ "$v6" != "" ]; then
address="MW-Panel-Url-Ipv4: http://$v4:$port$auth_path \nMW-Panel-Url-Ipv6: http://[$v6]:$port$auth_path"
elif [ "$v4" != "" ]; then
address="MW-Panel-Url: http://$v4:$port$auth_path"
elif [ "$v6" != "" ]; then
echo 'True' > $mw_path/data/ipv6.pl
address="MW-Panel-Url: http://[$v6]:$port$auth_path"
else
address="No v4 or v6 available"
fi
else
address="MW-Panel-Url: http://$address:$port$auth_path"
fi
echo -e "=================================================================="
echo -e "\033[32mMW-Panel default info!\033[0m"
echo -e "=================================================================="
echo "MW-Panel-URL: http://$address:$port$auth_path"
echo -e "$address"
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|20|21) in the security group\033[0m"
echo -e "\033[33mrelease the following port (7200|888|80|443|22) in the security group\033[0m"
echo -e "=================================================================="
;;
esac
esac

@ -1,7 +1,7 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
LANG=en_US.UTF-8
# LANG=en_US.UTF-8
is64bit=`getconf LONG_BIT`
if [ -f /etc/motd ];then
@ -44,6 +44,9 @@ elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; th
yum install -y wget zip unzip
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
OSNAME='debian'
apt update -y
apt install -y devscripts
apt install -y wget zip unzip
apt install -y wget zip unzip
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
OSNAME='ubuntu'
@ -72,9 +75,12 @@ if [ $OSNAME != "macos" ];then
fi
echo "use system version: ${OSNAME}"
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/install/${OSNAME}.sh | bash
cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh
chmod +x /www/server/mdserver-web/mw-cli
if [ ! -e /usr/bin/mw-cli ]; then
ln -s /www/server/mdserver-web/mw-cli /usr/bin/mw-cli
fi
endTime=`date +%s`
((outTime=(${endTime}-${startTime})/60))
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"

@ -5,19 +5,13 @@ LANG=C.UTF-8
if [ ! -f /usr/bin/applydeltarpm ];then
yum -y provides '*/applydeltarpm'
yum -y install deltarpm
fi
setenforce 0
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
yum install -y wget lsof crontabs
yum install -y python3-devel
yum install -y python-devel
yum install -y vixie-cron
dnf install -y wget lsof
dnf install -y python3-devel
dnf install -y python-devel
dnf install -y crontabs
#https need
@ -32,7 +26,7 @@ if [ -f /etc/init.d/iptables ];then
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 3306 -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
@ -56,7 +50,7 @@ if [ ! -f /etc/init.d/iptables ];then
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=3306/tcp
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
@ -68,62 +62,26 @@ fi
#安装时不开启
systemctl stop firewalld
yum groupinstall -y "Development Tools"
yum install -y libevent libevent-devel libjpeg* libpng* gd* libxslt* unzip libmcrypt libmcrypt-devel
yum install -y wget python-imaging libicu-devel zip bzip2-devel gcc libxml2 libxml2-dev libjpeg-devel libpng-devel libwebp libwebp-devel pcre pcre-devel
yum install -y lsof net-tools
yum install -y ncurses-devel mysql-devel cmake
yum install -y MySQL-python
yum install -y epel-release
if [ ! -d /www/server/mdserver-web ];then
wget -O /tmp/master.zip https://codeload.github.com/midoks/mdserver-web/zip/master
cd /tmp && unzip /tmp/master.zip
mv /tmp/mdserver-web-master /www/server/mdserver-web
rm -rf /tmp/master.zip
rm -rf /tmp/mdserver-web-master
fi
dnf upgrade -y
dnf autoremove -y
#if [ ! -f '/usr/bin/pip' ];then
# wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
# python get-pip.py
# pip install --upgrade pip
# pip install pillow==6.2.2
#fi
dnf groupinstall -y "Development Tools"
dnf install -y epel-release
dnf install -y oniguruma
dnf --enablerepo=crb install oniguruma-devel
if [ ! -f /usr/local/bin/pip3 ];then
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
fi
dnf install -y libevent libevent-devel libjpeg* libpng* gd* libxslt* unzip libmcrypt libmcrypt-devel
dnf install -y wget libicu-devel zip bzip2-devel gcc libxml2 libxml2-devel libjpeg-devel libpng-devel libwebp libwebp-devel pcre pcre-devel
dnf install -y lsof net-tools
dnf install -y ncurses-devel cmake
dnf --enablerepo=crb install mysql-devel
cd /www/server/mdserver-web/scripts && bash lib.sh
chmod 755 /www/server/mdserver-web/data
# if [ ! -f /www/server/mdserver-web/bin/activate ];then
# cd /www/server/mdserver-web && python3 -m venv .
# fi
if [ -f /www/server/mdserver-web/bin/activate ];then
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate && pip3 install -r /www/server/mdserver-web/requirements.txt
else
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
fi
pip install --upgrade pip
pip3 install gunicorn==20.1.0
pip3 install gevent==21.1.2
pip3 install gevent-websocket==0.10.1
pip3 install requests==2.20.0
pip3 install flask-caching==1.10.1
pip3 install flask-socketio==5.2.0
pip3 install psutil==5.9.1
pip3 install pymongo
cd /www/server/mdserver-web && ./cli.sh start
sleep 5

@ -17,6 +17,7 @@ yum install -y python3-devel
yum install -y python-devel
yum install -y vixie-cron
yum install -y curl-devel libmcrypt libmcrypt-devel
yum install -y mysql-devel
#https need
if [ ! -d /root/.acme.sh ];then
@ -30,7 +31,7 @@ if [ -f /etc/init.d/iptables ];then
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 3306 -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
@ -54,7 +55,8 @@ if [ ! -f /etc/init.d/iptables ];then
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=3306/tcp
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
# firewall-cmd --permanent --zone=public --add-port=1723/tcp
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
@ -67,54 +69,28 @@ fi
systemctl stop firewalld
yum groupinstall -y "Development Tools"
yum install -y epel-release
yum install -y oniguruma oniguruma-devel
#centos8 stream | use dnf
if [ "$?" != "0" ];then
yum install -y dnf dnf-plugins-core
dnf config-manager --set-enabled powertools
yum install -y oniguruma oniguruma-devel
fi
yum install -y libevent libevent-devel libjpeg* libpng* gd* libxslt* unzip libmcrypt libmcrypt-devel
yum install -y python-imaging libicu-devel zip bzip2-devel gcc libxml2 libxml2-dev pcre pcre-devel
yum install -y libevent libevent-devel libjpeg* libpng* gd* libxslt* unzip
yum install -y python-imaging libicu-devel zip bzip2-devel gcc libxml2 libxml2-devel pcre pcre-devel
yum install -y libjpeg-devel libpng-devel libwebp libwebp-devel
yum install -y lsof net-tools
yum install -y ncurses-devel mysql-devel cmake
yum install -y ncurses-devel cmake
yum install -y MySQL-python
yum install -y epel-release
if [ ! -f /usr/local/bin/pip3 ];then
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
fi
cd /www/server/mdserver-web/scripts && bash lib.sh
chmod 755 /www/server/mdserver-web/data
if [ ! -f /www/server/mdserver-web/bin/activate ];then
cd /www/server/mdserver-web && python3 -m venv .
fi
if [ -f /www/server/mdserver-web/bin/activate ];then
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate && pip3 install -r /www/server/mdserver-web/requirements.txt
pip install --upgrade pip
pip3 install gunicorn==20.1.0
pip3 install gevent==21.1.2
pip3 install gevent-websocket==0.10.1
pip3 install requests==2.20.0
pip3 install flask-caching==1.10.1
pip3 install python-socketio==4.2.0
pip3 install psutil==5.9.1
pip3 install pymongo
else
pip install --upgrade pip
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
pip3 install gunicorn==20.1.0
pip3 install gevent==21.1.2
pip3 install gevent-websocket==0.10.1
pip3 install requests==2.20.0
pip3 install flask-caching==1.10.1
pip3 install python-socketio==4.2.0
pip3 install psutil==5.9.1
pip3 install pymongo
fi
cd /www/server/mdserver-web && ./cli.sh start
sleep 5

@ -3,14 +3,22 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
LANG=en_US.UTF-8
# RED='\e[1;31m' # 红色
# GREEN='\e[1;32m' # 绿色
# YELLOW='\e[1;33m' # 黄色
# BLUE='\e[1;34m' # 蓝色
# PURPLE='\e[1;35m' # 紫色
# CYAN='\e[1;36m' # 蓝绿色
# WHITE='\e[1;37m' # 白色
# NC='\e[0m' # 没有颜色
apt update -y
apt install -y wget curl lsof unzip
apt install -y python3-pip
apt install -y python3-dev
apt install -y python3-venv
apt install -y cron
if [ ! -d /root/.acme.sh ];then
@ -24,7 +32,7 @@ if [ -f /usr/sbin/ufw ];then
ufw allow 443/tcp
ufw allow 888/tcp
ufw allow 7200/tcp
ufw allow 3306/tcp
# ufw allow 3306/tcp
# ufw allow 30000:40000/tcp
fi
@ -46,7 +54,7 @@ if [ ! -f /usr/sbin/ufw ];then
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=3306/tcp
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
# fix:debian10 firewalld faq
@ -60,34 +68,39 @@ fi
systemctl stop firewalld
cd /www/server/mdserver-web/scripts && bash lib.sh
chmod 755 /www/server/mdserver-web/data
# if [ ! -f /www/server/mdserver-web/bin/activate ];then
# cd /www/server/mdserver-web && python3 -m venv .
# fi
if [ -f /www/server/mdserver-web/bin/activate ];then
pip install --upgrade pip
pip install --upgrade setuptools
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate && pip3 install -r /www/server/mdserver-web/requirements.txt
else
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
#fix zlib1g-dev fail
echo -e "\e[0;32mfix zlib1g-dev install question start\e[0m"
Install_TmpFile=/tmp/debian-fix-zlib1g-dev.txt
apt install -y zlib1g-dev > ${Install_TmpFile}
if [ "$?" != "0" ];then
ZLIB1G_BASE_VER=$(cat ${Install_TmpFile} | grep zlib1g | awk -F "=" '{print $2}' | awk -F ")" '{print $1}')
ZLIB1G_BASE_VER=`echo ${ZLIB1G_BASE_VER} | sed "s/^[ \s]\{1,\}//g;s/[ \s]\{1,\}$//g"`
# echo "1${ZLIB1G_BASE_VER}1"
echo -e "\e[1;31mapt install zlib1g=${ZLIB1G_BASE_VER} zlib1g-dev\e[0m"
echo "Y" | apt install zlib1g=${ZLIB1G_BASE_VER} zlib1g-dev
fi
if [ ! -f /usr/local/bin/pip3 ];then
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
rm -rf ${Install_TmpFile}
echo -e "\e[0;32mfix zlib1g-dev install question end\e[0m"
#fix libunwind-dev fail
echo -e "\e[0;32mfix libunwind-dev install question start\e[0m"
Install_TmpFile=/tmp/debian-fix-libunwind-dev.txt
apt install -y libunwind-dev > ${Install_TmpFile}
if [ "$?" != "0" ];then
liblzma5_BASE_VER=$(cat ${Install_TmpFile} | grep liblzma-dev | awk -F "=" '{print $2}' | awk -F ")" '{print $1}')
liblzma5_BASE_VER=`echo ${liblzma5_BASE_VER} | sed "s/^[ \s]\{1,\}//g;s/[ \s]\{1,\}$//g"`
echo -e "\e[1;31mapt install liblzma5=${liblzma5_BASE_VER} libunwind-dev\e[0m"
echo "Y" | apt install liblzma5=${liblzma5_BASE_VER} libunwind-dev
fi
rm -rf ${Install_TmpFile}
echo -e "\e[0;32mfix libunwind-dev install question end\e[0m"
cd /www/server/mdserver-web/scripts && bash lib.sh
chmod 755 /www/server/mdserver-web/data
pip3 install gunicorn==20.1.0
pip3 install gevent==21.1.2
pip3 install gevent-websocket==0.10.1
pip3 install requests==2.20.0
pip3 install flask-caching==1.10.1
pip3 install flask-socketio==5.2.0
pip3 install pymongo
pip3 install psutil
cd /www/server/mdserver-web && ./cli.sh start

@ -29,7 +29,7 @@ if [ -f /etc/init.d/iptables ];then
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 3306 -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=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=3306/tcp
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
firewall-cmd --reload
fi
@ -66,6 +66,7 @@ systemctl stop firewalld
yum groupinstall -y "Development Tools"
yum -y install epel-release
yum install -y libevent libevent-devel libxslt* libjpeg* libpng* gd* zip libmcrypt libmcrypt-devel
yum install -y gcc libffi-devel python-devel openssl-devel
@ -74,38 +75,16 @@ yum -y install wget python-devel python-imaging libicu-devel unzip bzip2-devel g
yum -y install net-tools
yum -y install ncurses-devel mysql-devel cmake
yum -y install python-devel
yum -y install MySQL-python
yum -y install epel-release
yum -y install MySQL-python
yum -y install python3-devel
#if [ ! -f '/usr/bin/pip' ];then
# wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
# python get-pip.py
# pip install --upgrade pip
# pip install pillow==6.2.2
#fi
if [ ! -f /usr/local/bin/pip3 ];then
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
fi
cd /www/server/mdserver-web/scripts && bash lib.sh
chmod 755 /www/server/mdserver-web/data
if [ ! -f /www/server/mdserver-web/bin/activate ];then
cd /www/server/mdserver-web && python3 -m venv .
fi
if [ -f /www/server/mdserver-web/bin/activate ];then
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate && pip3 install -r /www/server/mdserver-web/requirements.txt
else
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
fi
cd /www/server/mdserver-web && ./cli.sh start
sleep 5

@ -36,6 +36,7 @@ if [ ! -d $DEV/server/lib ]; then
cd $DEV/server/mdserver-web/scripts && ./lib.sh
fi
pip3 install mysqlclient
chmod 755 $DEV/server/mdserver-web/data
if [ -f $DEV/server/mdserver-web/bin/activate ];then
@ -44,6 +45,8 @@ else
cd $DEV/server/mdserver-web && pip3 install -r $DEV/server/mdserver-web/requirements.txt
fi
pip3 install mysqlclient
cd $DEV/server/mdserver-web && ./cli.sh start
cd $DEV/server/mdserver-web && ./cli.sh stop

@ -31,7 +31,7 @@ if [ -f /etc/init.d/iptables ];then
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 3306 -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=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=3306/tcp
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
@ -68,53 +68,19 @@ fi
systemctl stop firewalld
yum groupinstall -y "Development Tools"
yum install -y epel-release
yum install -y libevent libevent-devel libjpeg* libpng* gd* libxslt* unzip libmcrypt libmcrypt-devel
yum install -y wget python-imaging libicu-devel zip bzip2-devel gcc libxml2 libxml2-dev libjpeg-devel libpng-devel libwebp libwebp-devel pcre pcre-devel
yum install -y lsof net-tools
yum install -y ncurses-devel mysql-devel cmake
yum install -y MySQL-python
yum install -y epel-release
#if [ ! -f '/usr/bin/pip' ];then
# wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
# python get-pip.py
# pip install --upgrade pip
# pip install pillow==6.2.2
#fi
if [ ! -f /usr/local/bin/pip3 ];then
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
fi
yum install -y MySQL-python
cd /www/server/mdserver-web/scripts && bash lib.sh
chmod 755 /www/server/mdserver-web/data
if [ ! -f /www/server/mdserver-web/bin/activate ];then
cd /www/server/mdserver-web && python3 -m venv .
fi
if [ -f /www/server/mdserver-web/bin/activate ];then
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate && pip3 install -r /www/server/mdserver-web/requirements.txt
else
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
fi
pip install --upgrade pip
pip3 install gunicorn==20.1.0
pip3 install gevent==21.1.2
pip3 install gevent-websocket==0.10.1
pip3 install requests==2.20.0
pip3 install flask-caching==1.10.1
pip3 install python-socketio==4.2.0
pip3 install psutil==5.9.1
pip3 install pymongo
cd /www/server/mdserver-web && ./cli.sh start
sleep 5

@ -9,6 +9,8 @@ apt update -y
apt install -y wget curl lsof unzip
apt install -y python3-pip
apt install -y python3-venv
apt install -y python3-dev
apt install -y cron
@ -24,7 +26,7 @@ if [ -f /usr/sbin/ufw ];then
ufw allow 443/tcp
ufw allow 888/tcp
ufw allow 7200/tcp
ufw allow 3306/tcp
# ufw allow 3306/tcp
# ufw allow 30000:40000/tcp
fi
@ -44,7 +46,7 @@ if [ ! -f /usr/sbin/ufw ];then
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=3306/tcp
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
# fix:debian10 firewalld faq
@ -62,46 +64,6 @@ cd /www/server/mdserver-web/scripts && bash lib.sh
chmod 755 /www/server/mdserver-web/data
if [ ! -f /usr/local/bin/pip3 ];then
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
fi
# cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
# pip install --upgrade pip
# pip install --upgrade setuptools
# pip3 install gunicorn==20.1.0
# pip3 install gevent==21.1.2
# pip3 install gevent-websocket==0.10.1
# pip3 install requests==2.20.0
# pip3 install flask-caching==1.10.1
# pip3 install flask-socketio==5.2.0
# pip3 install flask-session==0.3.2
# pip3 install pymongo
# pip3 install psutil
# if [ ! -f /www/server/mdserver-web/bin/activate ];then
# cd /www/server/mdserver-web && python3 -m venv .
# fi
if [ -f /www/server/mdserver-web/bin/activate ];then
python -m pip install --upgrade pip
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate && pip3 install -r /www/server/mdserver-web/requirements.txt
else
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
fi
pip3 install gunicorn==20.1.0
pip3 install gevent==20.9.0
pip3 install gevent-websocket==0.10.1
pip3 install requests==2.20.0
pip3 install flask-caching==1.10.1
#ubuntu 20 need
pip3 install flask-socketio==5.2.0
pip3 install flask-session==0.3.2
pip3 install pymongo
pip3 install psutil
cd /www/server/mdserver-web && ./cli.sh start
sleep 5

@ -1,7 +1,7 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
LANG=en_US.UTF-8
# LANG=en_US.UTF-8
is64bit=`getconf LONG_BIT`
if [ -f /etc/motd ];then
@ -44,6 +44,9 @@ elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; th
yum install -y wget zip unzip
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
OSNAME='debian'
apt update -y
apt install -y devscripts
apt install -y wget zip unzip
apt install -y wget zip unzip
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
OSNAME='ubuntu'
@ -72,9 +75,13 @@ if [ $OSNAME != "macos" ];then
fi
echo "use system version: ${OSNAME}"
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/install/${OSNAME}.sh | bash
cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh
chmod +x /www/server/mdserver-web/mw-cli
if [ ! -e /usr/bin/mw-cli ]; then
ln -s /www/server/mdserver-web/mw-cli /usr/bin/mw-cli
fi
endTime=`date +%s`
((outTime=(${endTime}-${startTime})/60))
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"

@ -1,7 +1,7 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
LANG=en_US.UTF-8
# LANG=en_US.UTF-8
is64bit=`getconf LONG_BIT`
if [ -f /etc/motd ];then
@ -44,6 +44,8 @@ elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; th
yum install -y wget zip unzip
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
OSNAME='debian'
apt update -y
apt install -y devscripts
apt install -y wget zip unzip
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
OSNAME='ubuntu'
@ -72,9 +74,17 @@ if [ $OSNAME != "macos" ];then
fi
echo "use system version: ${OSNAME}"
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/install/${OSNAME}.sh | bash
# cd /www/server/mdserver-web && bash ./scripts/install/debian.sh
cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh
# curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install/${OSNAME}.sh | bash
chmod +x /www/server/mdserver-web/mw-cli
if [ ! -e /usr/bin/mw-cli ]; then
ln -s /www/server/mdserver-web/mw-cli /usr/bin/mw-cli
fi
endTime=`date +%s`
((outTime=(${endTime}-${startTime})/60))
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"

@ -244,17 +244,19 @@ echo -e "Install_Curl" >> ${libPath}/lib.pl
}
_os=`uname`
if grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
sudo ln -sf /bin/bash /bin/sh
#sudo dpkg-reconfigure dash
fi
_os=`uname`
if [ ${_os} == "Darwin" ]; then
OSNAME='macos'
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
OSNAME='centos'
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
OSNAME='rocky'
elif grep -Eqi "Red Hat Enterprise Linux Server" /etc/issue || grep -Eq "Red Hat Enterprise Linux Server" /etc/*-release; then
OSNAME='rhel'
elif grep -Eqi "Aliyun" /etc/issue || grep -Eq "Aliyun" /etc/*-release; then
@ -288,21 +290,25 @@ if [ "$OSNAME" == "macos" ]; then
elif [ "$OSNAME" == "ubuntu" ] || [ "$OSNAME" == "debian" ]; then
apt install -y devscripts
apt install -y net-tools
apt install -y libffi-dev
apt install -y cmake automake make
apt install -y php-common webp scons
apt install -y lzma lzma-dev libunwind-dev
apt install -y webp scons
apt install -y lzma lzma-dev
apt install -y libunwind-dev
apt install -y libpcre3 libpcre3-dev
apt install -y openssl
apt install -y libxml2 libxml2-dev libbz2-dev libmcrypt-dev libpspell-dev librecode-dev
apt install -y libgmp-dev libgmp3-dev libreadline-dev libxpm-dev
apt install -y zlib1g-dev dia pkg-config
apt install -y libjpeg62-turbo-dev libjpeg-dev libpng-dev
apt install -y dia pkg-config
apt install -y zlib1g-dev
apt install -y libjpeg-dev libpng-dev
apt install -y libfreetype6
apt install -y libjpeg62-turbo-dev
apt install -y libfreetype6-dev
apt install -y libevent-dev libncurses5-dev libldap2-dev
@ -328,20 +334,19 @@ elif [ "$OSNAME" == "ubuntu" ] || [ "$OSNAME" == "debian" ]; then
else
yum install -y openldap openldap-devel libtirpc libtirpc-devel rpcgen
yum install -y bison re2c cmake
yum install -y libmemcached libmemcached-devel
yum install -y curl-devel
yum install -y zlib zlib-devel
yum install -y libzip libzip-devel
yum install -y pcre pcre-devel
yum install -y icu libicu-devel autoconf
yum install -y freetype freetype-devel
yum install -y openssl openssl-devel
yum install -y libzip libzip-devel
yum install -y graphviz libxml2 libxml2-devel
yum install -y sqlite-devel
yum install -y mysql-devel
yum install -y oniguruma oniguruma-devel
yum install -y ImageMagick ImageMagick-devel
@ -351,6 +356,52 @@ else
fi
fi
#面板需要的库
if [ ! -f /usr/local/bin/pip3 ];then
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
fi
pip install --upgrade pip
pip3 install --upgrade setuptools
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
pip3 install gunicorn==20.1.0
pip3 install gevent==21.1.2
pip3 install gevent-websocket==0.10.1
pip3 install requests==2.20.0
pip3 install flask-caching==1.10.1
pip3 install flask-session==0.3.2
pip3 install pymongo
pip3 install psutil
pip3 install flask-socketio==5.2.0
pip3 install mysqlclient
if [ ! -f /www/server/mdserver-web/bin/activate ];then
cd /www/server/mdserver-web && python3 -m venv .
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate
else
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate
fi
pip install --upgrade pip
pip3 install --upgrade setuptools
pip3 install -r /www/server/mdserver-web/requirements.txt
pip3 install gunicorn==20.1.0
pip3 install gevent==21.1.2
pip3 install gevent-websocket==0.10.1
pip3 install requests==2.20.0
pip3 install flask-caching==1.10.1
pip3 install flask-session==0.3.2
pip3 install pymongo
pip3 install psutil
pip3 install flask-socketio==5.2.0
pip3 install mysqlclient
##### common start #####
# Install_Libiconv

@ -0,0 +1,42 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
echo "welcome to mdserver-web panel"
startTime=`date +%s`
if [ ! -d /www/server/mdserver-web ];then
echo "mdserver-web not exist!"
exit 1
fi
# openresty
if [ ! -d /www/server/openresty ];then
cd /www/server/mdserver-web/plugins/openresty && bash install.sh install 1.21.4.1
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/openresty/index.py start
else
echo "openresty alreay exist!"
fi
# php
if [ ! -d /www/server/php/71 ];then
cd /www/server/mdserver-web/plugins/php && bash install.sh install 71
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 71
else
echo "php71 alreay exist!"
fi
# mysql
if [ ! -d /www/server/mysql ];then
cd /www/server/mdserver-web/plugins/mysql && bash install.sh install 5.5
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql/index.py start 5.5
else
echo "mysql alreay exist!"
fi
endTime=`date +%s`
((outTime=(${endTime}-${startTime})/60))
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"

@ -0,0 +1,89 @@
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
echo "welcome to mdserver-web panel"
startTime=`date +%s`
if [ ! -d /www/server/mdserver-web ];then
echo "mdserver-web not exist!"
exit 1
fi
# openresty
if [ ! -d /www/server/openresty ];then
cd /www/server/mdserver-web/plugins/openresty && bash install.sh install 1.21.4.1
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/openresty/index.py start
fi
# php
if [ ! -d /www/server/php/71 ];then
cd /www/server/mdserver-web/plugins/php && bash install.sh install 71
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 71
fi
# PHP_VER_LIST=(53 54 55 56 71 72 73 74 80 81)
# # PHP_VER_LIST=(81)
# for PHP_VER in ${PHP_VER_LIST[@]}; do
# echo "php${PHP_VER} -- start"
# cd $DIR/php$PHP_VER && sh install.sh
# dir=$(ls -l $DIR/php$PHP_VER |awk '/^d/ {print $NF}')
# for i in $dir
# do
# cd $DIR/php$PHP_VER/$i && sh install.sh $PHP_VER
# done
# echo "php${PHP_VER} -- end"
# done
cd /www/server/mdserver-web/plugins/php && bash install.sh install 53
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 53
cd /www/server/mdserver-web/plugins/php && bash install.sh install 54
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 54
cd /www/server/mdserver-web/plugins/php && bash install.sh install 55
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 55
cd /www/server/mdserver-web/plugins/php && bash install.sh install 56
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 56
cd /www/server/mdserver-web/plugins/php && bash install.sh install 70
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 70
cd /www/server/mdserver-web/plugins/php && bash install.sh install 71
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 71
cd /www/server/mdserver-web/plugins/php && bash install.sh install 72
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 72
cd /www/server/mdserver-web/plugins/php && bash install.sh install 73
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 73
cd /www/server/mdserver-web/plugins/php && bash install.sh install 74
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 74
cd /www/server/mdserver-web/plugins/php && bash install.sh install 80
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 80
cd /www/server/mdserver-web/plugins/php && bash install.sh install 81
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/php/index.py start 81
# mysql
if [ ! -d /www/server/mysql ];then
# cd /www/server/mdserver-web/plugins/mysql && bash install.sh install 5.7
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql/index.py start 5.7
# cd /www/server/mdserver-web/plugins/mysql && bash install.sh install 5.6
# cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql/index.py start 5.6
cd /www/server/mdserver-web/plugins/mysql && bash install.sh install 8.0
cd /www/server/mdserver-web && python3 /www/server/mdserver-web/plugins/mysql/index.py start 8.0
fi
endTime=`date +%s`
((outTime=(${endTime}-${startTime})/60))
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"

@ -61,6 +61,14 @@ if [ -f $rootPath"/php/init.d/php74" ];then
$rootPath"/php/init.d/php74" reload
fi
if [ -f $rootPath"/php/init.d/php80" ];then
$rootPath"/php/init.d/php74" reload
fi
if [ -f $rootPath"/php/init.d/php81" ];then
$rootPath"/php/init.d/php74" reload
fi
if [ -f $rootPath"/openresty/nginx/sbin/nginx" ];then
$rootPath"/openresty/nginx/sbin/nginx" -s reload
fi

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save