From 519544715fa5df09944a4f7ee8449694de09ccfa Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Tue, 9 Apr 2024 16:00:09 +0800 Subject: [PATCH 01/17] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0234164eea..bc766560eb 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Talk is cheap, show me the code. -- linus ``` - [兼容性测试报告](/compatibility.md) -- [常用命令说明](/cmd.md) [ mw default ] +- [常用命令说明](/cmd.md) [ mw default ] [ mw update_dev ] ### 主要插件介绍 From e22722f40e10e631856a9f31a4899ba14538917e Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Wed, 10 Apr 2024 22:07:09 +0800 Subject: [PATCH 02/17] Update cert_api.py --- class/core/cert_api.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/class/core/cert_api.py b/class/core/cert_api.py index 831e82363a..c1170557bf 100644 --- a/class/core/cert_api.py +++ b/class/core/cert_api.py @@ -1293,18 +1293,18 @@ def getSslUsedSite(self, save_path): import panelSite args = mw.dict_obj() args.siteName = '' - for c_name in os.listdir(cert_paths): - skey_file = '{}/{}/privkey.pem'.format(cert_paths, c_name) + for cert_name in os.listdir(cert_paths): + skey_file = '{}/{}/privkey.pem'.format(cert_paths, cert_name) skey = mw.readFile(skey_file) if not skey: continue if skey == pkey: - args.siteName = c_name + args.siteName = cert_name run_path = panelSite.panelSite().GetRunPath(args) if not run_path: continue sitePath = mw.M('sites').where( - 'name=?', c_name).getField('path') + 'name=?', cert_name).getField('path') if not sitePath: continue to_path = "{}/{}".format(sitePath, run_path) @@ -1509,8 +1509,7 @@ def renewCert(self, index): # 已删除的网站直接跳过续签 if self.__config['orders'][i]['auth_to'].find('|') == -1 and self.__config['orders'][i]['auth_to'].find('/') != -1: if not os.path.exists(self.__config['orders'][i]['auth_to']): - auth_to = self.getSslUsedSite( - self.__config['orders'][i]['save_path']) + auth_to = self.getSslUsedSite(self.__config['orders'][i]['save_path']) if not auth_to: continue From 0a11f17d9071405d874928c2eb7b59e03970dcda Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Fri, 12 Apr 2024 21:34:44 +0800 Subject: [PATCH 03/17] Update phplib.conf --- plugins/php/versions/phplib.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/php/versions/phplib.conf b/plugins/php/versions/phplib.conf index e40851390c..8b5c5f2b7d 100755 --- a/plugins/php/versions/phplib.conf +++ b/plugins/php/versions/phplib.conf @@ -724,6 +724,7 @@ { "name": "zip", "versions": [ + "72", "83" ], "type": "压缩", From 07147809383e02216afdc682ad8d754f1493f94f Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Fri, 12 Apr 2024 21:36:52 +0800 Subject: [PATCH 04/17] Update zip.sh --- plugins/php/versions/common/zip.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/php/versions/common/zip.sh b/plugins/php/versions/common/zip.sh index b346d6766d..ce0238147b 100755 --- a/plugins/php/versions/common/zip.sh +++ b/plugins/php/versions/common/zip.sh @@ -20,7 +20,7 @@ LIBNAME=zip LIBV=0 -if [ "$version" -lt "73" ];then +if [ "$version" -lt "72" ];then echo "not need" exit 1 fi From 891cd561633a2bcf127e4c340db5609eca78e495 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Sat, 13 Apr 2024 11:56:49 +0800 Subject: [PATCH 05/17] Update config.json --- plugins/webstats/conf/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/webstats/conf/config.json b/plugins/webstats/conf/config.json index 7e8e00f163..b897a91af8 100644 --- a/plugins/webstats/conf/config.json +++ b/plugins/webstats/conf/config.json @@ -1,7 +1,7 @@ { "global": { "monitor": true, - "save_day": 180, + "save_day": 1, "autorefresh": false, "refresh_interval": 3, "cdn": true, From fb0a771c8168e0a8b01b70892dd6eaeab5ae05a2 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Mon, 15 Apr 2024 00:11:02 +0800 Subject: [PATCH 06/17] Update cert_request.py --- class/core/cert_request.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/core/cert_request.py b/class/core/cert_request.py index 9da8ace5f0..2a2ccc8d36 100644 --- a/class/core/cert_request.py +++ b/class/core/cert_request.py @@ -242,7 +242,7 @@ def getAccountKey(self): # 注册acme帐户 def register(self, existing=False): if not 'email' in self.__config: - self.__config['email'] = 'mdioks@163.com' + self.__config['email'] = 'xxxx.xxxx@gmail.com' if existing: payload = {"onlyReturnExisting": True} elif self.__config['email']: From e629a82ed9e3e2a9a87f304276506cafbe395c49 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Mon, 15 Apr 2024 00:21:58 +0800 Subject: [PATCH 07/17] Update cert_api.py --- class/core/cert_api.py | 117 +---------------------------------------- 1 file changed, 1 insertion(+), 116 deletions(-) diff --git a/class/core/cert_api.py b/class/core/cert_api.py index c1170557bf..dfed9281c8 100644 --- a/class/core/cert_api.py +++ b/class/core/cert_api.py @@ -434,40 +434,6 @@ def signMessage(self, message): OpenSSL.crypto.FILETYPE_PEM, self.getAccountKey().encode()) return OpenSSL.crypto.sign(pk, message.encode("utf8"), self.__digest) - def getSiteRunPathByid(self, site_id): - if mw.M('sites').where('id=?', (site_id,)).count() >= 1: - site_path = mw.M('sites').where('id=?', site_id).getField('path') - if not site_path: - return None - if not os.path.exists(site_path): - return None - args = mw.dict_obj() - args.id = site_id - import panelSite - run_path = panelSite.panelSite().GetRunPath(args) - if run_path in ['/']: - run_path = '' - if run_path: - if run_path[0] == '/': - run_path = run_path[1:] - site_run_path = os.path.join(site_path, run_path) - if not os.path.exists(site_run_path): - return site_path - return site_run_path - else: - return False - - def getSiteRunPath(self, domains): - site_id = 0 - for domain in domains: - site_id = mw.M('domain').where("name=?", domain).getField('pid') - if site_id: - break - - if not site_id: - return None - return self.getSiteRunPathByid(site_id) - # 清理验证文件 def clearAuthFile(self, index): if not self.__config['orders'][index]['auth_type'] in ['http', 'tls']: @@ -1283,85 +1249,6 @@ def extractZone(self, domain_name): root = old_domain_name return root, zone - # 获取当前正在使用此证书的网站目录 - def getSslUsedSite(self, save_path): - pkey_file = '{}/privkey.pem'.format(save_path) - pkey = mw.readFile(pkey_file) - if not pkey: - return False - cert_paths = 'vhost/cert' - import panelSite - args = mw.dict_obj() - args.siteName = '' - for cert_name in os.listdir(cert_paths): - skey_file = '{}/{}/privkey.pem'.format(cert_paths, cert_name) - skey = mw.readFile(skey_file) - if not skey: - continue - if skey == pkey: - args.siteName = cert_name - run_path = panelSite.panelSite().GetRunPath(args) - if not run_path: - continue - sitePath = mw.M('sites').where( - 'name=?', cert_name).getField('path') - if not sitePath: - continue - to_path = "{}/{}".format(sitePath, run_path) - return to_path - return False - - def renewCertOther(self): - cert_path = "{}/vhost/cert".format(mw.getRunDir()) - if not os.path.exists(cert_path): - return - new_time = time.time() + (86400 * 30) - n = 0 - if not 'orders' in self.__config: - self.__config['orders'] = {} - import panelSite - siteObj = panelSite.panelSite() - args = mw.dict_obj() - for siteName in os.listdir(cert_path): - try: - cert_file = '{}/{}/fullchain.pem'.format(cert_path, siteName) - if not os.path.exists(cert_file): - continue # 无证书文件 - siteInfo = mw.M('sites').where('name=?', siteName).find() - if not siteInfo: - continue # 无网站信息 - cert_init = self.getCertInit(cert_file) - if not cert_init: - continue # 无法获取证书 - end_time = time.mktime(time.strptime( - cert_init['notAfter'], '%Y-%m-%d')) - if end_time > new_time: - continue # 未到期 - try: - if not cert_init['issuer'] in ['R3', "Let's Encrypt"] and cert_init['issuer'].find("Let's Encrypt") == -1: - continue # 非同品牌证书 - except: - continue - - if isinstance(cert_init['dns'], str): - cert_init['dns'] = [cert_init['dns']] - index = self.getIndex(cert_init['dns']) - if index in self.__config['orders'].keys(): - continue # 已在订单列表 - - n += 1 - writeLog( - "|-正在续签第 {} 张其它证书,域名: {}..".format(n, cert_init['subject'])) - writeLog("|-正在创建订单..") - args.id = siteInfo['id'] - runPath = siteObj.GetRunPath(args) - if runPath and not runPath in ['/']: - path = siteInfo['path'] + '/' + runPath - else: - path = siteInfo['path'] - except: - writeLog("|-[{}]续签失败".format(siteName)) - # 外部API - START ---------------------------------------------------------- def getHostConf(self, siteName): return mw.getServerDir() + '/web_conf/nginx/vhost/' + siteName + '.conf' @@ -1509,7 +1396,7 @@ def renewCert(self, index): # 已删除的网站直接跳过续签 if self.__config['orders'][i]['auth_to'].find('|') == -1 and self.__config['orders'][i]['auth_to'].find('/') != -1: if not os.path.exists(self.__config['orders'][i]['auth_to']): - auth_to = self.getSslUsedSite(self.__config['orders'][i]['save_path']) + auth_to = self.__config['orders'][i]['auth_to'] if not auth_to: continue @@ -1549,8 +1436,6 @@ def renewCert(self, index): order_index.append(i) if not order_index: writeLog("|-没有找到30天内到期的SSL证书,正在尝试去寻找其它可续签证书!") - # self.getApis() - # self.renewCertOther() writeLog("|-所有任务已处理完成!") return writeLog("|-共需要续签 {} 张证书".format(len(order_index))) From c8d86fa835d1fcc1148f807335bc0941d2f69f86 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Mon, 15 Apr 2024 00:27:46 +0800 Subject: [PATCH 08/17] Update cert_api.py --- class/core/cert_api.py | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/class/core/cert_api.py b/class/core/cert_api.py index dfed9281c8..16b78d02bc 100644 --- a/class/core/cert_api.py +++ b/class/core/cert_api.py @@ -434,6 +434,40 @@ def signMessage(self, message): OpenSSL.crypto.FILETYPE_PEM, self.getAccountKey().encode()) return OpenSSL.crypto.sign(pk, message.encode("utf8"), self.__digest) + def getSiteRunPathByid(self, site_id): + if mw.M('sites').where('id=?', (site_id,)).count() >= 1: + site_path = mw.M('sites').where('id=?', site_id).getField('path') + if not site_path: + return None + if not os.path.exists(site_path): + return None + args = mw.dict_obj() + args.id = site_id + import panelSite + run_path = panelSite.panelSite().GetRunPath(args) + if run_path in ['/']: + run_path = '' + if run_path: + if run_path[0] == '/': + run_path = run_path[1:] + site_run_path = os.path.join(site_path, run_path) + if not os.path.exists(site_run_path): + return site_path + return site_run_path + else: + return False + + def getSiteRunPath(self, domains): + site_id = 0 + for domain in domains: + site_id = mw.M('domain').where("name=?", domain).getField('pid') + if site_id: + break + + if not site_id: + return None + return self.getSiteRunPathByid(site_id) + # 清理验证文件 def clearAuthFile(self, index): if not self.__config['orders'][index]['auth_type'] in ['http', 'tls']: @@ -1435,7 +1469,6 @@ def renewCert(self, index): # 加入到续签订单 order_index.append(i) if not order_index: - writeLog("|-没有找到30天内到期的SSL证书,正在尝试去寻找其它可续签证书!") writeLog("|-所有任务已处理完成!") return writeLog("|-共需要续签 {} 张证书".format(len(order_index))) From 59bbd99ba4b8f2188122008747d040712a1ffdd0 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Mon, 15 Apr 2024 00:42:38 +0800 Subject: [PATCH 09/17] Update cert_api.py --- class/core/cert_api.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/class/core/cert_api.py b/class/core/cert_api.py index 16b78d02bc..d9a589e79e 100644 --- a/class/core/cert_api.py +++ b/class/core/cert_api.py @@ -441,19 +441,7 @@ def getSiteRunPathByid(self, site_id): return None if not os.path.exists(site_path): return None - args = mw.dict_obj() - args.id = site_id - import panelSite - run_path = panelSite.panelSite().GetRunPath(args) - if run_path in ['/']: - run_path = '' - if run_path: - if run_path[0] == '/': - run_path = run_path[1:] - site_run_path = os.path.join(site_path, run_path) - if not os.path.exists(site_run_path): - return site_path - return site_run_path + return site_path else: return False From c8d02eaa8521e48a1bef939182ca8fc261967886 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Mon, 15 Apr 2024 02:01:52 +0800 Subject: [PATCH 10/17] Update files.html --- route/templates/default/files.html | 1 + 1 file changed, 1 insertion(+) diff --git a/route/templates/default/files.html b/route/templates/default/files.html index 63eccaa9df..6283f82645 100755 --- a/route/templates/default/files.html +++ b/route/templates/default/files.html @@ -43,6 +43,7 @@ +