Skip to content

Commit

Permalink
5.9.24
Browse files Browse the repository at this point in the history
  • Loading branch information
showpy committed Jul 2, 2019
1 parent 51816f3 commit 10d7cbe
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 17 deletions.
2 changes: 1 addition & 1 deletion BTPanel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion class/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 8 additions & 6 deletions class/letsencrypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
9 changes: 7 additions & 2 deletions class/panelMysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]+)"
Expand Down
12 changes: 6 additions & 6 deletions class/panelSite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion license.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
宝塔:宝塔面板(主体: 东莞市百塔网络科技有限公司)
用户许可定义:用户在基于明显的用途说明后主动安装、使用、注册、管理软件,以及同意宝塔提供相关服务所订立的协议

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

0 comments on commit 10d7cbe

Please sign in to comment.