This commit is contained in:
flucont 2022-12-17 17:25:27 +08:00
parent ab81af3b94
commit 2c9f84c121
8 changed files with 192 additions and 151 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash
Linux_Version="7.9.6"
Windows_Version="7.7.0"
Windows_Version="7.8.0"
FILES=(
public/install/src/panel6.zip

View File

@ -15,9 +15,9 @@ INSERT INTO `cloud_config` (`key`, `value`) VALUES
('new_version', '7.9.6'),
('update_msg', '暂无更新日志'),
('update_date', '2022-11-29'),
('new_version_win', '7.7.0'),
('new_version_win', '7.8.0'),
('update_msg_win', '暂无更新日志'),
('update_date_win', '2022-09-09'),
('update_date_win', '2022-12-08'),
('updateall_type', '0'),
('syskey', 'UqP94LtI8eWAIgCP');

View File

@ -118,6 +118,33 @@ System_Check(){
Install_Check
fi
}
Set_Ssl(){
echo -e ""
echo -e "----------------------------------------------------------------------"
echo -e "为了您的面板使用安全建议您开启面板SSL开启后请使用https访问宝塔面板"
echo -e "输入y回车即开启面板SSL并进行下一步安装"
echo -e "输入n回车跳过面板SSL配置直接进行安装"
echo -e "10秒后将跳过SSL配置直接进行面板安装"
echo -e "----------------------------------------------------------------------"
echo -e ""
read -t 10 -p "是否确定开启面板SSL ? (y/n): " yes
if [ $? != 0 ];then
SET_SSL=false
else
case "$yes" in
y)
SET_SSL=true
;;
n)
SET_SSL=false
rm -f /www/server/panel/data/ssl.pl
;;
*)
Set_Ssl
esac
fi
}
Get_Pack_Manager(){
if [ -f "/usr/bin/yum" ] && [ -d "/etc/yum.repos.d" ]; then
PM="yum"
@ -204,7 +231,7 @@ get_node_url(){
echo '---------------------------------------------';
echo "Selected download node...";
nodes=(http://dg2.bt.cn http://dg1.bt.cn http://download.bt.cn http://125.90.93.52:5880 http://36.133.1.8:5880 http://123.129.198.197 http://103.179.243.14:5880 http://128.1.164.196);
nodes=(https://dg2.bt.cn https://dg1.bt.cn https://download.bt.cn);
if [ "$1" ];then
nodes=($(echo ${nodes[*]}|sed "s#${1}##"))
@ -246,7 +273,7 @@ get_node_url(){
if [ -z "$NODE_URL" ];then
NODE_URL=$(cat $tmp_file2|sort -g -t " " -k 1|head -n 1|awk '{print $2}')
if [ -z "$NODE_URL" ];then
NODE_URL='http://download.bt.cn';
NODE_URL='https://download.bt.cn';
fi
fi
rm -f $tmp_file1
@ -597,11 +624,8 @@ Install_Bt(){
if [ -f ${setup_path}/server/panel/data/port.pl ];then
panelPort=$(cat ${setup_path}/server/panel/data/port.pl)
else
RE_NUM=$(expr $RANDOM % 3)
if [ "${RE_NUM}" == "1" ];then
panelPort=$(expr $RANDOM % 55535 + 10000)
fi
fi
mkdir -p ${setup_path}/server/panel/logs
mkdir -p ${setup_path}/server/panel/vhost/apache
mkdir -p ${setup_path}/server/panel/vhost/nginx
@ -701,6 +725,8 @@ Set_Bt_Panel(){
auth_path=$(cat /dev/urandom | head -n 16 | md5sum | head -c 8)
echo "/${auth_path}" > ${admin_auth}
fi
auth_path=$(cat /dev/urandom | head -n 16 | md5sum | head -c 8)
echo "/${auth_path}" > ${admin_auth}
chmod -R 700 $pyenv_path/pyenv/bin
/www/server/panel/pyenv/bin/pip3 install pymongo
/www/server/panel/pyenv/bin/pip3 install psycopg2-binary
@ -708,6 +734,10 @@ Set_Bt_Panel(){
/www/server/panel/pyenv/bin/pip3 install flask-sock
auth_path=$(cat ${admin_auth})
cd ${setup_path}/server/panel/
if [ "$SET_SSL" == true ]; then
btpip install -I pyOpenSSl
btpython /www/server/panel/tools.py ssl
fi
/etc/init.d/bt start
$python_bin -m py_compile tools.py
$python_bin tools.py username
@ -719,7 +749,7 @@ Set_Bt_Panel(){
/etc/init.d/bt restart
sleep 3
isStart=$(ps aux |grep 'BT-Panel'|grep -v grep|awk '{print $2}')
LOCAL_CURL=$(curl 127.0.0.1:8888/login 2>&1 |grep -i html)
LOCAL_CURL=$(curl 127.0.0.1:${panelPort}/login 2>&1 |grep -i html)
if [ -z "${isStart}" ] && [ -z "${LOCAL_CURL}" ];then
/etc/init.d/bt 22
cd /www/server/panel/pyenv/bin
@ -797,7 +827,6 @@ Get_Ip_Address(){
isHosts=$(cat /etc/hosts|grep 'www.bt.cn')
if [ -z "${isHosts}" ];then
echo "" >> /etc/hosts
echo "116.213.43.206 www.bt.cn" >> /etc/hosts
getIpAddress=$(curl -sS --connect-timeout 10 -m 60 https://www.bt.cn/Api/getIpAddress)
if [ -z "${getIpAddress}" ];then
sed -i "/bt.cn/d" /etc/hosts
@ -833,6 +862,7 @@ Setup_Count(){
echo /www > /var/bt_setupPath.conf
}
Install_Main(){
#Set_Ssl
startTime=`date +%s`
Lock_Clear
System_Check
@ -890,17 +920,28 @@ fi
Install_Main
PANEL_SSL=$(cat /www/server/panel/data/ssl.pl 2> /dev/null)
if [ "${PANEL_SSL}" == "True" ];then
HTTP_S="https"
else
HTTP_S="http"
fi
echo > /www/server/panel/data/bind.pl
echo -e "=================================================================="
echo -e "\033[32mCongratulations! Installed successfully!\033[0m"
echo -e "=================================================================="
echo "外网面板地址: http://${getIpAddress}:${panelPort}${auth_path}"
echo "内网面板地址: http://${LOCAL_IP}:${panelPort}${auth_path}"
echo "外网面板地址: ${HTTP_S}://${getIpAddress}:${panelPort}${auth_path}"
echo "内网面板地址: ${HTTP_S}://${LOCAL_IP}:${panelPort}${auth_path}"
echo -e "username: $username"
echo -e "password: $password"
echo -e "\033[33mIf you cannot access the panel,\033[0m"
echo -e "\033[33mrelease the following panel port [${panelPort}] in the security group\033[0m"
echo -e "\033[33m若无法访问面板请检查防火墙/安全组是否有放行面板[${panelPort}]端口\033[0m"
if [ "${HTTP_S}" == "https" ];then
echo -e "\033[33m因已开启面板自签证书访问面板会提示不匹配证书请参考以下链接配置证书\033[0m"
echo -e "\033[33mhttps://www.bt.cn/bbs/thread-105443-1-1.html\033[0m"
fi
echo -e "=================================================================="
endTime=`date +%s`

View File

@ -10,7 +10,7 @@ export LANG=en_US.UTF-8
export LANGUAGE=en_US:en
get_node_url(){
nodes=(http://dg2.bt.cn http://dg1.bt.cn http://36.133.1.8:5880 http://123.129.198.197 http://38.34.185.130 http://116.213.43.206:5880 http://128.1.164.196);
nodes=(https://dg2.bt.cn https://dg1.bt.cn https://download.bt.cn https://hk1-node.bt.cn https://na1-node.bt.cn https://jp1-node.bt.cn);
if [ "$1" ];then
nodes=($(echo ${nodes[*]}|sed "s#${1}##"))
@ -52,7 +52,7 @@ get_node_url(){
if [ -z "$NODE_URL" ];then
NODE_URL=$(cat $tmp_file2|sort -g -t " " -k 1|head -n 1|awk '{print $2}')
if [ -z "$NODE_URL" ];then
NODE_URL='http://download.bt.cn';
NODE_URL='https://download.bt.cn';
fi
fi
rm -f $tmp_file1
@ -108,7 +108,7 @@ send_check(){
chmod +x /etc/init.d/bt
p_path2=/www/server/panel/class/common.py
p_version=$(cat $p_path2|grep "version = "|awk '{print $3}'|tr -cd [0-9.])
curl -sS --connect-timeout 3 -m 60 http://www.bt.cn/api/panel/notpro?version=$p_version
curl -sS --connect-timeout 3 -m 60 https://www.bt.cn/api/panel/notpro?version=$p_version
NODE_URL=""
exit 0;
}
@ -147,3 +147,4 @@ if [ ! $NODE_URL ];then
get_node_url
fi

Binary file not shown.

View File

@ -265,16 +265,15 @@ def GetLocalIp():
ipaddress = readFile(filename)
if not ipaddress:
url = 'http://pv.sohu.com/cityjson?ie=utf-8'
url = 'http://www.example.com/api/getIpAddress';
str = httpGet(url)
ipaddress = re.search('\d+.\d+.\d+.\d+',str).group(0)
writeFile(filename,ipaddress)
ipaddress = re.search('\d+.\d+.\d+.\d+',ipaddress).group(0);
return ipaddress
except:
try:
url = 'http://www.example.com/api/getIpAddress';
url = 'https://www.bt.cn/Api/getIpAddress';
str = httpGet(url)
writeFile(filename,ipaddress)
return str
@ -486,7 +485,7 @@ def get_url(timeout = 0.5):
import json
try:
#
node_list = [{"protocol":"http://","address":"dg1.bt.cn","port":"80","ping":500},{"protocol":"http://","address":"dg2.bt.cn","port":"80","ping":500},{"protocol":"http://","address":"node.aapanel.com","port":"80","ping":500},{"protocol":"http://","address":"download.bt.cn","port":"80","ping":500}]
node_list = [{"protocol":"http://","address":"dg2.bt.cn","port":"80","ping":500},{"protocol":"http://","address":"dg1.bt.cn","port":"80","ping":500},{"protocol":"http://","address":"download.bt.cn","port":"80","ping":500},{"protocol":"http://","address":"hk1-node.bt.cn","port":"80","ping":500},{"protocol":"http://","address":"na1-node.bt.cn","port":"80","ping":500},{"protocol":"http://","address":"jp1-node.bt.cn","port":"80","ping":500}]
mnode1 = []
mnode2 = []
@ -511,11 +510,11 @@ def get_url(timeout = 0.5):
else: #终选中等延迟,中等带宽
mnode = sorted(mnode2,key= lambda x:x['ping'],reverse=False)
if not mnode: return 'http://download.bt.cn'
if not mnode: return 'https://download.bt.cn'
#return mnode[0]['protocol'] + mnode[0]['address'] + ':' + mnode[0]['port']
return "https://" + mnode[0]['address']
except:
return 'http://download.bt.cn'
return 'https://download.bt.cn'
@ -984,7 +983,7 @@ def add_panel_services(num = 0):
ret = ExecShell("\"{}\" {}/panel/runserver.py --startup auto install".format(py_path,setupPath))
delete_server('btTask')
ExecShell("\"{}\" {}/panel/task.py --startup auto install".format(py_path,setupPath))
ret1 = ExecShell("\"{}\" {}/panel/task.py --startup auto install".format(py_path,setupPath))
if get_server_status('btPanel') < 0 or get_server_status('btTask') < 0:
if num <= 0 :
@ -994,7 +993,7 @@ def add_panel_services(num = 0):
add_panel_services(1)
else:
writeFile(error_path,ret[0] + ret[1])
writeFile(error_path,ret[0] + ret[1] + ret1[0] + ret1[1])
else:
os.system('sc failure btPanel reset=1800 actions=restart/60000/restart/120000/restart/30000')
os.system('sc failure btTask reset=1800 actions=restart/60000/restart/120000/restart/30000')