Compare commits

..

3 Commits
1.8.2 ... 1.8.6

Author SHA1 Message Date
flucont
0bf1aa2260 update 2023-05-20 20:53:12 +08:00
flucont
9a63bc921b update 2023-04-14 20:01:12 +08:00
flucont
5d305b47de update 2023-04-08 13:39:58 +08:00
13 changed files with 178 additions and 60 deletions

View File

@@ -1,8 +1,8 @@
#!/bin/bash
Linux_Version="7.9.8"
Linux_Version="7.9.10"
Windows_Version="7.8.0"
Btm_Version="2.0.8"
Btm_Version="2.1.7"
FILES=(
public/install/src/panel6.zip

View File

@@ -12,15 +12,15 @@ INSERT INTO `cloud_config` (`key`, `value`) VALUES
('bt_key', ''),
('whitelist', '0'),
('download_page', '1'),
('new_version', '7.9.8'),
('new_version', '7.9.10'),
('update_msg', '暂无更新日志'),
('update_date', '2023-01-29'),
('update_date', '2023-05-09'),
('new_version_win', '7.8.0'),
('update_msg_win', '暂无更新日志'),
('update_date_win', '2022-12-08'),
('new_version_btm', '2.0.8'),
('new_version_btm', '2.1.7'),
('update_msg_btm', '暂无更新日志'),
('update_date_btm', '2023-03-31'),
('update_date_btm', '2023-05-18'),
('updateall_type', '0'),
('syskey', 'UqP94LtI8eWAIgCP');

View File

@@ -36,9 +36,9 @@ setup_path="/www"
python_bin=$setup_path/server/panel/pyenv/bin/python
cpu_cpunt=$(cat /proc/cpuinfo|grep processor|wc -l)
if [ "$1" ];then
IDC_CODE=$1
fi
# if [ "$1" ];then
# IDC_CODE=$1
# fi
GetSysInfo(){
if [ -s "/etc/redhat-release" ];then
@@ -231,7 +231,7 @@ get_node_url(){
echo '---------------------------------------------';
echo "Selected download node...";
nodes=(https://dg2.bt.cn https://dg1.bt.cn https://download.bt.cn);
nodes=(https://dg2.bt.cn https://download.bt.cn https://ctcc1-node.bt.cn https://cmcc1-node.bt.cn https://ctcc2-node.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}##"))
@@ -307,6 +307,15 @@ Install_RPM_Pack(){
echo "exclude=httpd nginx php mysql mairadb python-psutil python2-psutil" >> $yumPath
fi
if [ -f "/etc/redhat-release" ] && [ $(cat /etc/os-release|grep PLATFORM_ID|grep -oE "el8") ];then
yum config-manager --set-enabled powertools
yum config-manager --set-enabled PowerTools
fi
if [ -f "/etc/redhat-release" ] && [ $(cat /etc/os-release|grep PLATFORM_ID|grep -oE "el9") ];then
dnf config-manager --set-enabled crb -y
fi
#SYS_TYPE=$(uname -a|grep x86_64)
#yumBaseUrl=$(cat /etc/yum.repos.d/CentOS-Base.repo|grep baseurl=http|cut -d '=' -f 2|cut -d '$' -f 1|head -n 1)
#[ "${yumBaseUrl}" ] && checkYumRepo=$(curl --connect-timeout 5 --head -s -o /dev/null -w %{http_code} ${yumBaseUrl})
@@ -524,7 +533,7 @@ Install_Python_Lib(){
return
fi
py_version="3.7.8"
py_version="3.7.16"
mkdir -p $pyenv_path
echo "True" > /www/disk.pl
if [ ! -w /www/disk.pl ];then
@@ -601,7 +610,7 @@ Install_Python_Lib(){
cd ~
rm -rf $python_src_path
wget -O $pyenv_path/pyenv/bin/activate $download_Url/install/pyenv/activate.panel -T 5
wget -O $pyenv_path/pyenv/pip.txt $download_Url/install/pyenv/pip-3.7.8.txt -T 5
wget -O $pyenv_path/pyenv/pip.txt $download_Url/install/pyenv/pip-3.7.16.txt -T 5
ln -sf $pyenv_path/pyenv/bin/pip3.7 $pyenv_path/pyenv/bin/pip
ln -sf $pyenv_path/pyenv/bin/python3.7 $pyenv_path/pyenv/bin/python
ln -sf $pyenv_path/pyenv/bin/pip3.7 /usr/bin/btpip
@@ -611,8 +620,24 @@ Install_Python_Lib(){
$pyenv_path/pyenv/bin/pip install -U setuptools==65.5.0
$pyenv_path/pyenv/bin/pip install -U wheel==0.34.2
$pyenv_path/pyenv/bin/pip install -r $pyenv_path/pyenv/pip.txt
wget -O pip-packs.txt $download_Url/install/pyenv/pip-packs.txt
PIP_PACKS=$(cat pip-packs.txt)
for P_PACK in ${PIP_PACKS};
do
btpip show ${P_PACK} > /dev/null 2>&1
if [ "$?" == "1" ];then
btpip install ${P_PACK}
fi
done
rm -f pip-packs.txt
source $pyenv_path/pyenv/bin/activate
btpip install psutil
btpip install gevent
is_gevent=$($python_bin -m gevent 2>&1|grep -oE package)
is_psutil=$($python_bin -m psutil 2>&1|grep -oE package)
if [ "${is_gevent}" != "${is_psutil}" ];then
@@ -626,6 +651,9 @@ Install_Bt(){
else
panelPort=$(expr $RANDOM % 55535 + 10000)
fi
if [ "${PANEL_PORT}" ];then
panelPort=$PANEL_PORT
fi
mkdir -p ${setup_path}/server/panel/logs
mkdir -p ${setup_path}/server/panel/vhost/apache
mkdir -p ${setup_path}/server/panel/vhost/nginx
@@ -719,8 +747,15 @@ Set_Bt_Panel(){
fi
password=$(cat /dev/urandom | head -n 16 | md5sum | head -c 8)
if [ "$PANEL_PASSWORD" ];then
password=$PANEL_PASSWORD
fi
sleep 1
admin_auth="/www/server/panel/data/admin_path.pl"
if [ "${SAFE_PATH}" ];then
auth_path=$SAFE_PATH
echo "/${auth_path}" > ${admin_auth}
fi
if [ ! -f ${admin_auth} ];then
auth_path=$(cat /dev/urandom | head -n 16 | md5sum | head -c 8)
echo "/${auth_path}" > ${admin_auth}
@@ -742,6 +777,9 @@ Set_Bt_Panel(){
$python_bin -m py_compile tools.py
$python_bin tools.py username
username=$($python_bin tools.py panel ${password})
if [ "$PANEL_USER" ];then
username=$PANEL_USER
fi
cd ~
echo "${password}" > ${setup_path}/server/panel/default.pl
chmod 600 ${setup_path}/server/panel/default.pl
@@ -758,6 +796,12 @@ Set_Bt_Panel(){
lsattr python3.7 python
Red_Error "ERROR: The BT-Panel service startup failed." "ERROR: 宝塔启动失败"
fi
if [ "$PANEL_USER" ];then
cd ${setup_path}/server/panel/
btpython -c 'import tools;tools.set_panel_username("'$PANEL_USER'")'
cd ~
fi
}
Set_Firewall(){
sshPort=$(cat /etc/ssh/sshd_config | grep 'Port '|awk '{print $2}')
@@ -903,6 +947,35 @@ echo "
| 为了您的正常使用,请确保使用全新或纯净的系统安装宝塔面板,不支持已部署项目/环境的系统安装
+----------------------------------------------------------------------
"
while [ ${#} -gt 0 ]; do
case $1 in
-u|--user)
PANEL_USER=$2
shift 1
;;
-p|--password)
PANEL_PASSWORD=$2
shift 1
;;
-P|--port)
PANEL_PORT=$2
shift 1
;;
--safe-path)
SAFE_PATH=$2
shift 1
;;
-y)
go="y"
;;
*)
IDC_CODE=$1
;;
esac
shift 1
done
while [ "$go" != 'y' ] && [ "$go" != 'n' ]
do
read -p "Do you want to install Bt-Panel to the $setup_path directory now?(y/n): " go;
@@ -948,3 +1021,4 @@ endTime=`date +%s`
((outTime=($endTime-$startTime)/60))
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"

View File

@@ -213,6 +213,8 @@ Install_Python_Lib(){
$pyenv_path/pyenv/bin/pip install cachelib
$pyenv_path/pyenv/bin/pip install py7zr
$pyenv_path/pyenv/bin/pip install backports.lzma
$pyenv_path/pyenv/bin/pip install pandas
$pyenv_path/pyenv/bin/pip install msgpack
fi
source $pyenv_path/pyenv/bin/activate
chmod -R 700 $pyenv_path/pyenv/bin
@@ -270,6 +272,8 @@ Install_Python_Lib(){
$pyenv_path/pyenv/bin/pip install cachelib
$pyenv_path/pyenv/bin/pip install py7zr
$pyenv_path/pyenv/bin/pip install backports.lzma
$pyenv_path/pyenv/bin/pip install pandas
$pyenv_path/pyenv/bin/pip install msgpack
if [ ! -f $pyenv_path/pyenv/bin/python ];then
rm -f $pyenv_file
Red_Error "ERROR: Install python env fielded." "ERROR: 下载堡塔云监控主控端运行环境失败,请尝试重新安装!"
@@ -325,6 +329,8 @@ Install_Python_Lib(){
$pyenv_path/pyenv/bin/pip install cachelib
$pyenv_path/pyenv/bin/pip install py7zr
$pyenv_path/pyenv/bin/pip install backports.lzma
$pyenv_path/pyenv/bin/pip install pandas
$pyenv_path/pyenv/bin/pip install msgpack
source $pyenv_path/pyenv/bin/activate
is_gevent=$($python_bin -m gevent 2>&1|grep -oE package)
@@ -360,7 +366,7 @@ EOF
sleep 1
fi
version="2.0.8"
version="2.1.7"
file_name="bt-monitor"
agent_src="bt-monitor.zip"
@@ -462,16 +468,24 @@ Start_Monitor(){
curl -sSO ${download_Url}/install/btmonitoragent.sh && bash btmonitoragent.sh https://127.0.0.1:806 $md5_pl
target_dir="/usr/local/btmonitoragent"
if [ ! -f "$target_dir/BT-MonitorAgent" ];then
echo "ERROR: 安装云监控被控端失败,正在尝试重新安装!"
tail -n 10 ${monitor_path}/logs/error.log
echo ""
ps aux|grep -v grep|grep ${monitor_path}
netstat -tulnp|grep ${panelPort}
/etc/init.d/btm restart
if [ "$?" -eq 0 ]; then
echo -e "\033[31m安装云监控被控端失败正在尝试重新安装\033[0m"
sleep 15
curl -sSO ${download_Url}/install/btmonitoragent.sh && bash btmonitoragent.sh https://127.0.0.1:806 $md5_pl
if [ ! -f "$target_dir/BT-MonitorAgent" ];then
Red_Error "ERROR: 安装云监控被控端失败,请尝试重新安装!"
fi
else
Red_Error "ERROR: 安装云监控被控端失败,请尝试重新安装!"
fi
fi
/etc/init.d/btm restart > /dev/null 2>&1
}
Set_Firewall(){
@@ -708,9 +722,9 @@ Check_Sys_Write(){
for dir in ${read_dir[@]}
do
if [[ -d "$dir" ]]; then
touch $dir/btm_install_test_111.pl
state=$(echo $?)
#echo $state
if [[ "$state" != "0" ]];then
echo -e "\033[31m错误检测到系统关键目录不可写! $read_dir \033[0m"
echo "1、如果安装了[宝塔系统加固],请先临时关闭"
@@ -725,6 +739,7 @@ Check_Sys_Write(){
else
rm -f $dir/btm_install_test_111.pl
fi
fi
done
fi
}

Binary file not shown.

View File

@@ -12,16 +12,16 @@ if [ ! -d /www/server/panel/BTPanel ];then
exit 0;
fi
public_file=/www/server/panel/install/public.sh
publicFileMd5=$(md5sum ${public_file} 2>/dev/null|awk '{print $1}')
md5check="f6ccaaec227577b87a22bf162004667b"
if [ "${publicFileMd5}" != "${md5check}" ]; then
wget -O Tpublic.sh $Btapi_Url/install/public.sh -T 20;
publicFileMd5=$(md5sum Tpublic.sh 2>/dev/null|awk '{print $1}')
if [ "${publicFileMd5}" == "${md5check}" ]; then
\cp -rpa Tpublic.sh $public_file
if [ ! -f "/www/server/panel/pyenv/bin/python3" ];then
echo "============================================="
echo "错误, 当前面板过旧/py-2.7/无pyenv环境无法升级至最新版面板"
echo "请截图发帖至论坛www.bt.cn/bbs求助"
exit 0;
fi
rm -f Tpublic.sh
public_file=/www/server/panel/install/public.sh
if [ ! -f $public_file ];then
wget -O Tpublic.sh $Btapi_Url/install/public.sh -T 20;
fi
. $public_file
@@ -42,12 +42,16 @@ download_Url=$NODE_URL
setup_path=/www
version=$(curl -Ss --connect-timeout 5 -m 2 $Btapi_Url/api/panel/get_version)
if [ "$version" = '' ];then
version='7.9.8'
version='7.9.9'
fi
armCheck=$(uname -m|grep arm)
if [ "${armCheck}" ];then
version='7.7.0'
fi
if [ "$1" ];then
version=$1
fi
wget -T 5 -O /tmp/panel.zip $Btapi_Url/install/update/LinuxPanel-${version}.zip
dsize=$(du -b /tmp/panel.zip|awk '{print $1}')
if [ $dsize -lt 10240 ];then
@@ -69,10 +73,11 @@ rm -f /www/server/panel/class/*.pyc
#pip install itsdangerous==0.24
pip_list=$($mypip list)
request_v=$(echo "$pip_list"|grep requests)
if [ "$request_v" = "" ];then
$mypip install requests
request_v=$(btpip list 2>/dev/null|grep "requests "|awk '{print $2}'|cut -d '.' -f 2)
if [ "$request_v" = "" ] || [ "${request_v}" -gt "28" ];then
$mypip install requests==2.27.1
fi
openssl_v=$(echo "$pip_list"|grep pyOpenSSL)
if [ "$openssl_v" = "" ];then
$mypip install pyOpenSSL

View File

@@ -70,7 +70,7 @@ select_node(){
get_version(){
version=$(curl -Ss --connect-timeout 5 -m 2 $Btapi_Url/api/panel/get_version)
if [ "$version" = '' ];then
version='7.9.8'
version='7.9.9'
fi
}
@@ -333,9 +333,9 @@ update_panel(){
chattr -i /etc/init.d/bt
chmod +x /etc/init.d/bt
if [ $up_plugin = 1 ];then
$pyenv_bin/python /www/server/panel/tools.py update_to6
fi
# if [ $up_plugin = 1 ];then
# $pyenv_bin/python /www/server/panel/tools.py update_to6
# fi
}
update_start(){

View File

@@ -105,5 +105,8 @@ class panel_update:
os.system("echo f|xcopy /s /c /e /y /r {} {}".format(public.to_path(tmpPath),public.to_path(panelPath)))
return public.returnMsg(True,"升级面板成功,重启面板后生效.");
if os.path.exists('C:/update.py'): os.remove('C:/update.py')
os.system('bt restart')
return public.returnMsg(True,"升级面板成功.");

View File

@@ -4,7 +4,7 @@
安装包下载链接http://download.bt.cn/install/src/bt-monitor-版本号.zip
- 删除core/include/c_loader/PluginLoader.so将btmonitor/PluginLoader.py复制到这个文件夹
- 删除core/include/c_loader/PluginLoader.sosqlite_server/PluginLoader.so将btmonitor/PluginLoader.py复制到这个文件夹
- 批量解密源码:执行 php think decrypt all <源码根目录>
@@ -28,7 +28,7 @@
def write_request_log(reques = None): 这一行下面加上 return
- core/basic_monitor.py
- core/include/basic_monitor.py
在 def report_module_logs(self, force=False): 这一行下面加上 return
@@ -40,5 +40,14 @@
- init.sh https://download.bt.cn => http://www.example.com
- BT-MONITOR 取消第一个CreateSSL方法定义的注释删除第二个CreateSSL方法定义
- BT-MONITOR
```python
def CreateSSL():
```
这一行下面加上
```python
return CreateSSL_offline()
```

View File

@@ -3,7 +3,7 @@ import public,os,sys,json
#获取插件列表(0/1)
def get_plugin_list(force = 0):
api_root_url = 'https://api.bt.cn'
api_root_url = 'http://www.example.com'
api_url = api_root_url+ '/panel/get_plugin_list'
cache_file = 'data/plugin_list.json'
@@ -120,3 +120,17 @@ def path_check(path):
if i in list:
return False
return True
#数据加密
def db_encrypt(data):
result = {}
result['status'] = True
result['msg'] = data
return result
#数据解密
def db_decrypt(data):
result = {}
result['status'] = True
result['msg'] = data
return result

View File

@@ -71,12 +71,8 @@
- 去除无用的定时任务task.py 文件 删除以下几行
"update_software_list": update_software_list,
"check_panel_msg": check_panel_msg,
PluginLoader.daemon_panel()
- 去除WebRTC连接BTPanel/static/js/public.js 删除stun.start();这一行
- 去除首页广告BTPanel/static/js/index.js 文件删除最下面index.recommend_paid_version()这一行
@@ -105,6 +101,8 @@
- [可选]关闭自动生成访问日志:在 BTPanel/\_\_init\_\_.py 删除public.write_request_log()这一行
- [可选]删除小图标广告在BTPanel/static/js/site.js删除“WAF防火墙保护网站安全”对应的html标签files.js删除“开启保护文件无法编辑”对应的html标签
解压安装包panel6.zip将更新包改好的文件覆盖到里面然后重新打包即可更新安装包。