mirror of
https://github.com/flucont/btcloud.git
synced 2025-10-14 14:20:22 +00:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
04560cd70c | ||
![]() |
ecfe3c9e20 | ||
![]() |
d8de902f1b | ||
![]() |
fdbbd304cb | ||
![]() |
53a484093e | ||
![]() |
7010d79ca1 |
@@ -5,7 +5,7 @@
|
||||
|
||||
网站后台管理可一键同步宝塔官方的插件列表与增量更新插件包,还有云端使用记录、IP黑白名单、操作日志、定时任务等功能。
|
||||
|
||||
本项目自带 宝塔Linux面板、宝塔Windows面板、aaPanel面板、宝塔云监控 的最新版安装包和更新包,已修改适配此第三方云端,并且全开源,无so等加密文件。
|
||||
本项目自带 **宝塔Linux面板**、**宝塔Windows面板**、**aaPanel面板**、**宝塔云监控** 的最新版安装包和更新包,已修改适配此第三方云端,并且全开源,无.so等加密文件。
|
||||
|
||||
觉得该项目不错的可以给个Star~
|
||||
|
||||
|
@@ -120,7 +120,7 @@ class CleanViteJs extends Command
|
||||
$flag = true;
|
||||
}
|
||||
|
||||
if(strpos($file, '售后QQ群:')!==false){ //main
|
||||
if(strpos($file, '论坛求助')!==false){ //main
|
||||
$code = $this->getExtendCode($file, '"微信公众号"', 1);
|
||||
$code = $this->getExtendFunction($file, $code);
|
||||
$start = strpos($file, $code) - 1;
|
||||
@@ -130,7 +130,7 @@ class CleanViteJs extends Command
|
||||
break;
|
||||
}
|
||||
}
|
||||
$code = $this->getExtendCode($file, '"/other/customer-service.png"', 2);
|
||||
$code = $this->getExtendCode($file, '"/other/customer-qrcode.png"', 2);
|
||||
$code = $this->getExtendFunction($file, $code);
|
||||
$end = strpos($file, $code)+strlen($code);
|
||||
$code = substr($file, $start, $end - $start);
|
||||
@@ -147,6 +147,10 @@ class CleanViteJs extends Command
|
||||
$file = preg_replace('!\w+\(\(\(\)=>"input"===\w+\.\w+\.type\)\)!', '!1', $file);
|
||||
$file = preg_replace('!\w+\(\(function\(\)\{return"calc"===\w+\.\w+\.type\}\)\)!', '!1', $file);
|
||||
$file = preg_replace('!\w+\(\(function\(\)\{return"input"===\w+\.\w+\.type\}\)\)!', '!1', $file);
|
||||
$code = $this->getExtendCode($file, '"自动部署"', 2);
|
||||
if($code){
|
||||
$file = str_replace($code, '', $file);
|
||||
}
|
||||
$flag = true;
|
||||
}
|
||||
|
||||
@@ -178,7 +182,7 @@ class CleanViteJs extends Command
|
||||
if(strpos($file, '"商用SSL证书"')!==false){ //site-ssl
|
||||
$code = $this->getExtendFunction($file, '"商用SSL证书"', '{', '}');
|
||||
$file = str_replace($code, '', $file);
|
||||
$code = $this->getExtendFunction($file, '"宝塔证书"', '{', '}');
|
||||
$code = $this->getExtendFunction($file, '"测试证书"', '{', '}');
|
||||
$file = str_replace($code, '', $file);
|
||||
$code = $this->getExtendCode($file, '"购买商业证书"', 2);
|
||||
if($code){
|
||||
@@ -193,6 +197,25 @@ class CleanViteJs extends Command
|
||||
$file = str_replace('"busSslList"', '"currentCertInfo"', $file);
|
||||
$flag = true;
|
||||
}
|
||||
|
||||
if(strpos($file, '"商用SSL"')!==false){ //ssl
|
||||
$code = $this->getExtendFunction($file, '"商用SSL"', '{', '}');
|
||||
$file = str_replace($code, '', $file);
|
||||
$code = $this->getExtendFunction($file, '"测试证书"', '{', '}');
|
||||
$file = str_replace($code, '', $file);
|
||||
$code = $this->getExtendCode($file, ',"联系客服"', 2, '[', ']');
|
||||
if($code){
|
||||
$file = str_replace($code, '[]', $file);
|
||||
}
|
||||
$code = $this->getExtendCode($file, ',"联系客服"', 2, '[', ']');
|
||||
if($code){
|
||||
$file = str_replace($code, '[]', $file);
|
||||
}
|
||||
}
|
||||
if(strpos($file, '"SSL-CERTIFICATE-STORE"')!==false){ //ssl
|
||||
$file = str_replace('("ssl")', '("encrypt")', $file);
|
||||
$flag = true;
|
||||
}
|
||||
|
||||
if(strpos($file, '如果您希望添加其它Docker应用')!==false){
|
||||
$code = $this->getExtendCode($file, '如果您希望添加其它Docker应用', 1, '[', ']');
|
||||
@@ -217,7 +240,12 @@ class CleanViteJs extends Command
|
||||
for($i=0;$i<5;$i++){
|
||||
$code = $this->getExtendCode($file, ',"需求反馈"', 1, '[', ']');
|
||||
if($code){
|
||||
$file = str_replace($code, '[]', $file);
|
||||
if(strpos($code, 'svgtofont-desired')){
|
||||
$file = str_replace($code, '[]', $file);
|
||||
}else{
|
||||
$code = $this->getExtendFunction($code, ',"需求反馈"');
|
||||
$file = str_replace($code, '', $file);
|
||||
}
|
||||
$flag = true;
|
||||
}
|
||||
}
|
||||
@@ -231,6 +259,11 @@ class CleanViteJs extends Command
|
||||
$file = str_replace($code, '[]', $file);
|
||||
$flag = true;
|
||||
}
|
||||
$code = $this->getExtendFunction($file, 'label:"需求反馈",', '{', '}');
|
||||
if($code){
|
||||
$file = str_replace($code, '', $file);
|
||||
$flag = true;
|
||||
}
|
||||
|
||||
if(strpos('暂无搜索结果,<span class="text-primary cursor-pointer NpsDialog">提交需求反馈</span>', $file)!==false){
|
||||
$file = str_replace('暂无搜索结果,<span class="text-primary cursor-pointer NpsDialog">提交需求反馈</span>', '暂无搜索结果', $file);
|
||||
|
@@ -31,6 +31,9 @@ class UpdateAll extends Command
|
||||
if(!config_get('wbt_type') && config_get('wbt_url') || config_get('wbt_type')==1 && config_get('wbt_surl')){
|
||||
$this->process_plugins($input, $output, 'Windows');
|
||||
}
|
||||
if(!config_get('enbt_type') && config_get('enbt_url') || config_get('enbt_type')==1 && config_get('enbt_surl')){
|
||||
$this->process_plugins($input, $output, 'en');
|
||||
}
|
||||
|
||||
config_set('runtime', date('Y-m-d H:i:s'));
|
||||
}
|
||||
@@ -43,7 +46,13 @@ class UpdateAll extends Command
|
||||
|
||||
$count = 0;
|
||||
|
||||
$type = intval(config_get($os=='Windows'?'updateall_type_win':'updateall_type'));
|
||||
if($os=='Windows'){
|
||||
$type = intval(config_get('updateall_type_win'));
|
||||
}elseif($os=='en'){
|
||||
$type = intval(config_get('updateall_type_en'));
|
||||
}else{
|
||||
$type = intval(config_get('updateall_type'));
|
||||
}
|
||||
|
||||
$json_arr = Plugins::get_plugin_list($os);
|
||||
//循环下载缺少的插件
|
||||
|
@@ -193,6 +193,22 @@ class Api extends BaseController
|
||||
return json($data);
|
||||
}
|
||||
|
||||
public function get_panel_version_v2(){
|
||||
$version = config_get('new_version');
|
||||
$down_url = request()->root(true).'/install/update/LinuxPanel-'.$version.'.zip';
|
||||
$data = [
|
||||
'OfficialVersion' => [
|
||||
'version' => $version,
|
||||
'downUrl' => $down_url,
|
||||
'updateMsg' => config_get('update_msg'),
|
||||
'uptime' => config_get('update_date'),
|
||||
],
|
||||
'OfficialVersionLatest' => [],
|
||||
'AccountVersion' => [],
|
||||
];
|
||||
return json($data);
|
||||
}
|
||||
|
||||
//安装统计
|
||||
public function setup_count(){
|
||||
return 'ok';
|
||||
@@ -486,6 +502,10 @@ class Api extends BaseController
|
||||
return json(['err_no'=>0, 'success'=>true, 'res'=>'Success', 'nonce'=>time()]);
|
||||
}
|
||||
|
||||
public function get_user_give_away(){
|
||||
return json(['no_exceed_limit'=>false, 'user_give'=>true]);
|
||||
}
|
||||
|
||||
//获取所有蜘蛛IP列表
|
||||
public function btwaf_getspiders(){
|
||||
try{
|
||||
@@ -503,6 +523,39 @@ class Api extends BaseController
|
||||
$result = Plugins::get_spider($type);
|
||||
return json($result);
|
||||
}
|
||||
|
||||
//获取堡塔恶意情报IP库
|
||||
public function btwaf_getmalicious(){
|
||||
try{
|
||||
$result = Plugins::btwaf_getmalicious();
|
||||
return json($result);
|
||||
}catch(\Exception $e){
|
||||
return json(['success'=>false, 'res'=>$e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
//检查是否国内IP
|
||||
public function check_cnip(){
|
||||
$clientip = bindec(decbin(ip2long($this->clientip)));
|
||||
$json_file = app()->getBasePath().'lib/cn.json';
|
||||
$arr = json_decode(file_get_contents($json_file), true);
|
||||
if(!$arr) return 'False';
|
||||
foreach($arr as $ip_arr){
|
||||
if($clientip >= $ip_arr[0] && $clientip <= $ip_arr[1]){
|
||||
return 'True';
|
||||
}
|
||||
}
|
||||
return 'False';
|
||||
}
|
||||
|
||||
//邮件配额
|
||||
public function email_user_surplus(){
|
||||
$data = [
|
||||
'free' => ['surplus' => '120000', 'total' => '120000', 'used' => '0'],
|
||||
'period' => ['surplus' => '2000000', 'total' => '2000000', 'used' => '0'],
|
||||
];
|
||||
return json(['success'=>true, 'msg'=>'获取成功', 'res'=>$data]);
|
||||
}
|
||||
|
||||
//检查黑白名单
|
||||
private function checklist(){
|
||||
|
@@ -196,12 +196,14 @@ class BtPlugins
|
||||
$data = str_replace('\'http://www.bt.cn/api/wpanel/notpro', 'public.GetConfigValue(\'home\')+\'/api/wpanel/notpro', $data);
|
||||
$data = str_replace('\'https://www.bt.cn/api/wpanel/notpro', 'public.GetConfigValue(\'home\')+\'/api/wpanel/notpro', $data);
|
||||
|
||||
$data = str_replace('"https://www.bt.cn/api/bt_waf/get_malicious', 'public.GetConfigValue(\'home\')+"/api/bt_waf/get_malicious', $data);
|
||||
$data = str_replace('\'http://www.bt.cn/api/bt_waf/getSpiders', 'public.GetConfigValue(\'home\')+\'/api/bt_waf/getSpiders', $data);
|
||||
$data = str_replace('\'https://www.bt.cn/api/bt_waf/getSpiders', 'public.GetConfigValue(\'home\')+\'/api/bt_waf/getSpiders', $data);
|
||||
$data = str_replace('\'http://www.bt.cn/api/bt_waf/addSpider', 'public.GetConfigValue(\'home\')+\'/api/bt_waf/addSpider', $data);
|
||||
$data = str_replace('\'https://www.bt.cn/api/bt_waf/addSpider', 'public.GetConfigValue(\'home\')+\'/api/bt_waf/addSpider', $data);
|
||||
$data = str_replace('\'https://www.bt.cn/api/bt_waf/getVulScanInfoList', 'public.GetConfigValue(\'home\')+\'/api/bt_waf/getVulScanInfoList', $data);
|
||||
$data = str_replace('\'https://www.bt.cn/api/bt_waf/reportInterceptFail', 'public.GetConfigValue(\'home\')+\'/api/bt_waf/reportInterceptFail', $data);
|
||||
$data = str_replace('"https://www.bt.cn/api/bt_waf/reportInterceptFail', 'public.GetConfigValue(\'home\')+"/api/bt_waf/reportInterceptFail', $data);
|
||||
$data = str_replace('\'https://www.bt.cn/api/v2/contact/nps/questions', 'public.GetConfigValue(\'home\')+\'/panel/notpro', $data);
|
||||
$data = str_replace('\'https://www.bt.cn/api/v2/contact/nps/submit', 'public.GetConfigValue(\'home\')+\'/panel/notpro', $data);
|
||||
$data = str_replace('\'http://www.bt.cn/api/Auth', 'public.GetConfigValue(\'home\')+\'/api/Auth', $data);
|
||||
@@ -290,4 +292,16 @@ class BtPlugins
|
||||
}
|
||||
}
|
||||
|
||||
//获取堡塔恶意情报IP库
|
||||
public function btwaf_getmalicious(){
|
||||
$result = $this->btapi->btwaf_getmalicious();
|
||||
if(isset($result['success'])){
|
||||
return $result;
|
||||
}elseif(isset($result['msg'])){
|
||||
throw new Exception($result['msg']);
|
||||
}else{
|
||||
throw new Exception(isset($result['res'])?$result['res']:'获取失败');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -169,6 +169,18 @@ class Btapi
|
||||
$data = json_decode($result,true);
|
||||
return $data;
|
||||
}
|
||||
|
||||
//BTWAF-获取堡塔恶意情报IP库
|
||||
public function btwaf_getmalicious(){
|
||||
$url = $this->BT_PANEL.'/plugin?action=a&name=kaixin&s=btwaf_getmalicious';
|
||||
|
||||
$p_data = $this->GetKeyData();
|
||||
|
||||
$result = $this->curl($url,$p_data);
|
||||
|
||||
$data = json_decode($result,true);
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
private function GetKeyData(){
|
||||
|
@@ -57,6 +57,7 @@ class Plugins
|
||||
$data['beta'] = 0;
|
||||
$data['uid'] = 1;
|
||||
$data['skey'] = '';
|
||||
$data['pro'] = -1;
|
||||
$data['ltd'] = strtotime('+10 year');
|
||||
}
|
||||
foreach($data['list'] as &$plugin){
|
||||
@@ -192,4 +193,11 @@ class Plugins
|
||||
return $result;
|
||||
}
|
||||
|
||||
//获取堡塔恶意情报IP库
|
||||
public static function btwaf_getmalicious(){
|
||||
$btapi = self::get_btapi('Linux');
|
||||
$result = $btapi->btwaf_getmalicious();
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
@@ -28,11 +28,11 @@ class ThirdPlugins
|
||||
public function get_plugin_list()
|
||||
{
|
||||
if($this->os == 'en'){
|
||||
$url = $this->url . 'api/panel/get_plugin_list_en';
|
||||
$url = $this->url . 'api/panel/getSoftListEn';
|
||||
}elseif($this->os == 'Windows'){
|
||||
$url = $this->url . 'api/wpanel/get_plugin_list';
|
||||
$url = $this->url . 'api/wpanel/get_soft_list';
|
||||
}else{
|
||||
$url = $this->url . 'api/panel/get_plugin_list';
|
||||
$url = $this->url . 'api/panel/get_soft_list';
|
||||
}
|
||||
$res = $this->curl($url);
|
||||
$result = json_decode($res, true);
|
||||
@@ -174,6 +174,18 @@ class ThirdPlugins
|
||||
}
|
||||
}
|
||||
|
||||
//获取堡塔恶意情报IP库
|
||||
public function btwaf_getmalicious(){
|
||||
$url = $this->url . 'api/bt_waf/get_malicious';
|
||||
$res = $this->curl($url);
|
||||
$result = json_decode($res, true);
|
||||
if(isset($result['success'])){
|
||||
return $result;
|
||||
}else{
|
||||
throw new Exception(isset($result['res'])?$result['res']:'获取失败');
|
||||
}
|
||||
}
|
||||
|
||||
private function curl($url, $post = 0){
|
||||
$ua = "Mozilla/5.0 (BtCloud; ".request()->root(true).")";
|
||||
return get_curl($url, $post, 0, 0, 0, $ua);
|
||||
|
1
app/lib/cn.json
Normal file
1
app/lib/cn.json
Normal file
File diff suppressed because one or more lines are too long
@@ -1,14 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
Linux_Version="9.3.0"
|
||||
Windows_Version="8.2.1"
|
||||
Aapanel_Version="7.0.13"
|
||||
Linux_Version="9.5.0"
|
||||
Windows_Version="8.2.2"
|
||||
Aapanel_Version="7.0.16"
|
||||
Btm_Version="2.3.0"
|
||||
|
||||
FILES=(
|
||||
public/install/src/panel6.zip
|
||||
public/install/update/LinuxPanel-${Linux_Version}.zip
|
||||
public/install/install_6.0.sh
|
||||
public/install/install_panel.sh
|
||||
public/install/update_panel.sh
|
||||
public/install/update6.sh
|
||||
public/win/install/panel_update.py
|
||||
@@ -21,7 +21,6 @@ public/install/update_btmonitor.sh
|
||||
public/install/src/panel_7_en.zip
|
||||
public/install/update/LinuxPanel_EN-${Aapanel_Version}.zip
|
||||
public/install/install_7.0_en.sh
|
||||
public/install/install_pro_en.sh
|
||||
public/install/update_7.x_en.sh
|
||||
)
|
||||
|
||||
|
@@ -35,6 +35,7 @@ td{overflow: hidden;text-overflow: ellipsis;white-space: nowrap;max-width:340px;
|
||||
<div class="modal-body">
|
||||
<p>“版本与状态”一列中,红色的按钮代表本地不存在该版本插件包,需要点击下载;绿色的按钮代表已存在。</p>
|
||||
<p>官方插件包本地存储路径是/data/plugins/package/软件标识-版本号.zip,第三方插件包路径是/data/plugins/other/other/,对于部分包含二次验证的插件可以自行修改。</p>
|
||||
<p>若对接的服务器网速较慢,可能会导致下载失败,提示"服务器错误",可稍等一会,进入对接服务器/tmp/plugins目录下载插件包,将_改成-,并上传到本站/data/plugins/package目录下。</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
|
||||
|
@@ -110,15 +110,15 @@
|
||||
<div class="install-code">
|
||||
<span class="osname">Centos安装脚本</span>
|
||||
<div class="code-cont">
|
||||
<div class="command" title="点击复制Centos安装脚本">yum install -y wget && wget -O install.sh {$siteurl}/install/install_6.0.sh && sh install.sh</div>
|
||||
<span class="ico-copy" title="点击复制Centos安装脚本" data-clipboard-text="yum install -y wget && wget -O install.sh {$siteurl}/install/install_6.0.sh && sh install.sh">复制</span>
|
||||
<div class="command" title="点击复制Centos安装脚本">yum install -y wget && wget -O install.sh {$siteurl}/install/install_panel.sh && sh install.sh</div>
|
||||
<span class="ico-copy" title="点击复制Centos安装脚本" data-clipboard-text="yum install -y wget && wget -O install.sh {$siteurl}/install/install_panel.sh && sh install.sh">复制</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="install-code">
|
||||
<span class="osname">Ubuntu/Debian安装脚本</span>
|
||||
<div class="code-cont">
|
||||
<div class="command" title="点击复制Ubuntu/Debian安装脚本">wget -O install.sh {$siteurl}/install/install_6.0.sh && bash install.sh</div>
|
||||
<span class="ico-copy" title="点击复制Ubuntu/Debian安装脚本" data-clipboard-text="wget -O install.sh {$siteurl}/install/install_6.0.sh && bash install.sh">复制</span>
|
||||
<div class="command" title="点击复制Ubuntu/Debian安装脚本">wget -O install.sh {$siteurl}/install/install_panel.sh && bash install.sh</div>
|
||||
<span class="ico-copy" title="点击复制Ubuntu/Debian安装脚本" data-clipboard-text="wget -O install.sh {$siteurl}/install/install_panel.sh && bash install.sh">复制</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="install-code">
|
||||
|
14
install.sql
14
install.sql
@@ -12,12 +12,12 @@ INSERT INTO `cloud_config` (`key`, `value`) VALUES
|
||||
('bt_key', ''),
|
||||
('whitelist', '0'),
|
||||
('download_page', '1'),
|
||||
('new_version', '9.3.0'),
|
||||
('new_version', '9.4.0'),
|
||||
('update_msg', '暂无更新日志'),
|
||||
('update_date', '2024-12-06'),
|
||||
('new_version_win', '8.2.1'),
|
||||
('update_date', '2025-01-09'),
|
||||
('new_version_win', '8.2.2'),
|
||||
('update_msg_win', '暂无更新日志'),
|
||||
('update_date_win', '2024-12-06'),
|
||||
('update_date_win', '2024-12-30'),
|
||||
('new_version_en', '7.0.13'),
|
||||
('update_msg_en', '暂无更新日志'),
|
||||
('update_date_en', '2024-11-17'),
|
||||
@@ -31,7 +31,7 @@ INSERT INTO `cloud_config` (`key`, `value`) VALUES
|
||||
DROP TABLE IF EXISTS `cloud_black`;
|
||||
CREATE TABLE `cloud_black` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ip` varchar(20) NOT NULL,
|
||||
`ip` varchar(50) NOT NULL,
|
||||
`enable` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`addtime` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
@@ -41,7 +41,7 @@ CREATE TABLE `cloud_black` (
|
||||
DROP TABLE IF EXISTS `cloud_white`;
|
||||
CREATE TABLE `cloud_white` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ip` varchar(20) NOT NULL,
|
||||
`ip` varchar(50) NOT NULL,
|
||||
`enable` tinyint(1) NOT NULL DEFAULT '1',
|
||||
`addtime` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
@@ -51,7 +51,7 @@ CREATE TABLE `cloud_white` (
|
||||
DROP TABLE IF EXISTS `cloud_record`;
|
||||
CREATE TABLE `cloud_record` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`ip` varchar(20) NOT NULL,
|
||||
`ip` varchar(50) NOT NULL,
|
||||
`addtime` datetime NOT NULL,
|
||||
`usetime` datetime NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
|
@@ -63,7 +63,7 @@ GetSysInfo() {
|
||||
echo -e ${SYS_VERSION}
|
||||
echo -e Bit:${SYS_BIT} Mem:${MEM_TOTAL}M Core:${CPU_INFO}
|
||||
echo -e ${SYS_INFO}
|
||||
echo -e "Please screenshot above error message and post forum forum.aapanel.com or send email: kern@aapanel.com for help"
|
||||
echo -e "Please screenshot above error message and post forum forum.aapanel.com or send email: support@aapanel.com for help"
|
||||
}
|
||||
|
||||
|
||||
@@ -557,7 +557,7 @@ Install_RPM_Pack() {
|
||||
yum config-manager --set-enabled PowerTools
|
||||
fi
|
||||
|
||||
if [ -f "/etc/redhat-release" ] && [ $(cat /etc/os-release|grep PLATFORM_ID|grep -oE "el9") ];then
|
||||
if [ -f "/etc/redhat-release" ] && [ $(cat /etc/os-release|grep PLATFORM_ID|grep -oE "el9|el10") ];then
|
||||
dnf config-manager --set-enabled crb -y
|
||||
fi
|
||||
|
||||
@@ -648,7 +648,7 @@ Install_Deb_Pack() {
|
||||
apt-get install curl -y
|
||||
fi
|
||||
|
||||
debPacks="wget curl libcurl4-openssl-dev gcc make zip unzip tar openssl libssl-dev gcc libxml2 libxml2-dev libxslt-dev zlib1g zlib1g-dev libjpeg-dev libpng-dev lsof libpcre3 libpcre3-dev cron net-tools swig build-essential libffi-dev libbz2-dev libncurses-dev libsqlite3-dev libreadline-dev tk-dev libgdbm-dev libdb-dev libdb++-dev libpcap-dev xz-utils git ufw ipset sqlite3 uuid-dev libpq-dev liblzma-dev ca-certificates sudo autoconf at mariadb-client rsyslog xfsprogs quota"
|
||||
debPacks="wget curl libcurl4-openssl-dev gcc make zip unzip tar openssl libssl-dev gcc libxml2 libxml2-dev libxslt-dev zlib1g zlib1g-dev libjpeg-dev libpng-dev lsof libpcre3 libpcre3-dev cron net-tools swig build-essential libffi-dev libbz2-dev libncurses-dev libsqlite3-dev libreadline-dev tk-dev libgdbm-dev libdb-dev libdb++-dev libpcap-dev xz-utils git ufw ipset sqlite3 uuid-dev libpq-dev liblzma-dev ca-certificates sudo autoconf at mariadb-client rsyslog xfsprogs quota libssh2-1-dev"
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y $debPacks --allow-downgrades --allow-remove-essential --allow-change-held-packages
|
||||
|
||||
@@ -1130,7 +1130,7 @@ Get_Versions() {
|
||||
os_version=""
|
||||
fi
|
||||
if [ -z "${os_version}" ]; then
|
||||
os_version=$(cat /etc/redhat-release | grep Stream | grep -oE "8|9")
|
||||
os_version=$(cat /etc/redhat-release | grep Stream | grep -oE "8|9|10")
|
||||
fi
|
||||
else
|
||||
os_type='ubuntu'
|
||||
|
@@ -3,9 +3,6 @@ PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
LANG=en_US.UTF-8
|
||||
|
||||
INSTALL_LOGFILE="/tmp/btpanel-install.log"
|
||||
# exec > >(tee -a "$INSTALL_LOGFILE") 2>&1
|
||||
|
||||
Btapi_Url='http://www.example.com'
|
||||
Check_Api=$(curl -Ss --connect-timeout 5 -m 2 $Btapi_Url/api/SetupCount)
|
||||
if [ "$Check_Api" != 'ok' ];then
|
||||
@@ -23,44 +20,6 @@ if [ "${is64bit}" != '64' ];then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Ready_Check(){
|
||||
WWW_DISK_SPACE=$(df |grep /www|awk '{print $4}')
|
||||
ROOT_DISK_SPACE=$(df |grep /$|awk '{print $4}')
|
||||
|
||||
if [ "${ROOT_DISK_SPACE}" -le 412000 ];then
|
||||
df -h
|
||||
echo -e "系统盘剩余空间不足400M 无法继续安装宝塔面板!"
|
||||
echo -e "请尝试清理磁盘空间后再重新进行安装"
|
||||
exit 1
|
||||
fi
|
||||
if [ "${WWW_DISK_SPACE}" ] && [ "${WWW_DISK_SPACE}" -le 412000 ] ;then
|
||||
echo -e "/www盘剩余空间不足400M 无法继续安装宝塔面板!"
|
||||
echo -e "请尝试清理磁盘空间后再重新进行安装"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ROOT_DISK_INODE=$(df -i|grep /$|awk '{print $2}')
|
||||
if [ "${ROOT_DISK_INODE}" != "0" ];then
|
||||
ROOT_DISK_INODE_FREE=$(df -i|grep /$|awk '{print $4}')
|
||||
if [ "${ROOT_DISK_INODE_FREE}" -le 1000 ];then
|
||||
echo -e "系统盘剩余inodes空间不足1000,无法继续安装!"
|
||||
echo -e "请尝试清理磁盘空间后再重新进行安装"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
WWW_DISK_INODE==$(df -i|grep /www|awk '{print $2}')
|
||||
if [ "${WWW_DISK_INODE}" ] && [ "${WWW_DISK_INODE}" != "0" ] ;then
|
||||
WWW_DISK_INODE_FREE=$(df -i|grep /www|awk '{print $4}')
|
||||
if [ "${WWW_DISK_INODE_FREE}" ] && [ "${WWW_DISK_INODE_FREE}" -le 1000 ] ;then
|
||||
echo -e "/www盘剩余inodes空间不足1000, 无法继续安装!"
|
||||
echo -e "请尝试清理磁盘空间后再重新进行安装"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Centos6Check=$(cat /etc/redhat-release | grep ' 6.' | grep -iE 'centos|Red Hat')
|
||||
if [ "${Centos6Check}" ];then
|
||||
echo "Centos6不支持安装宝塔面板,请更换Centos7/8安装宝塔面板"
|
||||
@@ -69,13 +28,14 @@ fi
|
||||
|
||||
UbuntuCheck=$(cat /etc/issue|grep Ubuntu|awk '{print $2}'|cut -f 1 -d '.')
|
||||
if [ "${UbuntuCheck}" ] && [ "${UbuntuCheck}" -lt "16" ];then
|
||||
echo "Ubuntu ${UbuntuCheck}不支持安装宝塔面板,建议更换Ubuntu22/24安装宝塔面板"
|
||||
echo "Ubuntu ${UbuntuCheck}不支持安装宝塔面板,建议更换Ubuntu18/20安装宝塔面板"
|
||||
exit 1
|
||||
fi
|
||||
HOSTNAME_CHECK=$(cat /etc/hostname)
|
||||
if [ -z "${HOSTNAME_CHECK}" ];then
|
||||
echo "当前主机名hostname为空无法安装宝塔面板,请咨询服务器运营商设置好hostname后再重新安装"
|
||||
exit 1
|
||||
echo "localhost" > /etc/hostname
|
||||
# echo "当前主机名hostname为空无法安装宝塔面板,请咨询服务器运营商设置好hostname后再重新安装"
|
||||
# exit 1
|
||||
fi
|
||||
|
||||
UBUNTU_NO_LTS=$(cat /etc/issue|grep Ubuntu|grep -E "19|21|23|25")
|
||||
@@ -101,6 +61,43 @@ panelPort=$(expr $RANDOM % 55535 + 10000)
|
||||
# IDC_CODE=$1
|
||||
# fi
|
||||
|
||||
Ready_Check(){
|
||||
WWW_DISK_SPACE=$(df |grep /www|awk '{print $4}')
|
||||
ROOT_DISK_SPACE=$(df |grep /$|awk '{print $4}')
|
||||
|
||||
if [ "${ROOT_DISK_SPACE}" -le 412000 ];then
|
||||
df -h
|
||||
echo -e "系统盘剩余空间不足400M 无法继续安装宝塔面板!"
|
||||
echo -e "请尝试清理磁盘空间后再重新进行安装"
|
||||
exit 1
|
||||
fi
|
||||
if [ "${WWW_DISK_SPACE}" ] && [ "${WWW_DISK_SPACE}" -le 412000 ] ;then
|
||||
echo -e "/www盘剩余空间不足400M 无法继续安装宝塔面板!"
|
||||
echo -e "请尝试清理磁盘空间后再重新进行安装"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ROOT_DISK_INODE=$(df -i|grep /$|awk '{print $2}')
|
||||
# if [ "${ROOT_DISK_INODE}" != "0" ];then
|
||||
# ROOT_DISK_INODE_FREE=$(df -i|grep /$|awk '{print $4}')
|
||||
# if [ "${ROOT_DISK_INODE_FREE}" -le 1000 ];then
|
||||
# echo -e "系统盘剩余inodes空间不足1000,无法继续安装!"
|
||||
# echo -e "请尝试清理磁盘空间后再重新进行安装"
|
||||
# exit 1
|
||||
# fi
|
||||
# fi
|
||||
|
||||
# WWW_DISK_INODE==$(df -i|grep /www|awk '{print $2}')
|
||||
# if [ "${WWW_DISK_INODE}" ] && [ "${WWW_DISK_INODE}" != "0" ] ;then
|
||||
# WWW_DISK_INODE_FREE=$(df -i|grep /www|awk '{print $4}')
|
||||
# if [ "${WWW_DISK_INODE_FREE}" ] && [ "${WWW_DISK_INODE_FREE}" -le 1000 ] ;then
|
||||
# echo -e "/www盘剩余inodes空间不足1000, 无法继续安装!"
|
||||
# echo -e "请尝试清理磁盘空间后再重新进行安装"
|
||||
# exit 1
|
||||
# fi
|
||||
# fi
|
||||
}
|
||||
|
||||
GetSysInfo(){
|
||||
if [ -s "/etc/redhat-release" ];then
|
||||
SYS_VERSION=$(cat /etc/redhat-release)
|
||||
@@ -126,6 +123,28 @@ GetSysInfo(){
|
||||
echo -e "如是新安装系统服务器建议更换至Debian-12/Ubuntu-22/Centos-9系统安装宝塔面板"
|
||||
echo -e "============================================"
|
||||
fi
|
||||
|
||||
|
||||
if [ -f "/usr/sbin/setstatus" ] || [ -f "/usr/sbin/setstatus" ];then
|
||||
echo -e "=================================================="
|
||||
echo -e " 检测到为麒麟系统,可能默认开启安全功能导致安装失败"
|
||||
echo -e " 请执行以下命令关闭安全加固后,再重新安装宝塔面板看是否正常"
|
||||
echo -e " 命令:sudo setstatus softmode -p"
|
||||
echo -e "=================================================="
|
||||
fi
|
||||
|
||||
SYS_SSL_LIBS=$(pkg-config --list-all | grep -q libssl)
|
||||
if [ -z "$SYS_SSL_LIBS" ];then
|
||||
echo "检测到缺少系统ssl相关依赖,可执行下面命令安装依赖后再重新安装宝塔看是否正常"
|
||||
echo "执行前请确保系统源正常"
|
||||
if [ -f "/usr/bin/yum" ];then
|
||||
echo "安装依赖命令: yum install openssl-devel -y"
|
||||
elif [ -f "/usr/bin/apt-get" ];then
|
||||
echo "安装依赖命令: apt-get install libssl-dev -y"
|
||||
fi
|
||||
rm -rf /www/server/panel/pyenv
|
||||
echo -e "=================================================="
|
||||
fi
|
||||
}
|
||||
Red_Error(){
|
||||
echo '=================================================';
|
||||
@@ -175,11 +194,38 @@ Set_Ssl(){
|
||||
fi
|
||||
}
|
||||
Add_lib_Install(){
|
||||
Get_Versions
|
||||
if [ "${os_type}" == "el" ] && [ "${os_version}" == "7" ];then
|
||||
if [ -f "/etc/os-release" ];then
|
||||
. /etc/os-release
|
||||
OS_V=${VERSION_ID%%.*}
|
||||
if [ "${ID}" == "debian" ] && [[ "${OS_V}" =~ ^(11|12)$ ]];then
|
||||
OS_NAME=${ID}
|
||||
elif [ "${ID}" == "ubuntu" ] && [[ "${OS_V}" =~ ^(22|24)$ ]];then
|
||||
OS_NAME=${ID}
|
||||
elif [ "${ID}" == "centos" ] && [[ "${OS_V}" =~ ^(7)$ ]];then
|
||||
OS_NAME="el"
|
||||
elif [ "${ID}" == "opencloudos" ] && [[ "${OS_V}" =~ ^(9)$ ]];then
|
||||
OS_NAME=${ID}
|
||||
elif [ "${ID}" == "tencentos" ] && [[ "${OS_V}" =~ ^(4)$ ]];then
|
||||
OS_NAME=${ID}
|
||||
elif [ "${ID}" == "hce" ] && [[ "${OS_V}" =~ ^(2)$ ]];then
|
||||
OS_NAME=${ID}
|
||||
elif { [ "${ID}" == "almalinux" ] || [ "${ID}" == "centos" ] || [ "${ID}" == "rocky" ]; } && [[ "${OS_V}" =~ ^(9)$ ]]; then
|
||||
OS_NAME="el"
|
||||
fi
|
||||
fi
|
||||
|
||||
X86_CHECK=$(uname -m|grep x86_64)
|
||||
|
||||
if [ "${OS_NAME}" ] && [ "${X86_CHECK}" ];then
|
||||
if [ "${PM}" = "yum" ]; then
|
||||
mtype="1"
|
||||
elif [ "${PM}" = "apt-get" ]; then
|
||||
mtype="4"
|
||||
fi
|
||||
cd /www/server/panel/class
|
||||
#btpython -c "import panelPlugin; plugin = panelPlugin.panelPlugin(); plugin.check_install_lib('1')"
|
||||
#echo "True" > /tmp/panelTask.pl
|
||||
btpython -c "import panelPlugin; plugin = panelPlugin.panelPlugin(); plugin.check_install_lib('${mtype}')"
|
||||
echo "True" > /tmp/panelTask.pl
|
||||
echo "True" > /www/server/panel/install/ins_lib.pl
|
||||
fi
|
||||
}
|
||||
Get_Pack_Manager(){
|
||||
@@ -189,6 +235,67 @@ Get_Pack_Manager(){
|
||||
PM="apt-get"
|
||||
fi
|
||||
}
|
||||
Set_Repo_Url(){
|
||||
if [ "${PM}"="apt-get" ];then
|
||||
ALI_CLOUD_CHECK=$(grep Alibaba /etc/motd)
|
||||
Tencent_Cloud=$(cat /etc/hostname |grep -E VM-[0-9]+-[0-9]+)
|
||||
if [ "${ALI_CLOUD_CHECK}" ] || [ "${Tencent_Cloud}" ];then
|
||||
return
|
||||
fi
|
||||
|
||||
CN_CHECK=$(curl -sS --connect-timeout 10 -m 10 https://api.bt.cn/api/isCN)
|
||||
if [ "${CN_CHECK}" == "True" ];then
|
||||
SOURCE_URL_CHECK=$(grep -E 'security.ubuntu.com|archive.ubuntu.com|security.debian.org|deb.debian.org' /etc/apt/sources.list)
|
||||
# if [ -f "/etc/apt/sources.list.d/ubuntu.sources" ];then
|
||||
# SOURCE_URL_CHECK=$(grep -E 'security.ubuntu.com|archive.ubuntu.com|security.debian.org|deb.debian.org' /etc/apt/sources.list.d/ubuntu.sources)
|
||||
# fi
|
||||
fi
|
||||
|
||||
#GET_SOURCES_URL=$(cat /etc/apt/sources.list|grep ^deb|head -n 1|awk -F[/:] '{print $4}')
|
||||
GET_SOURCES_URL=$(cat /etc/apt/sources.list|grep ^deb|head -n 1|sed -E 's|^[^ ]+ https?://([^/]+).*|\1|')
|
||||
# if [ -f "/etc/apt/sources.list.d/ubuntu.sources" ];then
|
||||
# GET_SOURCES_URL=$(cat /etc/apt/sources.list.d/ubuntu.sources|grep URIs:|head -n 1|sed -E 's|^[^ ]+ https?://([^/]+).*|\1|')
|
||||
# fi
|
||||
NODE_CHECK=$(curl --connect-timeout 3 -m 3 2>/dev/null -w "%{http_code} %{time_total}" ${GET_SOURCES_URL} -o /dev/null)
|
||||
NODE_STATUS=$(echo ${NODE_CHECK}|awk '{print $1}')
|
||||
TIME_TOTAL=$(echo ${NODE_CHECK}|awk '{print $2 * 1000}'|cut -d '.' -f 1)
|
||||
|
||||
if { [ "${NODE_STATUS}" != "200" ] && [ "${NODE_STATUS}" != "301" ]; } || [ "${TIME_TOTAL}" -ge "150" ] || [ "${SOURCE_URL_CHECK}" ]; then
|
||||
\cp -rpa /etc/apt/sources.list /etc/apt/sources.list.btbackup
|
||||
apt_lists=(mirrors.cloud.tencent.com mirrors.163.com repo.huaweicloud.com mirrors.tuna.tsinghua.edu.cn mirrors.aliyun.com mirrors.ustc.edu.cn )
|
||||
for list in ${apt_lists[@]};
|
||||
do
|
||||
NODE_CHECK=$(curl --connect-timeout 3 -m 3 2>/dev/null -w "%{http_code} %{time_total}" ${list} -o /dev/null)
|
||||
NODE_STATUS=$(echo ${NODE_CHECK}|awk '{print $1}')
|
||||
TIME_TOTAL=$(echo ${NODE_CHECK}|awk '{print $2 * 1000}'|cut -d '.' -f 1)
|
||||
if [ "${NODE_STATUS}" == "200" ] || [ "${NODE_STATUS}" == "301" ];then
|
||||
if [ "${TIME_TOTAL}" -le "150" ];then
|
||||
if [ -f "/etc/apt/sources.list" ];then
|
||||
sed -i "s/${GET_SOURCES_URL}/${list}/g" /etc/apt/sources.list
|
||||
sed -i "s/cn.security.ubuntu.com/${list}/g" /etc/apt/sources.list
|
||||
sed -i "s/cn.archive.ubuntu.com/${list}/g" /etc/apt/sources.list
|
||||
sed -i "s/security.ubuntu.com/${list}/g" /etc/apt/sources.list
|
||||
sed -i "s/archive.ubuntu.com/${list}/g" /etc/apt/sources.list
|
||||
sed -i "s/security.debian.org/${list}/g" /etc/apt/sources.list
|
||||
sed -i "s/deb.debian.org/${list}/g" /etc/apt/sources.list
|
||||
fi
|
||||
# if [ -f "/etc/apt/sources.list.d/ubuntu.sources" ];then
|
||||
# \cp -rpa /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources.bak
|
||||
# sed -i "s/${GET_SOURCES_URL}/${list}/g" /etc/apt/sources.list.d/ubuntu.sources
|
||||
# sed -i "s/cn.security.ubuntu.com/${list}/g" /etc/apt/sources.list.d/ubuntu.sources
|
||||
# sed -i "s/cn.archive.ubuntu.com/${list}/g" /etc/apt/sources.list.d/ubuntu.sources
|
||||
# sed -i "s/security.ubuntu.com/${list}/g" /etc/apt/sources.list.d/ubuntu.sources
|
||||
# sed -i "s/archive.ubuntu.com/${list}/g" /etc/apt/sources.list.d/ubuntu.sources
|
||||
# sed -i "s/security.debian.org/${list}/g" /etc/apt/sources.list.d/ubuntu.sources
|
||||
# sed -i "s/deb.debian.org/${list}/g" /etc/apt/sources.list.d/ubuntu.sources
|
||||
# fi
|
||||
break;
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
}
|
||||
Auto_Swap()
|
||||
{
|
||||
swap=$(free |grep Swap|awk '{print $2}')
|
||||
@@ -278,14 +385,7 @@ Set_Centos7_Repo(){
|
||||
if [ "$?" != "0" ] ;then
|
||||
sed -i "s/vault.epel.cloud/mirrors.cloud.tencent.com/g" /etc/yum.repos.d/*.repo
|
||||
fi
|
||||
|
||||
}
|
||||
# Set_Centos7_Repo(){
|
||||
# if [ -z "${download_Url}" ];then
|
||||
# download_Url="http://download.bt.cn"
|
||||
# fi
|
||||
# curl -Ss --connect-timeout 3 -m 60 ${download_Url}/install/vault-repo.sh|bash
|
||||
# }
|
||||
Set_Centos8_Repo(){
|
||||
HUAWEI_CHECK=$(cat /etc/motd |grep "Huawei Cloud")
|
||||
if [ "${HUAWEI_CHECK}" ] && [ "${is64bit}" == "64" ];then
|
||||
@@ -324,12 +424,16 @@ Set_Centos8_Repo(){
|
||||
rm -f /etc/yum.repos.d/*.repo
|
||||
tar -xvzf el8repo.tar.gz -C /etc/yum.repos.d/
|
||||
fi
|
||||
yum install unzip -y
|
||||
|
||||
yum install unzip tar -y
|
||||
if [ "$?" != "0" ] ;then
|
||||
sed -i "s/vault.epel.cloud/mirrors.cloud.tencent.com/g" /etc/yum.repos.d/*.repo
|
||||
fi
|
||||
}
|
||||
get_node_url(){
|
||||
if [ "${PM}" = "yum" ]; then
|
||||
yum install wget -y
|
||||
fi
|
||||
if [ ! -f /bin/curl ];then
|
||||
if [ "${PM}" = "yum" ]; then
|
||||
yum install curl -y
|
||||
@@ -432,7 +536,7 @@ Install_RPM_Pack(){
|
||||
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.epel.cloud|g' /etc/yum.repos.d/CentOS-*.repo
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
Centos8Check=$(cat /etc/redhat-release | grep ' 8.' | grep -iE 'centos|Red Hat')
|
||||
if [ "${Centos8Check}" ];then
|
||||
Set_Centos8_Repo
|
||||
@@ -506,7 +610,8 @@ Install_RPM_Pack(){
|
||||
Install_Deb_Pack(){
|
||||
ln -sf bash /bin/sh
|
||||
UBUNTU_22=$(cat /etc/issue|grep "Ubuntu 22")
|
||||
if [ "${UBUNTU_22}" ];then
|
||||
UBUNTU_24=$(cat /etc/issue|grep "Ubuntu 24")
|
||||
if [ "${UBUNTU_22}" ] || [ "${UBUNTU_24}" ];then
|
||||
apt-get remove needrestart -y
|
||||
fi
|
||||
ALIYUN_CHECK=$(cat /etc/motd|grep "Alibaba Cloud ")
|
||||
@@ -514,6 +619,13 @@ Install_Deb_Pack(){
|
||||
apt-get remove libicu70 -y
|
||||
fi
|
||||
apt-get update -y
|
||||
|
||||
FNOS_CHECK=$(cat /etc/issue|grep fnOS)
|
||||
if [ "${FNOS_CHECK}" ];then
|
||||
apt-get install libc6 --allow-change-held-packages -y
|
||||
apt-get install libc6-dev --allow-change-held-packages -y
|
||||
fi
|
||||
|
||||
apt-get install bash -y
|
||||
if [ -f "/usr/bin/bash" ];then
|
||||
ln -sf /usr/bin/bash /bin/sh
|
||||
@@ -738,10 +850,10 @@ Install_Python_Lib(){
|
||||
echo "==============================================="
|
||||
if [ "${os_version}" != "" ];then
|
||||
pyenv_file="/www/pyenv.tar.gz"
|
||||
wget -O $pyenv_file $download_Url/install/pyenv/pyenv-${os_type}${os_version}-x${is64bit}.tar.gz -T 15
|
||||
wget -O $pyenv_file $download_Url/install/pyenv/pyenv-${os_type}${os_version}-x${is64bit}.tar.gz -T 20
|
||||
if [ "$?" != "0" ];then
|
||||
get_node_url $download_Url
|
||||
wget -O $pyenv_file $download_Url/install/pyenv/pyenv-${os_type}${os_version}-x${is64bit}.tar.gz -T 15
|
||||
wget -O $pyenv_file $download_Url/install/pyenv/pyenv-${os_type}${os_version}-x${is64bit}.tar.gz -T 20
|
||||
fi
|
||||
tmp_size=$(du -b $pyenv_file|awk '{print $1}')
|
||||
if [ $tmp_size -lt 703460 ];then
|
||||
@@ -803,6 +915,7 @@ Install_Python_Lib(){
|
||||
$pyenv_path/pyenv/bin/pip install -r $pyenv_path/pyenv/pip.txt
|
||||
|
||||
wget -O pip-packs.txt $download_Url/install/pyenv/pip-packs.txt
|
||||
echo "正在后台安装pip依赖请稍等.........."
|
||||
PIP_PACKS=$(cat pip-packs.txt)
|
||||
for P_PACK in ${PIP_PACKS};
|
||||
do
|
||||
@@ -882,7 +995,27 @@ Install_Bt(){
|
||||
yum install unzip -y
|
||||
elif [ "${PM}" = "apt-get" ]; then
|
||||
apt-get update
|
||||
apt-get install unzip -y
|
||||
apt-get install unzip -y 2>&1|tee /tmp/apt_install_log.log
|
||||
UNZIP_CHECK=$(which unzip)
|
||||
if [ "$?" != "0" ];then
|
||||
RECONFIGURE_CHECK=$(grep "dpkg --configure -a" /tmp/apt_install_log.log)
|
||||
if [ "${RECONFIGURE_CHECK}" ];then
|
||||
dpkg --configure -a
|
||||
fi
|
||||
APT_LOCK_CHECH=$(grep "/var/lib/dpkg/lock" /tmp/apt_install_log.log)
|
||||
if [ "${APT_LOCK_CHECH}" ];then
|
||||
pkill dpkg
|
||||
pkill apt-get
|
||||
pkill apt
|
||||
[ -e /var/lib/dpkg/lock-frontend ] && rm -f /var/lib/dpkg/lock-frontend
|
||||
[ -e /var/lib/dpkg/lock ] && rm -f /var/lib/dpkg/lock
|
||||
[ -e /var/lib/apt/lists/lock ] && rm -f /var/lib/apt/lists/lock
|
||||
[ -e /var/cache/apt/archives/lock ] && rm -f /var/cache/apt/archives/lock
|
||||
dpkg --configure -a
|
||||
fi
|
||||
sleep 5
|
||||
apt-get install unzip -y
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1023,6 +1156,7 @@ Set_Bt_Panel(){
|
||||
touch t.pl
|
||||
ls -al python3.7 python
|
||||
lsattr python3.7 python
|
||||
btpython /www/server/panel/BT-Panel
|
||||
Red_Error "ERROR: The BT-Panel service startup failed." "ERROR: 宝塔启动失败"
|
||||
fi
|
||||
|
||||
@@ -1098,7 +1232,40 @@ Set_Firewall(){
|
||||
}
|
||||
Get_Ip_Address(){
|
||||
getIpAddress=""
|
||||
getIpAddress=$(curl -sS --connect-timeout 10 -m 60 https://www.bt.cn/Api/getIpAddress)
|
||||
#getIpAddress=$(curl -sS --connect-timeout 10 -m 60 https://www.bt.cn/Api/getIpAddress)
|
||||
|
||||
ipv4_address=""
|
||||
ipv6_address=""
|
||||
|
||||
ipv4_address=$(curl -4 -sS --connect-timeout 4 -m 5 https://api.bt.cn/Api/getIpAddress 2>&1)
|
||||
if [ -z "${ipv4_address}" ];then
|
||||
ipv4_address=$(curl -4 -sS --connect-timeout 4 -m 5 https://www.bt.cn/Api/getIpAddress 2>&1)
|
||||
if [ -z "${ipv4_address}" ];then
|
||||
ipv4_address=$(curl -4 -sS --connect-timeout 4 -m 5 https://www.aapanel.com/api/common/getClientIP 2>&1)
|
||||
fi
|
||||
fi
|
||||
IPV4_REGEX="^([0-9]{1,3}\.){3}[0-9]{1,3}$"
|
||||
if ! [[ $ipv4_address =~ $IPV4_REGEX ]]; then
|
||||
ipv4_address=""
|
||||
fi
|
||||
|
||||
ipv6_address=$(curl -6 -sS --connect-timeout 4 -m 5 https://www.bt.cn/Api/getIpAddress 2>&1)
|
||||
IPV6_REGEX="^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$"
|
||||
if ! [[ $ipv6_address =~ $IPV6_REGEX ]]; then
|
||||
ipv6_address=""
|
||||
else
|
||||
if [[ ! $ipv6_address =~ ^\[ ]]; then
|
||||
ipv6_address="[$ipv6_address]"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${ipv4_address}" ];then
|
||||
getIpAddress=$ipv4_address
|
||||
elif [ "${ipv6_address}" ];then
|
||||
getIpAddress=$ipv6_address
|
||||
fi
|
||||
|
||||
|
||||
if [ -z "${getIpAddress}" ] || [ "${getIpAddress}" = "0.0.0.0" ]; then
|
||||
isHosts=$(cat /etc/hosts|grep 'www.bt.cn')
|
||||
if [ -z "${isHosts}" ];then
|
||||
@@ -1109,6 +1276,13 @@ Get_Ip_Address(){
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
CN_CHECK=$(curl -sS --connect-timeout 10 -m 10 http://www.example.com/api/isCN)
|
||||
if [ "${CN_CHECK}" == "True" ];then
|
||||
echo "True" > /www/server/panel/data/domestic_ip.pl
|
||||
else
|
||||
echo "True" > /www/server/panel/data/foreign_ip.pl
|
||||
fi
|
||||
|
||||
ipv4Check=$($python_bin -c "import re; print(re.match('^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$','${getIpAddress}'))")
|
||||
if [ "${ipv4Check}" == "None" ];then
|
||||
@@ -1120,6 +1294,7 @@ Get_Ip_Address(){
|
||||
echo "True" > ${setup_path}/server/panel/data/ipv6.pl
|
||||
sleep 1
|
||||
/etc/init.d/bt restart
|
||||
getIpAddress=$(echo "[$getIpAddress]")
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1144,6 +1319,7 @@ Install_Main(){
|
||||
Lock_Clear
|
||||
System_Check
|
||||
Get_Pack_Manager
|
||||
Set_Repo_Url
|
||||
get_node_url
|
||||
|
||||
MEM_TOTAL=$(free -g|grep Mem|awk '{print $2}')
|
||||
@@ -1182,6 +1358,7 @@ echo "
|
||||
+----------------------------------------------------------------------
|
||||
"
|
||||
|
||||
|
||||
while [ ${#} -gt 0 ]; do
|
||||
case $1 in
|
||||
-u|--user)
|
||||
@@ -1245,6 +1422,7 @@ if [ -f "/www/server/panel/BT-Panel" ];then
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
ARCH_LINUX=$(cat /etc/os-release |grep "Arch Linux")
|
||||
if [ "${ARCH_LINUX}" ] && [ -f "/usr/bin/pacman" ];then
|
||||
pacman -Sy
|
||||
@@ -1265,21 +1443,26 @@ echo -e "=================================================================="
|
||||
echo -e "\033[32mCongratulations! Installed successfully!\033[0m"
|
||||
echo -e "========================面板账户登录信息=========================="
|
||||
echo -e ""
|
||||
echo -e " 外网面板地址: ${HTTP_S}://${getIpAddress}:${panelPort}${auth_path}"
|
||||
echo -e " 内网面板地址: ${HTTP_S}://${LOCAL_IP}:${panelPort}${auth_path}"
|
||||
echo -e " 【云服务器】请在安全组放行 $panelPort 端口"
|
||||
if [ -z "${ipv4_address}" ] && [ -z "${ipv6_address}" ];then
|
||||
echo -e " 外网面板地址: ${HTTP_S}://SERVER_IP:${panelPort}${auth_path}"
|
||||
fi
|
||||
if [ "${ipv4_address}" ];then
|
||||
echo -e " 外网ipv4面板地址: ${HTTP_S}://${ipv4_address}:${panelPort}${auth_path}"
|
||||
fi
|
||||
if [ "${ipv6_address}" ];then
|
||||
echo -e " 外网ipv6面板地址: ${HTTP_S}://${ipv6_address}:${panelPort}${auth_path}"
|
||||
fi
|
||||
echo -e " 内网面板地址: ${HTTP_S}://${LOCAL_IP}:${panelPort}${auth_path}"
|
||||
echo -e " username: $username"
|
||||
echo -e " password: $password"
|
||||
echo -e " "
|
||||
echo -e "=========================打开面板前请看==========================="
|
||||
echo -e ""
|
||||
echo -e " 【云服务器】请在安全组放行 $panelPort 端口"
|
||||
echo -e " 因默认启用自签证书https加密访问,浏览器将提示不安全"
|
||||
echo -e " 点击【高级】-【继续访问】或【接受风险并继续】访问"
|
||||
echo -e " 教程:https://www.bt.cn/bbs/thread-117246-1-1.html"
|
||||
echo -e ""
|
||||
echo -e "=================================================================="
|
||||
endTime=`date +%s`
|
||||
((outTime=($endTime-$startTime)/60))
|
||||
if [ "${outTime}" -le "5" ];then
|
||||
echo ${download_Url} > /www/server/panel/install/d_node.pl
|
||||
fi
|
||||
if [ "${outTime}" == "0" ];then
|
||||
((outTime=($endTime-$startTime)))
|
||||
echo -e "Time consumed:\033[32m $outTime \033[0mseconds!"
|
@@ -14,9 +14,31 @@ if [ "${NODE_FILE_CHECK}" ];then
|
||||
rm -f /www/server/panel/data/node.json
|
||||
fi
|
||||
|
||||
if [ -f "/www/server/panel/install/d_node.pl" ];then
|
||||
LOCAL_DATE=$(date +%Y-%m-%d)
|
||||
FILE_DATE=$(stat /www/server/panel/install/d_node.pl|grep Change|awk '{print $2}')
|
||||
if [ "${LOCAL_DATE}" != "${FILE_DATE}" ];then
|
||||
rm -f /www/server/panel/install/d_node.pl
|
||||
else
|
||||
test_url=$(cat /www/server/panel/install/d_node.pl)
|
||||
HTTP_CHECK=$(curl --connect-timeout 3 -m 3 2>/dev/null -w "%{http_code} %{time_total}" ${test_url}/net_test|xargs|awk '{print $2}')
|
||||
if [ "${HTTP_CHECK}" == "200" ];then
|
||||
NODE_URL=$test_url
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
get_node_url(){
|
||||
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 https://cf1-node.aapanel.com);
|
||||
|
||||
if [ -f "/www/server/panel/data/domestic_ip.pl" ];then
|
||||
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);
|
||||
fi
|
||||
|
||||
if [ -f "/www/server/panel/data/foreign_ip.pl" ];then
|
||||
nodes=(https://cf1-node.aapanel.com https://dg2.bt.cn https://na1-node.bt.cn https://jp1-node.bt.cn https://download.bt.cn https://ctcc1-node.bt.cn https://ctcc2-node.bt.cn https://hk1-node.bt.cn);
|
||||
fi
|
||||
|
||||
if [ "$1" ];then
|
||||
nodes=($(echo ${nodes[*]}|sed "s#${1}##"))
|
||||
fi
|
||||
@@ -29,7 +51,11 @@ get_node_url(){
|
||||
touch $tmp_file2
|
||||
for node in ${nodes[@]};
|
||||
do
|
||||
NODE_CHECK=$(curl --connect-timeout 3 -m 3 2>/dev/null -w "%{http_code} %{time_total}" ${node}/net_test|xargs)
|
||||
if [ "${node}" == "https://cf1-node.aapanel.com" ];then
|
||||
NODE_CHECK=$(curl --connect-timeout 3 -m 3 2>/dev/null -w "%{http_code} %{time_total}" ${node}/1net_test|xargs)
|
||||
else
|
||||
NODE_CHECK=$(curl --connect-timeout 3 -m 3 2>/dev/null -w "%{http_code} %{time_total}" ${node}/net_test|xargs)
|
||||
fi
|
||||
RES=$(echo ${NODE_CHECK}|awk '{print $1}')
|
||||
NODE_STATUS=$(echo ${NODE_CHECK}|awk '{print $2}')
|
||||
TIME_TOTAL=$(echo ${NODE_CHECK}|awk '{print $3 * 1000 - 500 }'|cut -d '.' -f 1)
|
||||
@@ -113,7 +139,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 https://www.bt.cn/api/panel/notpro?version=$p_version
|
||||
curl -sS --connect-timeout 3 -m 60 http://www.example.com/api/panel/notpro?version=$p_version
|
||||
NODE_URL=""
|
||||
exit 0;
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -102,8 +102,8 @@ if [ -f "/etc/redhat-release" ];then
|
||||
fi
|
||||
setup_path=/www
|
||||
version=$(curl -Ss --connect-timeout 5 -m 2 $Btapi_Url/api/panel/get_version)
|
||||
if [ -z "$VERSION_CHECK" ];then
|
||||
version='9.3.0'
|
||||
if [ -z "$version" ];then
|
||||
version='9.5.0'
|
||||
fi
|
||||
armCheck=$(uname -m|grep arm)
|
||||
if [ "${armCheck}" ];then
|
||||
|
Binary file not shown.
Binary file not shown.
@@ -15,6 +15,7 @@ Route::post('/panel/get_unbinding', 'api/return_success');
|
||||
Route::post('/bt_cert', 'api/bt_cert');
|
||||
Route::post('/Auth/GetAuthToken', 'api/get_auth_token');
|
||||
Route::post('/Auth/GetBindCode', 'api/return_error');
|
||||
Route::post('/auth/GetUserGiveAway', 'api/get_user_give_away');
|
||||
Route::any('/bt_monitor/update_history', 'api/btm_update_history');
|
||||
Route::any('/bt_monitor/latest_version', 'api/btm_latest_version');
|
||||
Route::any('/bt_waf/get_malicious_ip', 'api/get_ssl_list');
|
||||
@@ -40,6 +41,7 @@ Route::group('api', function () {
|
||||
Route::get('/panel/get_version', 'api/get_version');
|
||||
Route::get('/wpanel/get_version', 'api/get_version_win');
|
||||
Route::get('/panel/get_panel_version', 'api/get_panel_version');
|
||||
Route::any('/panel/get_panel_version_v2', 'api/get_panel_version_v2');
|
||||
Route::get('/SetupCount', 'api/setup_count');
|
||||
Route::any('/panel/updateLinux', 'api/check_update');
|
||||
Route::any('/wpanel/updateWindows', 'api/check_update_win');
|
||||
@@ -57,6 +59,7 @@ Route::group('api', function () {
|
||||
Route::post('/Cert/get_order_list', 'api/return_empty_array');
|
||||
Route::post('/Cert/get_product_list', 'api/return_success');
|
||||
Route::get('/Pluginother/get_file', 'api/download_plugin_other');
|
||||
Route::get('/isCN', 'api/check_cnip');
|
||||
|
||||
Route::post('/Pluginother/create_order', 'api/return_success');
|
||||
Route::post('/Pluginother/renew_order', 'api/return_success');
|
||||
@@ -113,11 +116,16 @@ Route::group('api', function () {
|
||||
|
||||
Route::post('/v2/common_v1_authorization/get_pricing', 'api/return_error2');
|
||||
Route::post('/v2/common_v2_authorization/get_pricing', 'api/return_error2');
|
||||
Route::post('/v2/synchron', 'api/return_error2');
|
||||
Route::post('/v2/product/email/user_surplus', 'api/email_user_surplus');
|
||||
Route::post('/v2/product/email', 'api/return_error2');
|
||||
|
||||
Route::any('/bt_waf/getSpiders', 'api/btwaf_getspiders');
|
||||
Route::any('/bt_waf/get_malicious', 'api/btwaf_getmalicious');
|
||||
Route::post('/bt_waf/addSpider', 'api/return_empty');
|
||||
Route::post('/bt_waf/getVulScanInfoList', 'api/return_empty');
|
||||
Route::post('/bt_waf/reportInterceptFail', 'api/return_empty');
|
||||
Route::any('/bt_waf/get_system_malicious', 'api/return_error2');
|
||||
Route::any('/panel/get_spider', 'api/get_spider');
|
||||
|
||||
Route::post('/Auth/GetSocre', 'api/get_ssl_list');
|
||||
|
@@ -59,13 +59,6 @@
|
||||
temp_file = temp_file.replace('https://download.bt.cn/install/public.sh', 'http://www.example.com/install/public.sh')
|
||||
```
|
||||
|
||||
def check_status(self, softInfo): 方法最后一行加上
|
||||
|
||||
```python
|
||||
if 'endtime' in softInfo:
|
||||
softInfo['endtime'] = time.time() + 86400 * 3650
|
||||
```
|
||||
|
||||
- class_v2/btdockerModelV2/flush_plugin.py 文件,删除clear_hosts()一行
|
||||
|
||||
- install/install_soft.sh 在. 执行之前加入以下代码
|
||||
|
@@ -11,7 +11,7 @@
|
||||
#| 插件和模块加载器
|
||||
#+--------------------------------------------------------------------
|
||||
|
||||
import public,os,sys,json
|
||||
import public,os,sys,json,hashlib
|
||||
|
||||
def plugin_run(plugin_name,def_name,args):
|
||||
'''
|
||||
@@ -186,10 +186,37 @@ def get_plugin_list(upgrade_force = False):
|
||||
raise Exception(plugin_list)
|
||||
else:
|
||||
raise Exception('云端插件列表获取失败')
|
||||
public.writeFile(plugin_list_file,json.dumps(plugin_list))
|
||||
content = json.dumps(plugin_list)
|
||||
public.writeFile(plugin_list_file,content)
|
||||
|
||||
plugin_bin_file = os.path.join(data_path,'plugin_bin.pl')
|
||||
encode_content = __encode_plugin_list(content)
|
||||
if encode_content:
|
||||
public.writeFile(plugin_bin_file,encode_content)
|
||||
|
||||
return plugin_list
|
||||
|
||||
def __encode_plugin_list(content):
|
||||
try:
|
||||
userInfo = public.get_user_info()
|
||||
if not userInfo or 'serverid' not in userInfo: return None
|
||||
block_size = 51200
|
||||
uid = str(userInfo['uid'])
|
||||
server_id = userInfo['serverid']
|
||||
key = server_id[10:26] + uid + server_id
|
||||
key = hashlib.md5(key.encode()).hexdigest()
|
||||
iv = key + server_id
|
||||
iv = hashlib.md5(iv.encode()).hexdigest()
|
||||
key = key[8:24]
|
||||
iv = iv[8:24]
|
||||
blocks = [content[i:i + block_size] for i in range(0, len(content), block_size)]
|
||||
encrypted_content = ''
|
||||
for block in blocks:
|
||||
encrypted_content += __aes_encrypt(block, key, iv) + '\n'
|
||||
return encrypted_content
|
||||
except:
|
||||
pass
|
||||
return None
|
||||
|
||||
def start_total():
|
||||
'''
|
||||
|
@@ -58,7 +58,7 @@
|
||||
|
||||
在login_send_body方法内,free_login_area(login_ip=server_ip_area的server_ip_area改成login_ip
|
||||
|
||||
- class/panelPlugin.py 文件,删除public.total_keyword(get.query)这一行
|
||||
- class/panelPlugin.py 文件
|
||||
|
||||
__set_pyenv方法内,temp_file = public.readFile(filename)这行代码下面加上
|
||||
|
||||
@@ -76,6 +76,10 @@
|
||||
|
||||
plugin_bin.pl 改成 plugin_list.json
|
||||
|
||||
删除 public.total_keyword(get.query)
|
||||
|
||||
删除 public.run_thread(self.get_cloud_list_status, args=(get,))
|
||||
|
||||
删除 public.run_thread(self.is_verify_unbinding, args=(get,))
|
||||
|
||||
- class/plugin_deployment.py 文件,__setup_php_environment方法和GetJarPath方法内替换 public.GetConfigValue('home') => 'https://www.bt.cn'
|
||||
@@ -97,8 +101,8 @@
|
||||
- install/install_soft.sh 在. 执行之前加入以下代码
|
||||
|
||||
```shell
|
||||
sed -i "s/http:\/\/download.bt.cn\/install\/public.sh/http:\/\/www.example.com\/install\/public.sh/" lib.sh
|
||||
sed -i "s/https:\/\/download.bt.cn\/install\/public.sh/http:\/\/www.example.com\/install\/public.sh/" lib.sh
|
||||
sed -i "s/http:\/\/download.bt.cn\/install\/public.sh/http:\/\/www.example.com\/install\/public.sh/" $name.sh
|
||||
sed -i "s/https:\/\/download.bt.cn\/install\/public.sh/http:\/\/www.example.com\/install\/public.sh/" $name.sh
|
||||
```
|
||||
|
||||
- install/public.sh 用官网最新版的[public.sh](http://download.bt.cn/install/public.sh)替换,并去除最下面bt_check一行
|
||||
@@ -113,16 +117,16 @@
|
||||
|
||||
check_node_status()
|
||||
|
||||
self.upload_send_num()
|
||||
|
||||
- script/site_task.py 删除flush_ssh_log()
|
||||
|
||||
- [可选]去除各种计算题:复制bt.js到 BTPanel/static/ ,在 BTPanel/templates/default/layout.html 的\</body\>前面加入
|
||||
- [可选]去除各种计算题:复制bt.js到 BTPanel/static/ ,在 BTPanel/templates/default/software.html 的 \<script\>window.vite_public_request_token 前面加入
|
||||
|
||||
```javascript
|
||||
<script src="/static/bt.js"></script>
|
||||
```
|
||||
|
||||
在 BTPanel/templates/default/software.html 的 \<script\>window.vite_public_request_token 前面加入
|
||||
|
||||
- [可选]去除创建网站自动创建的垃圾文件:在class/panelSite.py,分别删除
|
||||
|
||||
htaccess = self.sitePath + '/.htaccess'
|
||||
|
Reference in New Issue
Block a user