update
@@ -42,7 +42,7 @@ class config_api:
|
||||
'bind_domain' : 'data/bind_domain.pl', # 面板域名绑定
|
||||
'unauth_status' : 'data/unauthorized_status.pl', # URL路径未成功显示状态
|
||||
'auth_secret': 'data/auth_secret.pl', # 二次验证密钥
|
||||
'ssl':'data/ssl.pl', # ssl设置
|
||||
'ssl':'ssl/choose.pl', # ssl设置
|
||||
'hook_database' : 'data/hook_database.json', # 数据库钩子
|
||||
'hook_menu' : 'data/hook_menu.json', # 菜单钩子
|
||||
'hook_global_static' : 'data/hook_global_static.json', # 静态文件钩子
|
||||
@@ -363,17 +363,18 @@ class config_api:
|
||||
|
||||
def getPanelSslData(self):
|
||||
cert = {}
|
||||
keyPath = 'ssl/private.pem'
|
||||
certPath = 'ssl/cert.pem'
|
||||
keyPath = 'ssl/local/private.pem'
|
||||
certPath = 'ssl/local/cert.pem'
|
||||
|
||||
if not os.path.exists(certPath):
|
||||
# 不再自动生成证书
|
||||
# mw.createSSL()
|
||||
mw.createLocalSSL()
|
||||
cert['privateKey'] = ''
|
||||
cert['is_https'] = ''
|
||||
cert['certPem'] = ''
|
||||
cert['rep'] = os.path.exists('ssl/input.pl')
|
||||
cert['info'] = {'endtime': 0, 'subject': '无',
|
||||
'notAfter': '无', 'notBefore': '无', 'issuer': '无'}
|
||||
cert['rep'] = os.path.exists('ssl/local/input.pl')
|
||||
cert['info'] = mw.getCertName(certPath)
|
||||
# cert['info'] = {'endtime': 0, 'subject': '无','notAfter': '无', 'notBefore': '无', 'issuer': '无'}
|
||||
return cert
|
||||
|
||||
panel_ssl = mw.getServerDir() + "/web_conf/nginx/vhost/panel.conf"
|
||||
@@ -390,6 +391,26 @@ class config_api:
|
||||
cert['info'] = mw.getCertName(certPath)
|
||||
return cert
|
||||
|
||||
# 面板本地SSL设置
|
||||
def setPanelLocalSslApi(self):
|
||||
cert = {}
|
||||
keyPath = 'ssl/local/private.pem'
|
||||
certPath = 'ssl/local/cert.pem'
|
||||
|
||||
if not os.path.exists(certPath):
|
||||
mw.createLocalSSL()
|
||||
|
||||
choose_file = self.__file['ssl']
|
||||
mw.writeFile(choose_file, 'local')
|
||||
return mw.returnJson(True, '设置成功')
|
||||
|
||||
# 关闭SSL
|
||||
def closePanelSslApi(self):
|
||||
choose_file = self.__file['ssl']
|
||||
if os.path.exists(choose_file):
|
||||
os.remove(choose_file)
|
||||
return mw.returnJson(True, '关闭SSL成功')
|
||||
|
||||
# 保存面板证书
|
||||
def savePanelSslApi(self):
|
||||
keyPath = 'ssl/private.pem'
|
||||
|
||||
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
@@ -54,7 +54,7 @@
|
||||
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right">面板端口</span>
|
||||
<input data-port="{{data['port']}}" id="banport" name="port" class="inputtxt bt-input-text" type="numner" value="{{data['port']}}" maxlength="5">
|
||||
<input data-port="{{data['port']}}" id="banport" name="port" class="inputtxt bt-input-text" type="number" value="{{data['port']}}" maxlength="5">
|
||||
<button type="button" class="btn btn-success btn-sm ml5 btn_port" disabled>保存</button>
|
||||
<span class="set-info c7">建议端口范围7200 - 65535</span>
|
||||
</p>
|
||||
|
||||
@@ -59,11 +59,14 @@ if os.path.exists('data/ipv6.pl'):
|
||||
else:
|
||||
bind.append('0.0.0.0:%s' % mw_port)
|
||||
|
||||
# if os.path.exists('data/ssl.pl'):
|
||||
# certfile = 'ssl/certificate.pem'
|
||||
# keyfile = 'ssl/privateKey.pem'
|
||||
# ciphers = 'TLSv1 TLSv1.1 TLSv1.2 TLSv1.3'
|
||||
# ssl_version = 2
|
||||
ssl_choose_file = 'ssl/choose.pl'
|
||||
if os.path.exists(ssl_choose_file):
|
||||
ssl_choose = mw.readFile(ssl_choose_file).strip()
|
||||
if mw.inArray(['local','nginx'],ssl_choose):
|
||||
certfile = 'ssl/'+ssl_choose+'/cert.pem'
|
||||
keyfile = 'ssl/'+ssl_choose+'/private.pem'
|
||||
ciphers = 'TLSv1 TLSv1.1 TLSv1.2 TLSv1.3'
|
||||
ssl_version = 2
|
||||
|
||||
# 初始安装时,自动生成安全路径
|
||||
if not os.path.exists('data/admin_path.pl'):
|
||||
|
||||