├── README.md ├── README_ZH.md ├── install.sh └── server ├── bunserver.service ├── bunserver.sh ├── config ├── config.yml ├── custom_inbound.json ├── custom_outbound.json ├── dns.json ├── geoip.dat ├── geosite.dat ├── route.json └── rulelist ├── docker-compose.yml └── install.sh /README.md: -------------------------------------------------------------------------------- 1 | # BunPanel Features 2 | * The server is implemented using nodejs 3 | * The front end uses vue3 + typescript + pinia + material design3 4 | * The server uses binary files to run and is easy to install. 5 | * Supports one-click installation of backend services 6 | * Support setting up reverse proxy service 7 | * More new features 8 | 9 | # Installation Guide | [中文教程](https://github.com/pennyMorant/bunpanel-release/blob/dev/README_ZH.md) | [Demo](https://demo.bunpanel.com) | [Telegram](https://t.me/bunpanel) 10 | This tutorial is based on 1panel. The server requires authorization for use. If you need to test, please apply for a test authorization code from this BOT: [https://t.me/bunpanel_bot](https://t.me/bunpanel_bot) 11 | 12 | # Environment 13 | 1. Go to the 1panel store and install OpenResty and PostgreSQL. 14 | 2. Prepare three domain names, which can be three subdomains, corresponding to the user frontend, admin frontend, and server. 15 | 16 | # Install User Frontend 17 | 1. Create a website, select a static website, and enter the prepared user frontend domain. 18 | 2. enable website config gzip, edit config: gzip_static on; 19 | 3. Go to the website root directory, then enter the index directory and delete index.html. 20 | 4. Upload the frontend source code to this directory and unzip it. 21 | 5. Open config.json, modify apiUrl: http://server domain (authorization domain). 22 | 6. Now you should be able to access the frontend page. 23 | 24 | # Install Admin Frontend 25 | Same as the above steps, but the domain is the prepared admin frontend domain. 26 | 27 | # Install Server 28 | 1. Create a website, select revers proxy, and enter the server domain 29 | 2. go to the website root dirctory,then into index directory and upload server souce code 30 | 3. `cp .env.example .env && vim .env` 31 | 4. enter your database info, license 32 | 5. go to Host->Supervisor, and create daemon process 33 | 6. enter config for daemon process 34 | * name: any string 35 | * directory: your server source code directory 36 | * command: /your directory/bunserver name 37 | 7. await start , then go to daemon process log. finding admin account info in log 38 | 39 | # Install Server Backend 40 | 41 | bash <(curl -Ls https://raw.githubusercontent.com/pennyMorant/bunpanel-release/dev/server/install.sh) 42 | 43 | -------------------------------------------------------------------------------- /README_ZH.md: -------------------------------------------------------------------------------- 1 | # 安装教程 | [Demo](https://demo.bunpanel.com) | [Telegram](https://t.me/bunpanel) 2 | 此教程基于1panel 3 | 服务端需要授权使用,如需测试请在此BOT申请测试授权码https://t.me/bunpanel_bot 4 | # 环境 5 | 1. 进入1panel商店,安装openresty, postgersql 6 | 2. 准备三个域名,可以是三个子域名,分别对应用户前端,管理前端和服务端 7 | 8 | # 安装用户前端 9 | 1. 创建网站,选择静态网站,域名填写准备的用户前端域名 10 | 2. 进入网站配置,然后编辑网站配置。在配置中输入: gzip_static on; 11 | 3. 进入网站根目录,然后进入index目录删除index.html 12 | 4. 上传前端源码到此目录,并解压 13 | 5. 打开config.json ,修改apiUrl: http://服务端域名(授权域名) 14 | 6. 现在应该可以访问前端页面了 15 | 16 | # 安装管理前端 17 | 同上面步骤一样,不过域名是用准备的管理前端域名 18 | 19 | # 安装服务端 20 | 1. 创建网站,选择反向代理 21 | 2. 进入网站根目录,然后进入index目录。把服务端代码上传到此目录,并解压到此目录 22 | 3. `cp .env.example .env && vim .env` 23 | 4. 输入你的数据库信息和授权码 24 | 5. 进入 主机->进程守护,创建守护进程 25 | 6. 输入守护进程配置信息 26 | * name: 任何字符串 27 | * directory: 服务端代码根目录路径 28 | * command: /你的目录/bunserver 名字 29 | 7. 等待启动,进入守护进程的日志,找到管理员账户信息。 30 | 31 | # 安装节点后端 32 | 33 | bash <(curl -Ls https://raw.githubusercontent.com/pennyMorant/bunpanel-release/dev/server/install.sh) 34 | 35 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | get_linux_distribution_and_cpu() { 4 | # 检查是否存在 /etc/os-release 文件 5 | if [ -f /etc/os-release ]; then 6 | # 导入文件以获取发行版信息 7 | source /etc/os-release 8 | if [ -n "$ID" ]; then 9 | DISTRIBUTION="$ID" 10 | else 11 | echo "无法检测到Linux发行版本。" 12 | exit 1 13 | fi 14 | else 15 | echo "无法检测到Linux发行版本。" 16 | exit 1 17 | fi 18 | 19 | # 检查CPU是否支持64位 20 | if [ "$(lscpu | grep "Architecture" | awk '{print $2}')" != "x86_64" ]; then 21 | echo "CPU不支持64位操作系统。" 22 | exit 1 23 | fi 24 | } 25 | 26 | install_packages() { 27 | case "$DISTRIBUTION" in 28 | "ubuntu" | "debian") 29 | apt-get update 30 | apt-get install -y zip curl postgresql supervisor 31 | ;; 32 | 33 | "centos" | "rhel") 34 | yum install -y zip curl postgresql supervisor 35 | ;; 36 | *) 37 | echo "不支持的Linux发行版本: $DISTRIBUTION" 38 | exit 1 39 | ;; 40 | esac 41 | } 42 | 43 | download_latest_release() { 44 | API_URL="https://api.github.com/repos/zeropanel/bunpanel-release/releases/latest" 45 | TAG=$(curl -s $API_URL | grep -o '"tag_name": ".*"' | cut -d '"' -f 4) 46 | echo "版本:$TAG" 47 | ARCHITECTURE="$(uname -m)" # 获取系统架构 48 | case "$ARCHITECTURE" in 49 | "x86_64") 50 | RELEASE_FILE="bunpanel-x64.zip" 51 | ;; 52 | "aarch64") 53 | RELEASE_FILE="bunpanel-arm64.zip" 54 | ;; 55 | *) 56 | echo "不支持的系统架构: $ARCHITECTURE" 57 | exit 1 58 | ;; 59 | 60 | esac 61 | REPO_URL="https://github.com/zeropanel/bunpanel-release/releases/download/$TAG/$RELEASE_FILE" 62 | RELEASE_URL=$(curl -sI -o /dev/null -w %{url_effective} "$REPO_URL") 63 | 64 | if [ -z "$RELEASE_URL" ]; then 65 | echo "无法获取最新发布版本的URL。" 66 | exit 1 67 | fi 68 | 69 | echo "正在下载最新发布版本:$RELEASE_FILE" 70 | wget "$RELEASE_URL" 71 | 72 | if [ $? -ne 0 ]; then 73 | echo "下载失败:$RELEASE_URL" 74 | exit 1 75 | fi 76 | } 77 | 78 | extract_zip_file() { 79 | ZIP_FILE="$RELEASE_FILE" 80 | DEST_DIR="/var/www/bun" 81 | 82 | if [ ! -d "$DEST_DIR" ]; then 83 | mkdir -p "$DEST_DIR" 84 | fi 85 | 86 | unzip -q "$ZIP_FILE" -d "$DEST_DIR" 87 | cp $DEST_DIR/.env.example $DEST_DIR/.env 88 | rm "$ZIP_FILE" 89 | if [ $? -ne 0 ]; then 90 | echo "解压失败:$ZIP_FILE" 91 | exit 1 92 | fi 93 | } 94 | 95 | 96 | create_supervisor_config() { 97 | supervisor_config="/etc/supervisor/conf.d/bun.conf" 98 | bunpanel_command="bunpanel-x64" # 默认使用x64配置文件 99 | 100 | # 检测系统架构,如果为arm64,则使用arm64配置文件 101 | if [ "$(uname -m)" == "aarch64" ]; then 102 | bunpanel_command="bunpanel-arm64" 103 | fi 104 | 105 | cat > "$supervisor_config" < 1 ]]; then 58 | echo && read -p "$1 [默认$2]: " temp 59 | if [[ x"${temp}" == x"" ]]; then 60 | temp=$2 61 | fi 62 | else 63 | read -p "$1 [y/n]: " temp 64 | fi 65 | if [[ x"${temp}" == x"y" || x"${temp}" == x"Y" ]]; then 66 | return 0 67 | else 68 | return 1 69 | fi 70 | } 71 | 72 | confirm_restart() { 73 | confirm "是否重启bunserver" "y" 74 | if [[ $? == 0 ]]; then 75 | restart 76 | else 77 | show_menu 78 | fi 79 | } 80 | 81 | before_show_menu() { 82 | echo && echo -n -e "${yellow}按回车返回主菜单: ${plain}" && read temp 83 | show_menu 84 | } 85 | 86 | install() { 87 | bash <(curl -Ls https://raw.githubusercontent.com/pennyMorant/bunpanel-release/dev/server/install.sh) 88 | if [[ $? == 0 ]]; then 89 | if [[ $# == 0 ]]; then 90 | start 91 | else 92 | start 0 93 | fi 94 | fi 95 | } 96 | 97 | update() { 98 | if [[ $# == 0 ]]; then 99 | echo && echo -n -e "输入指定版本(默认最新版): " && read version 100 | else 101 | version=$2 102 | fi 103 | # confirm "本功能会强制重装当前最新版,数据不会丢失,是否继续?" "n" 104 | # if [[ $? != 0 ]]; then 105 | # echo -e "${red}已取消${plain}" 106 | # if [[ $1 != 0 ]]; then 107 | # before_show_menu 108 | # fi 109 | # return 0 110 | # fi 111 | bash <(curl -Ls https://raw.githubusercontent.com/pennyMorant/bunpanel-release/dev/server/install.sh) $version 112 | if [[ $? == 0 ]]; then 113 | echo -e "${green}更新完成,已自动重启 bunserver,请使用 bunserver log 查看运行日志${plain}" 114 | exit 115 | fi 116 | 117 | if [[ $# == 0 ]]; then 118 | before_show_menu 119 | fi 120 | } 121 | 122 | config() { 123 | echo "bunserver在修改配置后会自动尝试重启" 124 | vi /etc/bunserver/config.yml 125 | sleep 2 126 | check_status 127 | case $? in 128 | 0) 129 | echo -e "bunserver状态: ${green}已运行${plain}" 130 | ;; 131 | 1) 132 | echo -e "检测到您未启动bunserver或bunserver自动重启失败,是否查看日志?[Y/n]" && echo 133 | read -e -p "(默认: y):" yn 134 | [[ -z ${yn} ]] && yn="y" 135 | if [[ ${yn} == [Yy] ]]; then 136 | show_log 137 | fi 138 | ;; 139 | 2) 140 | echo -e "bunserver状态: ${red}未安装${plain}" 141 | esac 142 | } 143 | 144 | uninstall() { 145 | confirm "确定要卸载 bunserver 吗?" "n" 146 | if [[ $? != 0 ]]; then 147 | if [[ $# == 0 ]]; then 148 | show_menu 149 | fi 150 | return 0 151 | fi 152 | systemctl stop bunserver 153 | systemctl disable bunserver 154 | rm /etc/systemd/system/bunserver.service -f 155 | systemctl daemon-reload 156 | systemctl reset-failed 157 | rm /etc/bunserver/ -rf 158 | rm /usr/local/bunserver/ -rf 159 | 160 | echo "" 161 | echo -e "卸载成功,如果你想删除此脚本,则退出脚本后运行 ${green}rm /usr/bin/bunserver -f${plain} 进行删除" 162 | echo "" 163 | 164 | if [[ $# == 0 ]]; then 165 | before_show_menu 166 | fi 167 | } 168 | 169 | start() { 170 | check_status 171 | if [[ $? == 0 ]]; then 172 | echo "" 173 | echo -e "${green}bunserver已运行,无需再次启动,如需重启请选择重启${plain}" 174 | else 175 | systemctl start bunserver 176 | sleep 2 177 | check_status 178 | if [[ $? == 0 ]]; then 179 | echo -e "${green}bunserver 启动成功,请使用 bunserver log 查看运行日志${plain}" 180 | else 181 | echo -e "${red}bunserver可能启动失败,请稍后使用 bunserver log 查看日志信息${plain}" 182 | fi 183 | fi 184 | 185 | if [[ $# == 0 ]]; then 186 | before_show_menu 187 | fi 188 | } 189 | 190 | stop() { 191 | systemctl stop bunserver 192 | sleep 2 193 | check_status 194 | if [[ $? == 1 ]]; then 195 | echo -e "${green}bunserver 停止成功${plain}" 196 | else 197 | echo -e "${red}bunserver停止失败,可能是因为停止时间超过了两秒,请稍后查看日志信息${plain}" 198 | fi 199 | 200 | if [[ $# == 0 ]]; then 201 | before_show_menu 202 | fi 203 | } 204 | 205 | restart() { 206 | systemctl restart bunserver 207 | sleep 2 208 | check_status 209 | if [[ $? == 0 ]]; then 210 | echo -e "${green}bunserver 重启成功,请使用 bunserver log 查看运行日志${plain}" 211 | else 212 | echo -e "${red}bunserver可能启动失败,请稍后使用 bunserver log 查看日志信息${plain}" 213 | fi 214 | if [[ $# == 0 ]]; then 215 | before_show_menu 216 | fi 217 | } 218 | 219 | status() { 220 | systemctl status bunserver --no-pager -l 221 | if [[ $# == 0 ]]; then 222 | before_show_menu 223 | fi 224 | } 225 | 226 | enable() { 227 | systemctl enable bunserver 228 | if [[ $? == 0 ]]; then 229 | echo -e "${green}bunserver 设置开机自启成功${plain}" 230 | else 231 | echo -e "${red}bunserver 设置开机自启失败${plain}" 232 | fi 233 | 234 | if [[ $# == 0 ]]; then 235 | before_show_menu 236 | fi 237 | } 238 | 239 | disable() { 240 | systemctl disable bunserver 241 | if [[ $? == 0 ]]; then 242 | echo -e "${green}bunserver 取消开机自启成功${plain}" 243 | else 244 | echo -e "${red}bunserver 取消开机自启失败${plain}" 245 | fi 246 | 247 | if [[ $# == 0 ]]; then 248 | before_show_menu 249 | fi 250 | } 251 | 252 | show_log() { 253 | journalctl -u bunserver.service -e --no-pager -f 254 | if [[ $# == 0 ]]; then 255 | before_show_menu 256 | fi 257 | } 258 | 259 | install_bbr() { 260 | bash <(curl -L -s https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh) 261 | #if [[ $? == 0 ]]; then 262 | # echo "" 263 | # echo -e "${green}安装 bbr 成功,请重启服务器${plain}" 264 | #else 265 | # echo "" 266 | # echo -e "${red}下载 bbr 安装脚本失败,请检查本机能否连接 Github${plain}" 267 | #fi 268 | 269 | #before_show_menu 270 | } 271 | 272 | update_shell() { 273 | wget -O /usr/bin/bunserver -N --no-check-certificate https://raw.githubusercontent.com/pennyMorant/bunpanel-release/dev/server/bunserver.sh 274 | if [[ $? != 0 ]]; then 275 | echo "" 276 | echo -e "${red}下载脚本失败,请检查本机能否连接 Github${plain}" 277 | before_show_menu 278 | else 279 | chmod +x /usr/bin/bunserver 280 | echo -e "${green}升级脚本成功,请重新运行脚本${plain}" && exit 0 281 | fi 282 | } 283 | 284 | # 0: running, 1: not running, 2: not installed 285 | check_status() { 286 | if [[ ! -f /etc/systemd/system/bunserver.service ]]; then 287 | return 2 288 | fi 289 | temp=$(systemctl status bunserver | grep Active | awk '{print $3}' | cut -d "(" -f2 | cut -d ")" -f1) 290 | if [[ x"${temp}" == x"running" ]]; then 291 | return 0 292 | else 293 | return 1 294 | fi 295 | } 296 | 297 | check_enabled() { 298 | temp=$(systemctl is-enabled bunserver) 299 | if [[ x"${temp}" == x"enabled" ]]; then 300 | return 0 301 | else 302 | return 1; 303 | fi 304 | } 305 | 306 | check_uninstall() { 307 | check_status 308 | if [[ $? != 2 ]]; then 309 | echo "" 310 | echo -e "${red}bunserver已安装,请不要重复安装${plain}" 311 | if [[ $# == 0 ]]; then 312 | before_show_menu 313 | fi 314 | return 1 315 | else 316 | return 0 317 | fi 318 | } 319 | 320 | check_install() { 321 | check_status 322 | if [[ $? == 2 ]]; then 323 | echo "" 324 | echo -e "${red}请先安装bunserver${plain}" 325 | if [[ $# == 0 ]]; then 326 | before_show_menu 327 | fi 328 | return 1 329 | else 330 | return 0 331 | fi 332 | } 333 | 334 | show_status() { 335 | check_status 336 | case $? in 337 | 0) 338 | echo -e "bunserver状态: ${green}已运行${plain}" 339 | show_enable_status 340 | ;; 341 | 1) 342 | echo -e "bunserver状态: ${yellow}未运行${plain}" 343 | show_enable_status 344 | ;; 345 | 2) 346 | echo -e "bunserver状态: ${red}未安装${plain}" 347 | esac 348 | } 349 | 350 | show_enable_status() { 351 | check_enabled 352 | if [[ $? == 0 ]]; then 353 | echo -e "是否开机自启: ${green}是${plain}" 354 | else 355 | echo -e "是否开机自启: ${red}否${plain}" 356 | fi 357 | } 358 | 359 | show_bunserver_version() { 360 | echo -n "bunserver 版本:" 361 | /usr/local/bunserver/bunserver -version 362 | echo "" 363 | if [[ $# == 0 ]]; then 364 | before_show_menu 365 | fi 366 | } 367 | 368 | show_usage() { 369 | echo "bunserver 管理脚本使用方法: " 370 | echo "------------------------------------------" 371 | echo "bunserver - 显示管理菜单 (功能更多)" 372 | echo "bunserver start - 启动 bunserver" 373 | echo "bunserver stop - 停止 bunserver" 374 | echo "bunserver restart - 重启 bunserver" 375 | echo "bunserver status - 查看 bunserver 状态" 376 | echo "bunserver enable - 设置 bunserver 开机自启" 377 | echo "bunserver disable - 取消 bunserver 开机自启" 378 | echo "bunserver log - 查看 bunserver 日志" 379 | echo "bunserver update - 更新 bunserver" 380 | echo "bunserver update x.x.x - 更新 bunserver 指定版本" 381 | echo "bunserver install - 安装 bunserver" 382 | echo "bunserver uninstall - 卸载 bunserver" 383 | echo "bunserver version - 查看 bunserver 版本" 384 | echo "------------------------------------------" 385 | } 386 | 387 | show_menu() { 388 | echo -e " 389 | ${green}bunserver 后端管理脚本,${plain}${red}不适用于docker${plain} 390 | --- https://github.com/zeropanel/bunserver --- 391 | ${green}0.${plain} 修改配置 392 | ———————————————— 393 | ${green}1.${plain} 安装 bunserver 394 | ${green}2.${plain} 更新 bunserver 395 | ${green}3.${plain} 卸载 bunserver 396 | ———————————————— 397 | ${green}4.${plain} 启动 bunserver 398 | ${green}5.${plain} 停止 bunserver 399 | ${green}6.${plain} 重启 bunserver 400 | ${green}7.${plain} 查看 bunserver 状态 401 | ${green}8.${plain} 查看 bunserver 日志 402 | ———————————————— 403 | ${green}9.${plain} 设置 bunserver 开机自启 404 | ${green}10.${plain} 取消 bunserver 开机自启 405 | ———————————————— 406 | ${green}11.${plain} 一键安装 bbr (最新内核) 407 | ${green}12.${plain} 查看 bunserver 版本 408 | ${green}13.${plain} 升级维护脚本 409 | " 410 | #后续更新可加入上方字符串中 411 | show_status 412 | echo && read -p "请输入选择 [0-13]: " num 413 | 414 | case "${num}" in 415 | 0) config 416 | ;; 417 | 1) check_uninstall && install 418 | ;; 419 | 2) check_install && update 420 | ;; 421 | 3) check_install && uninstall 422 | ;; 423 | 4) check_install && start 424 | ;; 425 | 5) check_install && stop 426 | ;; 427 | 6) check_install && restart 428 | ;; 429 | 7) check_install && status 430 | ;; 431 | 8) check_install && show_log 432 | ;; 433 | 9) check_install && enable 434 | ;; 435 | 10) check_install && disable 436 | ;; 437 | 11) install_bbr 438 | ;; 439 | 12) check_install && show_bunserver_version 440 | ;; 441 | 13) update_shell 442 | ;; 443 | *) echo -e "${red}请输入正确的数字 [0-12]${plain}" 444 | ;; 445 | esac 446 | } 447 | 448 | 449 | if [[ $# > 0 ]]; then 450 | case $1 in 451 | "start") check_install 0 && start 0 452 | ;; 453 | "stop") check_install 0 && stop 0 454 | ;; 455 | "restart") check_install 0 && restart 0 456 | ;; 457 | "status") check_install 0 && status 0 458 | ;; 459 | "enable") check_install 0 && enable 0 460 | ;; 461 | "disable") check_install 0 && disable 0 462 | ;; 463 | "log") check_install 0 && show_log 0 464 | ;; 465 | "update") check_install 0 && update 0 $2 466 | ;; 467 | "config") config $* 468 | ;; 469 | "install") check_uninstall 0 && install 0 470 | ;; 471 | "uninstall") check_install 0 && uninstall 0 472 | ;; 473 | "version") check_install 0 && show_bunserver_version 0 474 | ;; 475 | "update_shell") update_shell 476 | ;; 477 | *) show_usage 478 | esac 479 | else 480 | show_menu 481 | fi 482 | -------------------------------------------------------------------------------- /server/config/config.yml: -------------------------------------------------------------------------------- 1 | Log: 2 | Level: warning # Log level: none, error, warning, info, debug 3 | AccessPath: # /etc/XrayR/access.Log 4 | ErrorPath: # /etc/XrayR/error.log 5 | DnsConfigPath: # /etc/XrayR/dns.json # Path to dns config, check https://xtls.github.io/config/dns.html for help 6 | RouteConfigPath: # /etc/XrayR/route.json # Path to route config, check https://xtls.github.io/config/routing.html for help 7 | InboundConfigPath: # /etc/XrayR/custom_inbound.json # Path to custom inbound config, check https://xtls.github.io/config/inbound.html for help 8 | OutboundConfigPath: # /etc/XrayR/custom_outbound.json # Path to custom outbound config, check https://xtls.github.io/config/outbound.html for help 9 | ConnectionConfig: 10 | Handshake: 4 # Handshake time limit, Second 11 | ConnIdle: 30 # Connection idle time limit, Second 12 | UplinkOnly: 2 # Time limit when the connection downstream is closed, Second 13 | DownlinkOnly: 4 # Time limit when the connection is closed after the uplink is closed, Second 14 | BufferSize: 64 # The internal cache size of each connection, kB 15 | Nodes: 16 | - 17 | PanelType: "SSpanel" # Panel type: SSpanel, V2board, NewV2board, PMpanel, Proxypanel, V2RaySocks 18 | ApiConfig: 19 | ApiHost: "http://127.0.0.1:667" 20 | ApiKey: "123" 21 | NodeID: 41 22 | NodeType: V2ray # Node type: V2ray, Shadowsocks, Trojan, Shadowsocks-Plugin 23 | Timeout: 30 # Timeout for the api request 24 | EnableVless: false # Enable Vless for V2ray Type 25 | EnableXTLS: false # Enable XTLS for V2ray and Trojan 26 | SpeedLimit: 0 # Mbps, Local settings will replace remote settings, 0 means disable 27 | DeviceLimit: 0 # Local settings will replace remote settings, 0 means disable 28 | RuleListPath: # /etc/XrayR/rulelist Path to local rulelist file 29 | ControllerConfig: 30 | ListenIP: 0.0.0.0 # IP address you want to listen 31 | SendIP: 0.0.0.0 # IP address you want to send pacakage 32 | UpdatePeriodic: 60 # Time to update the nodeinfo, how many sec. 33 | EnableDNS: false # Use custom DNS config, Please ensure that you set the dns.json well 34 | DNSType: AsIs # AsIs, UseIP, UseIPv4, UseIPv6, DNS strategy 35 | EnableProxyProtocol: false # Only works for WebSocket and TCP 36 | AutoSpeedLimitConfig: 37 | Limit: 0 # Warned speed. Set to 0 to disable AutoSpeedLimit (mbps) 38 | WarnTimes: 0 # After (WarnTimes) consecutive warnings, the user will be limited. Set to 0 to punish overspeed user immediately. 39 | LimitSpeed: 0 # The speedlimit of a limited user (unit: mbps) 40 | LimitDuration: 0 # How many minutes will the limiting last (unit: minute) 41 | GlobalDeviceLimitConfig: 42 | Enable: false # Enable the global device limit of a user 43 | RedisAddr: 127.0.0.1:6379 # The redis server address 44 | RedisPassword: YOUR PASSWORD # Redis password 45 | RedisDB: 0 # Redis DB 46 | Timeout: 5 # Timeout for redis request 47 | Expiry: 60 # Expiry time (second) 48 | EnableFallback: false # Only support for Trojan and Vless 49 | FallBackConfigs: # Support multiple fallbacks 50 | - 51 | SNI: # TLS SNI(Server Name Indication), Empty for any 52 | Alpn: # Alpn, Empty for any 53 | Path: # HTTP PATH, Empty for any 54 | Dest: 80 # Required, Destination of fallback, check https://xtls.github.io/config/features/fallback.html for details. 55 | ProxyProtocolVer: 0 # Send PROXY protocol version, 0 for dsable 56 | CertConfig: 57 | CertMode: dns # Option about how to get certificate: none, file, http, tls, dns. Choose "none" will forcedly disable the tls config. 58 | CertDomain: "node1.test.com" # Domain to cert 59 | CertFile: /etc/XrayR/cert/node1.test.com.cert # Provided if the CertMode is file 60 | KeyFile: /etc/XrayR/cert/node1.test.com.key 61 | Provider: alidns # DNS cert provider, Get the full support list here: https://go-acme.github.io/lego/dns/ 62 | Email: test@me.com 63 | DNSEnv: # DNS ENV option used by DNS provider 64 | ALICLOUD_ACCESS_KEY: aaa 65 | ALICLOUD_SECRET_KEY: bbb 66 | # - 67 | # PanelType: "NewV2board" # Panel type: SSpanel, V2board, NewV2board, PMpanel, Proxypanel, V2RaySocks 68 | # ApiConfig: 69 | # ApiHost: "http://127.0.0.1:668" 70 | # ApiKey: "123" 71 | # NodeID: 4 72 | # NodeType: Shadowsocks # Node type: V2ray, Shadowsocks, Trojan 73 | # Timeout: 30 # Timeout for the api request 74 | # EnableVless: false # Enable Vless for V2ray Type 75 | # EnableXTLS: false # Enable XTLS for V2ray and Trojan 76 | # SpeedLimit: 0 # Mbps, Local settings will replace remote settings 77 | # DeviceLimit: 0 # Local settings will replace remote settings 78 | # ControllerConfig: 79 | # ListenIP: 0.0.0.0 # IP address you want to listen 80 | # UpdatePeriodic: 10 # Time to update the nodeinfo, how many sec. 81 | # EnableDNS: false # Use custom DNS config, Please ensure that you set the dns.json well 82 | # CertConfig: 83 | # CertMode: dns # Option about how to get certificate: none, file, http, dns 84 | # CertDomain: "node1.test.com" # Domain to cert 85 | # CertFile: /etc/XrayR/cert/node1.test.com.cert # Provided if the CertMode is file 86 | # KeyFile: /etc/XrayR/cert/node1.test.com.pem 87 | # Provider: alidns # DNS cert provider, Get the full support list here: https://go-acme.github.io/lego/dns/ 88 | # Email: test@me.com 89 | # DNSEnv: # DNS ENV option used by DNS provider 90 | # ALICLOUD_ACCESS_KEY: aaa 91 | # ALICLOUD_SECRET_KEY: bbb 92 | -------------------------------------------------------------------------------- /server/config/custom_inbound.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "listen": "0.0.0.0", 4 | "port": 1234, 5 | "protocol": "socks", 6 | "settings": { 7 | "auth": "noauth", 8 | "accounts": [ 9 | { 10 | "user": "my-username", 11 | "pass": "my-password" 12 | } 13 | ], 14 | "udp": false, 15 | "ip": "127.0.0.1", 16 | "userLevel": 0 17 | } 18 | } 19 | ] -------------------------------------------------------------------------------- /server/config/custom_outbound.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "tag": "IPv4_out", 4 | "protocol": "freedom", 5 | "settings": {} 6 | }, 7 | { 8 | "tag": "IPv6_out", 9 | "protocol": "freedom", 10 | "settings": { 11 | "domainStrategy": "UseIPv6" 12 | } 13 | }, 14 | { 15 | "tag": "socks5-warp", 16 | "protocol": "socks", 17 | "settings": { 18 | "servers": [{ 19 | "address": "127.0.0.1", 20 | "port": 1080 21 | }] 22 | } 23 | }, 24 | { 25 | "protocol": "blackhole", 26 | "tag": "block" 27 | } 28 | ] -------------------------------------------------------------------------------- /server/config/dns.json: -------------------------------------------------------------------------------- 1 | { 2 | "servers": [ 3 | "1.1.1.1", 4 | "8.8.8.8", 5 | "localhost" 6 | ], 7 | "tag": "dns_inbound" 8 | } 9 | -------------------------------------------------------------------------------- /server/config/geoip.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pennyMorant/bunpanel-release/5f978087899ce0598391713dd9bff412c8be2aa7/server/config/geoip.dat -------------------------------------------------------------------------------- /server/config/geosite.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pennyMorant/bunpanel-release/5f978087899ce0598391713dd9bff412c8be2aa7/server/config/geosite.dat -------------------------------------------------------------------------------- /server/config/route.json: -------------------------------------------------------------------------------- 1 | { 2 | "domainStrategy": "IPOnDemand", 3 | "rules": [ 4 | { 5 | "type": "field", 6 | "outboundTag": "block", 7 | "ip": [ 8 | "geoip:private" 9 | ] 10 | }, 11 | { 12 | "type": "field", 13 | "outboundTag": "block", 14 | "protocol": [ 15 | "bittorrent" 16 | ] 17 | }, 18 | { 19 | "type": "field", 20 | "outboundTag": "socks5-warp", 21 | "domain": [] 22 | }, 23 | { 24 | "type": "field", 25 | "outboundTag": "IPv6_out", 26 | "domain": [ 27 | "geosite:netflix" 28 | ] 29 | }, 30 | { 31 | "type": "field", 32 | "outboundTag": "IPv4_out", 33 | "network": "udp,tcp" 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /server/config/rulelist: -------------------------------------------------------------------------------- 1 | (.+\.|^)(360|so)\.(cn|com) 2 | baidu.com 3 | google.com -------------------------------------------------------------------------------- /server/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | xrayr: 4 | image: ghcr.io/xrayr-project/xrayr:latest 5 | volumes: 6 | - ./config:/etc/XrayR/ # 映射配置文件夹 7 | restart: always 8 | network_mode: host 9 | -------------------------------------------------------------------------------- /server/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | red='\033[0;31m' 4 | green='\033[0;32m' 5 | yellow='\033[0;33m' 6 | plain='\033[0m' 7 | 8 | cur_dir=$(pwd) 9 | 10 | # check root 11 | [[ $EUID -ne 0 ]] && echo -e "${red}错误:${plain} 必须使用root用户运行此脚本!\n" && exit 1 12 | 13 | # check os 14 | if [[ -f /etc/redhat-release ]]; then 15 | release="centos" 16 | elif cat /etc/issue | grep -Eqi "debian"; then 17 | release="debian" 18 | elif cat /etc/issue | grep -Eqi "ubuntu"; then 19 | release="ubuntu" 20 | elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then 21 | release="centos" 22 | elif cat /proc/version | grep -Eqi "debian"; then 23 | release="debian" 24 | elif cat /proc/version | grep -Eqi "ubuntu"; then 25 | release="ubuntu" 26 | elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then 27 | release="centos" 28 | else 29 | echo -e "${red}未检测到系统版本,请联系脚本作者!${plain}\n" && exit 1 30 | fi 31 | 32 | arch=$(arch) 33 | 34 | if [[ $arch == "x86_64" || $arch == "x64" || $arch == "amd64" ]]; then 35 | arch="64" 36 | elif [[ $arch == "aarch64" || $arch == "arm64" ]]; then 37 | arch="arm64" 38 | else 39 | arch="64" 40 | echo -e "${red}检测架构失败,使用默认架构: ${arch}${plain}" 41 | fi 42 | 43 | echo "架构: ${arch}" 44 | 45 | if [ "$(getconf WORD_BIT)" != '32' ] && [ "$(getconf LONG_BIT)" != '64' ] ; then 46 | echo "本软件不支持 32 位系统(x86),请使用 64 位系统(x86_64),如果检测有误,请联系作者" 47 | exit 2 48 | fi 49 | 50 | os_version="" 51 | 52 | # os version 53 | if [[ -f /etc/os-release ]]; then 54 | os_version=$(awk -F'[= ."]' '/VERSION_ID/{print $3}' /etc/os-release) 55 | fi 56 | if [[ -z "$os_version" && -f /etc/lsb-release ]]; then 57 | os_version=$(awk -F'[= ."]+' '/DISTRIB_RELEASE/{print $2}' /etc/lsb-release) 58 | fi 59 | 60 | if [[ x"${release}" == x"centos" ]]; then 61 | if [[ ${os_version} -le 6 ]]; then 62 | echo -e "${red}请使用 CentOS 7 或更高版本的系统!${plain}\n" && exit 1 63 | fi 64 | elif [[ x"${release}" == x"ubuntu" ]]; then 65 | if [[ ${os_version} -lt 16 ]]; then 66 | echo -e "${red}请使用 Ubuntu 16 或更高版本的系统!${plain}\n" && exit 1 67 | fi 68 | elif [[ x"${release}" == x"debian" ]]; then 69 | if [[ ${os_version} -lt 8 ]]; then 70 | echo -e "${red}请使用 Debian 8 或更高版本的系统!${plain}\n" && exit 1 71 | fi 72 | fi 73 | 74 | install_base() { 75 | if [[ x"${release}" == x"centos" ]]; then 76 | yum install epel-release -y 77 | yum install wget curl unzip tar crontabs socat -y 78 | else 79 | apt update -y 80 | apt install wget curl unzip tar cron socat -y 81 | fi 82 | } 83 | 84 | # 0: running, 1: not running, 2: not installed 85 | check_status() { 86 | if [[ ! -f /etc/systemd/system/bunserver.service ]]; then 87 | return 2 88 | fi 89 | temp=$(systemctl status bunserver | grep Active | awk '{print $3}' | cut -d "(" -f2 | cut -d ")" -f1) 90 | if [[ x"${temp}" == x"running" ]]; then 91 | return 0 92 | else 93 | return 1 94 | fi 95 | } 96 | 97 | install_acme() { 98 | curl https://get.acme.sh | sh 99 | } 100 | 101 | install_bunserver() { 102 | if [[ -e /usr/local/bunserver/ ]]; then 103 | rm /usr/local/bunserver/ -rf 104 | fi 105 | 106 | mkdir /usr/local/bunserver/ -p 107 | cd /usr/local/bunserver/ 108 | 109 | if [ $# == 0 ] ;then 110 | last_version=$(curl -Ls "https://api.github.com/repos/pennyMorant/bunpanel-release/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') 111 | if [[ ! -n "$last_version" ]]; then 112 | echo -e "${red}检测 bunserver 版本失败,可能是超出 Github API 限制,请稍后再试,或手动指定 bunserver 版本安装${plain}" 113 | exit 1 114 | fi 115 | echo -e "检测到 bunserver 最新版本:${last_version},开始安装" 116 | wget -q -N --no-check-certificate -O /usr/local/bunserver/bunserver-linux.zip https://github.com/pennyMorant/bunpanel-release/releases/download/${last_version}/bunserver-linux-${arch}.zip 117 | if [[ $? -ne 0 ]]; then 118 | echo -e "${red}下载 bunserver 失败,请确保你的服务器能够下载 Github 的文件${plain}" 119 | exit 1 120 | fi 121 | else 122 | if [[ $1 == v* ]]; then 123 | last_version=$1 124 | else 125 | last_version="v"$1 126 | fi 127 | url="https://github.com/pennyMorant/bunpanel-release/releases/download/${last_version}/bunserver-linux-${arch}.zip" 128 | echo -e "开始安装 bunserver ${last_version}" 129 | wget -q -N --no-check-certificate -O /usr/local/bunserver/bunserver-linux.zip ${url} 130 | if [[ $? -ne 0 ]]; then 131 | echo -e "${red}下载 bunserver ${last_version} 失败,请确保此版本存在${plain}" 132 | exit 1 133 | fi 134 | fi 135 | 136 | unzip bunserver-linux.zip 137 | rm bunserver-linux.zip -f 138 | chmod +x bunserver 139 | mkdir /etc/bunserver/ -p 140 | rm /etc/systemd/system/bunserver.service -f 141 | file="https://github.com/pennyMorant/bunpanel-release/raw/dev/server/bunserver.service" 142 | wget -q -N --no-check-certificate -O /etc/systemd/system/bunserver.service ${file} 143 | #cp -f bunserver.service /etc/systemd/system/ 144 | systemctl daemon-reload 145 | systemctl stop bunserver 146 | systemctl enable bunserver 147 | echo -e "${green}bunserver ${last_version}${plain} 安装完成,已设置开机自启" 148 | cp geoip.dat /etc/bunserver/ 149 | cp geosite.dat /etc/bunserver/ 150 | 151 | if [[ ! -f /etc/bunserver/config.yml ]]; then 152 | cp config.yml /etc/bunserver/ 153 | echo -e "" 154 | echo -e "全新安装,请先参看教程:https://github.com/pennyMorant/bunpanel-release,配置必要的内容" 155 | else 156 | systemctl start bunserver 157 | sleep 2 158 | check_status 159 | echo -e "" 160 | if [[ $? == 0 ]]; then 161 | echo -e "${green}bunserver 重启成功${plain}" 162 | else 163 | echo -e "${red}bunserver 可能启动失败,请稍后使用 bunserver log 查看日志信息,若无法启动,则可能更改了配置格式,请前往 wiki 查看:https://github.com/pennyMorant/bunpanel-release/wiki${plain}" 164 | fi 165 | fi 166 | 167 | if [[ ! -f /etc/bunserver/dns.json ]]; then 168 | cp dns.json /etc/bunserver/ 169 | fi 170 | if [[ ! -f /etc/bunserver/route.json ]]; then 171 | cp route.json /etc/bunserver/ 172 | fi 173 | if [[ ! -f /etc/bunserver/custom_outbound.json ]]; then 174 | cp custom_outbound.json /etc/bunserver/ 175 | fi 176 | if [[ ! -f /etc/bunserver/custom_inbound.json ]]; then 177 | cp custom_inbound.json /etc/bunserver/ 178 | fi 179 | if [[ ! -f /etc/bunserver/rulelist ]]; then 180 | cp rulelist /etc/bunserver/ 181 | fi 182 | curl -o /usr/bin/bunserver -Ls https://raw.githubusercontent.com/pennyMorant/bunpanel-release/master/server/bunserver.sh 183 | chmod +x /usr/bin/bunserver 184 | cd $cur_dir 185 | rm -f install.sh 186 | echo -e "" 187 | echo "bunserver 管理脚本使用方法 (兼容使用bunserver执行,大小写不敏感): " 188 | echo "------------------------------------------" 189 | echo "bunserver - 显示管理菜单 (功能更多)" 190 | echo "bunserver start - 启动 bunserver" 191 | echo "bunserver stop - 停止 bunserver" 192 | echo "bunserver restart - 重启 bunserver" 193 | echo "bunserver status - 查看 bunserver 状态" 194 | echo "bunserver enable - 设置 bunserver 开机自启" 195 | echo "bunserver disable - 取消 bunserver 开机自启" 196 | echo "bunserver log - 查看 bunserver 日志" 197 | echo "bunserver update - 更新 bunserver" 198 | echo "bunserver update x.x.x - 更新 bunserver 指定版本" 199 | echo "bunserver config - 显示配置文件内容" 200 | echo "bunserver install - 安装 bunserver" 201 | echo "bunserver uninstall - 卸载 bunserver" 202 | echo "bunserver version - 查看 bunserver 版本" 203 | echo "------------------------------------------" 204 | } 205 | 206 | echo -e "${green}开始安装${plain}" 207 | install_base 208 | # install_acme 209 | install_bunserver $1 210 | --------------------------------------------------------------------------------