Skip to content
Permalink
Browse files

5.9.24

  • Loading branch information
showpy committed Jul 2, 2019
1 parent 51816f3 commit 10d7cbe3478e6b25e17931ee5d899eba47e38dac
Showing with 24 additions and 17 deletions.
  1. +1 −1 BTPanel/__init__.py
  2. +1 −1 class/database.py
  3. +8 −6 class/letsencrypt.py
  4. +7 −2 class/panelMysql.py
  5. +6 −6 class/panelSite.py
  6. +1 −1 license.txt
@@ -89,7 +89,7 @@ def service_status():
@app.before_request
def basic_auth_check():
if app.config['BASIC_AUTH_OPEN']:
if request.path in ['/public']: return;
if request.path in ['/public','/download']: return;
auth = request.authorization
if not comm.get_sk(): return;
if not auth: return send_authenticated()
@@ -102,7 +102,7 @@ def IsSqlError(self,mysqlMsg):
if "libmysqlclient" in mysqlMsg:
result = self.rep_lnk()
os.system("pip uninstall mysql-python -y")
os.system("pip install mysql-python")
os.system("pip install pymysql")
public.writeFile('data/restart.pl','True')
return public.returnMsg(False,"执行失败,已尝试自动修复,请稍候重试!")
return None
@@ -24,9 +24,9 @@
import argparse, subprocess, json, os, sys, base64, binascii, time, hashlib, re, copy, textwrap, logging, requests

try:
from urllib.request import urlopen, Request # Python 3
from urllib.request import urlopen, Request # 3
except ImportError:
from urllib2 import urlopen, Request # Python 2
from urllib2 import urlopen, Request # 2

DEFAULT_CA = "https://acme-v02.api.letsencrypt.org"
# DEFAULT_CA = "https://acme-staging-v02.api.letsencrypt.org"
@@ -65,7 +65,8 @@ def _do_request(url, data=None, err_msg="Error", depth=0):
if depth < 100 and code == 400 and resp_data['type'] == "urn:ietf:params:acme:error:badNonce":
raise IndexError(resp_data)
if code not in [200, 201, 204]:
raise ValueError("{0}:\nUrl: {1}\nData: {2}\nResponse Code: {3}\nResponse: {4}".format(err_msg, url, data, code, resp_data))
# print("{0}:\nUrl: {1}\nData: {2}\nResponse Code: {3}".format(err_msg, url, data, code))
sys.exit(json.dumps(resp_data))
return resp_data, code, headers

def _send_signed_request(url, payload, err_msg, depth=0):
@@ -167,7 +168,8 @@ def _poll_until_not(url, pending_statuses, err_msg):
authorization = _poll_until_not(auth_url, ["pending"], "Error checking challenge status for {0}".format(domain))
if authorization['status'] != "valid":
public.WriteFile(os.path.join(path, "check_authorization_status_response"), json.dumps(authorization), mode="w")
raise ValueError("Challenge did not pass for {0}: {1}".format(domain, authorization))
print("Challenge did not pass for {0}".format(domain, ))
sys.exit(json.dumps(authorization))
log.info("{0} verified!".format(domain))

# finalize the order with the csr
@@ -195,12 +197,12 @@ def _poll_until_not(url, pending_statuses, err_msg):
data = json.loads(sys.argv[1])
print (data)
sitedomain = data['siteName']
path = os.path.join("/www/server/panel/vhost/cert/", sitedomain)
path = data['path']
public.ExecShell("mkdir -p {}".format(path))
KEY_PREFIX = os.path.join(path, "privkey")
ACCOUNT_KEY = os.path.join(path, "letsencrypt-account.key")
DOMAIN_KEY = os.path.join(path, "privkey.pem")
DOMAIN_DIR = os.path.join("/www/wwwroot", sitedomain)
DOMAIN_DIR = data['sitePath']
DOMAINS = data['DOMAINS']
DOMAIN_PEM = KEY_PREFIX + ".pem"
DOMAIN_CSR = KEY_PREFIX + ".csr"
@@ -31,8 +31,13 @@ def __Conn(self):
if sys.version_info[0] == 2:
reload(MySQLdb)
except Exception as ex:
self.__DB_ERR = ex
return False;
try:
import pymysql
pymysql.install_as_MySQLdb()
import MySQLdb
except Exception as e:
self.__DB_ERR = e
return False;
try:
myconf = public.readFile('/etc/my.cnf');
rep = "port\s*=\s*([0-9]+)"
@@ -2537,12 +2537,12 @@ def SetNginx(self,get):
if public.get_webserver() == 'nginx':
shutil.copyfile(ng_file, '/tmp/ng_file_bk.conf')

if os.path.exists('/www/server/nginx/src/ngx_cache_purge'):
cureCache += '''
location ~ /purge(/.*) {
proxy_cache_purge cache_one $1$is_args$args;
#access_log /www/wwwlogs/%s_purge_cache.log;
}''' % (get.sitename)
#if os.path.exists('/www/server/nginx/src/ngx_cache_purge'):
cureCache += '''
location ~ /purge(/.*) {
proxy_cache_purge cache_one $host$1$is_args$args;
#access_log /www/wwwlogs/%s_purge_cache.log;
}''' % (get.sitename)
if os.path.exists(ng_file):
self.CheckProxy(get)
ng_conf = public.readFile(ng_file)
@@ -7,7 +7,7 @@
宝塔:宝塔面板(主体: 东莞市百塔网络科技有限公司)
用户许可定义:用户在基于明显的用途说明后主动安装、使用、注册、管理软件,以及同意宝塔提供相关服务所订立的协议

一、宝塔需尊守的约定
一、宝塔需遵守的约定
1.1 除付费插件外,确保所有代码用户皆可阅读。
1.2 确保用户在完成所有环境部署后,在不依赖宝塔云端支持下也可永久运行。
1.3 除付费插件外,禁止对源代码进行加密和混淆。

0 comments on commit 10d7cbe

Please sign in to comment.
You can’t perform that action at this time.