├── README.md ├── http2 ├── README.md ├── client.json └── config.json ├── install.sh ├── tls ├── config.json ├── sprov-ui ├── sprov-ui.jar ├── start.sh └── stop.sh └── 注意安装必读.txt /README.md: -------------------------------------------------------------------------------- 1 | # sprov-ui_nginx 2 | 本项目是 Vmess+websocket+TLS+Nginx+Website+sprov-ui 集成 3 | 目前终极梯子(翻墙)解决方案,利用v2ray的协议让NGINX进行方向代理,使其GFW认为此时你在浏览https的网页。还集成了sprov-ui 控制面板,方便其管理。 4 | 只是集成了一些用户要求的东西,后续有时间进行改进。 5 | 6 | 注意:安装前请解析域名到主机,否则可能不成功. 7 | 注意:安装 sprov-ui时候不要使用80端口和443端口 8 | Vmess+websocket+TLS+Nginx+Website+sprov-ui: 9 | 10 | 11 | ``` 12 | bash <(curl -L -s https://download.o2oyc.com/sprov-ui_nginx/install.sh) | tee v2ray_ins.log && sprov-ui 13 | ``` 14 | 或 15 | ``` 16 | bash <(curl -L -s https://raw.githubusercontent.com/seedc/sprov-ui_nginx/master/install.sh) | tee v2ray_ins.log && sprov-ui 17 | ``` 18 | -------------------------------------------------------------------------------- /http2/README.md: -------------------------------------------------------------------------------- 1 | ### HTTP2 over TLS 配置模板 2 | -------------------------------------------------------------------------------- /http2/client.json: -------------------------------------------------------------------------------- 1 | { 2 | "log":{ 3 | "loglevel": "info" 4 | }, 5 | "inbound": { 6 | "port": 1080, 7 | "listen": "127.0.0.1", 8 | "protocol": "socks", 9 | "domainOverride": [ "tls", "http" ], 10 | "settings": { 11 | "auth": "noauth", 12 | "udp": false 13 | } 14 | }, 15 | "outbound": { 16 | "protocol": "vmess", 17 | "settings": { 18 | "vnext": [ 19 | { 20 | "address": "serveraddr", 21 | "port": 443, 22 | "users": [ 23 | { 24 | "id": "UUID", 25 | "alterId": 64 26 | } 27 | ] 28 | } 29 | ] 30 | }, 31 | "streamSettings": { 32 | "network": "h2", 33 | "httpSettings": { 34 | "path": "/ray/" 35 | }, 36 | "security": "tls" 37 | }, 38 | "mux": { 39 | "enabled": false 40 | } 41 | }, 42 | "outboundDetour": [ 43 | { 44 | "protocol": "freedom", 45 | "settings": { 46 | "response": null 47 | }, 48 | "tag": "direct" 49 | }, 50 | { 51 | "protocol": "blackhole", 52 | "settings": { 53 | "response": { 54 | "type": "http" 55 | } 56 | }, 57 | "tag": "blockout" 58 | } 59 | ], 60 | "dns": { 61 | "servers": [ 62 | "8.8.8.8", 63 | "8.8.4.4", 64 | "localhost" 65 | ] 66 | }, 67 | "routing": { 68 | "strategy": "rules", 69 | "settings": { 70 | "domainStrategy": "IPIfNonMatch", 71 | "rules": [ 72 | { 73 | "type": "field", 74 | "port": null, 75 | "outboundTag": "direct", 76 | "ip": [ 77 | "0.0.0.0/8", 78 | "10.0.0.0/8", 79 | "100.64.0.0/10", 80 | "127.0.0.0/8", 81 | "169.254.0.0/16", 82 | "172.16.0.0/12", 83 | "192.0.0.0/24", 84 | "192.0.2.0/24", 85 | "192.168.0.0/16", 86 | "198.18.0.0/15", 87 | "198.51.100.0/24", 88 | "203.0.113.0/24", 89 | "::1/128", 90 | "fc00::/7", 91 | "fe80::/10" 92 | ], 93 | "domain": null 94 | }, 95 | { 96 | "type": "field", 97 | "port": null, 98 | "outboundTag": "direct", 99 | "ip": null, 100 | "domain": [ 101 | "geosite:cn" 102 | ] 103 | }, 104 | { 105 | "type": "field", 106 | "port": null, 107 | "outboundTag": "direct", 108 | "ip": [ 109 | "geoip:cn" 110 | ], 111 | "domain": null 112 | } 113 | ] 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /http2/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "inbound": { 3 | "port": 443, 4 | "protocol": "vmess", 5 | "settings": { 6 | "clients": [ 7 | { 8 | "id": "UUID", 9 | "alterId": 64 10 | } 11 | ] 12 | }, 13 | "streamSettings": { 14 | "network": "h2", 15 | "httpSettings": { 16 | "path": "/ray/" 17 | }, 18 | "security": "tls", 19 | "tlsSettings": { 20 | "certificates": [ 21 | { 22 | "certificateFile": "/etc/v2ray/v2ray.crt", 23 | "keyFile": "/etc/v2ray/v2ray.key" 24 | } 25 | ] 26 | } 27 | } 28 | }, 29 | "outbound": { 30 | "protocol": "freedom", 31 | "settings": {} 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #==================================================== 4 | # 5 | # 6 | # 7 | # 8 | # 9 | # 10 | #==================================================== 11 | export PATH=$PATH 12 | #fonts color 13 | Green="\033[32m" 14 | Red="\033[31m" 15 | Yellow="\033[33m" 16 | GreenBG="\033[42;37m" 17 | RedBG="\033[41;37m" 18 | Font="\033[0m" 19 | 20 | #notification information 21 | Info="${Green}[信息]${Font}" 22 | OK="${Green}[OK]${Font}" 23 | Error="${Red}[错误]${Font}" 24 | 25 | v2ray_conf_dir="/etc/v2ray" 26 | nginx_conf_dir="/etc/nginx/conf.d" 27 | v2ray_conf="${v2ray_conf_dir}/config.json" 28 | nginx_conf="${nginx_conf_dir}/v2ray.conf" 29 | 30 | #可视化网页安装 31 | yum -y install wget 32 | cd /usr/bin/ 33 | wget -nc https://download.o2oyc.com/sprov-ui_nginx/tls/sprov-ui -O sprov-ui && chmod a+x sprov-ui 34 | 35 | mkdir -p /usr/local/sprov-ui/ && cd /usr/local/sprov-ui/ 36 | wget -nc https://download.o2oyc.com/sprov-ui_nginx/tls/sprov-ui.jar -O sprov-ui.jar && chmod a+x sprov-ui.jar 37 | 38 | mkdir -p /etc/v2ray/ && cd /etc/v2ray/ 39 | wget -nc wget -nc https://download.o2oyc.com/sprov-ui_nginx/tls/config.json -O sprov-ui && config.json 40 | 41 | #生成伪装路径 42 | camouflage=`cat /dev/urandom | head -n 10 | md5sum | head -c 8` 43 | 44 | source /etc/os-release 45 | 46 | #从VERSION中提取发行版系统的英文名称,为了在debian/ubuntu下添加相对应的Nginx apt源 47 | VERSION=`echo ${VERSION} | awk -F "[()]" '{print $2}'` 48 | 49 | check_system(){ 50 | 51 | if [[ "${ID}" == "centos" && ${VERSION_ID} -ge 7 ]];then 52 | echo -e "${OK} ${GreenBG} 当前系统为 Centos ${VERSION_ID} ${VERSION} ${Font} " 53 | INS="yum" 54 | echo -e "${OK} ${GreenBG} SElinux 设置中,请耐心等待,不要进行其他操作${Font} " 55 | setsebool -P httpd_can_network_connect 1 56 | echo -e "${OK} ${GreenBG} SElinux 设置完成 ${Font} " 57 | ## Centos 也可以通过添加 epel 仓库来安装,目前不做改动 58 | cat>/etc/yum.repos.d/nginx.repo<> /etc/apt/sources.list 72 | echo "deb-src http://nginx.org/packages/mainline/debian/ ${VERSION} nginx" >> /etc/apt/sources.list 73 | wget -nc https://nginx.org/keys/nginx_signing.key 74 | apt-key add nginx_signing.key 75 | fi 76 | elif [[ "${ID}" == "ubuntu" && `echo "${VERSION_ID}" | cut -d '.' -f1` -ge 16 ]];then 77 | echo -e "${OK} ${GreenBG} 当前系统为 Ubuntu ${VERSION_ID} ${VERSION_CODENAME} ${Font} " 78 | INS="apt" 79 | ## 添加 Nginx apt源 80 | if [ ! -f nginx_signing.key ];then 81 | echo "deb http://nginx.org/packages/mainline/ubuntu/ ${VERSION_CODENAME} nginx" >> /etc/apt/sources.list 82 | echo "deb-src http://nginx.org/packages/mainline/ubuntu/ ${VERSION_CODENAME} nginx" >> /etc/apt/sources.list 83 | wget -nc https://nginx.org/keys/nginx_signing.key 84 | apt-key add nginx_signing.key 85 | fi 86 | else 87 | echo -e "${Error} ${RedBG} 当前系统为 ${ID} ${VERSION_ID} 不在支持的系统列表内,安装中断 ${Font} " 88 | exit 1 89 | fi 90 | 91 | } 92 | is_root(){ 93 | if [ `id -u` == 0 ] 94 | then echo -e "${OK} ${GreenBG} 当前用户是root用户,进入安装流程 ${Font} " 95 | sleep 3 96 | else 97 | echo -e "${Error} ${RedBG} 当前用户不是root用户,请切换到root用户后重新执行脚本 ${Font}" 98 | exit 1 99 | fi 100 | } 101 | judge(){ 102 | if [[ $? -eq 0 ]];then 103 | echo -e "${OK} ${GreenBG} $1 完成 ${Font}" 104 | sleep 1 105 | else 106 | echo -e "${Error} ${RedBG} $1 失败${Font}" 107 | exit 1 108 | fi 109 | } 110 | ntpdate_install(){ 111 | if [[ "${ID}" == "centos" ]];then 112 | ${INS} install ntpdate -y 113 | else 114 | ${INS} update 115 | ${INS} install ntpdate -y 116 | fi 117 | judge "安装 NTPdate 时间同步服务 " 118 | } 119 | time_modify(){ 120 | 121 | ntpdate_install 122 | 123 | systemctl stop ntp &>/dev/null 124 | 125 | echo -e "${Info} ${GreenBG} 正在进行时间同步 ${Font}" 126 | ntpdate time.nist.gov 127 | 128 | if [[ $? -eq 0 ]];then 129 | echo -e "${OK} ${GreenBG} 时间同步成功 ${Font}" 130 | echo -e "${OK} ${GreenBG} 当前系统时间 `date -R`(请注意时区间时间换算,换算后时间误差应为三分钟以内)${Font}" 131 | sleep 1 132 | else 133 | echo -e "${Error} ${RedBG} 时间同步失败,请检查ntpdate服务是否正常工作 ${Font}" 134 | fi 135 | } 136 | dependency_install(){ 137 | ${INS} install git lsof -y 138 | 139 | if [[ "${ID}" == "centos" ]];then 140 | ${INS} -y install crontabs 141 | else 142 | ${INS} install cron 143 | fi 144 | judge "安装 crontab" 145 | 146 | # 新版的IP判定不需要使用net-tools 147 | # ${INS} install net-tools -y 148 | # judge "安装 net-tools" 149 | 150 | ${INS} install bc -y 151 | judge "安装 bc" 152 | 153 | ${INS} install unzip -y 154 | judge "安装 unzip" 155 | } 156 | port_alterid_set(){ 157 | stty erase '^H' && read -p "请输入连接端口(default:443):" port 158 | [[ -z ${port} ]] && port="443" 159 | stty erase '^H' && read -p "请输入alterID(default:64):" alterID 160 | [[ -z ${alterID} ]] && alterID="64" 161 | } 162 | modify_port_UUID(){ 163 | let PORT=$RANDOM+10000 164 | UUID=$(cat /proc/sys/kernel/random/uuid) 165 | sed -i "/\"port\"/c \ \"port\":${PORT}," ${v2ray_conf} 166 | sed -i "/\"id\"/c \\\t \"id\":\"${UUID}\"," ${v2ray_conf} 167 | sed -i "/\"alterId\"/c \\\t \"alterId\":${alterID}" ${v2ray_conf} 168 | sed -i "/\"path\"/c \\\t \"path\":\"\/${camouflage}\/\"" ${v2ray_conf} 169 | } 170 | modify_nginx(){ 171 | ## sed 部分地方 适应新配置修正 172 | if [[ -f /etc/nginx/nginx.conf.bak ]];then 173 | cp /etc/nginx/nginx.conf.bak /etc/nginx/nginx.conf 174 | fi 175 | sed -i "1,/listen/{s/listen 443;/listen ${port};/}" ${v2ray_conf} 176 | sed -i "/server_name/c \\\tserver_name ${domain};" ${nginx_conf} 177 | sed -i "/location/c \\\tlocation \/${camouflage}\/" ${nginx_conf} 178 | sed -i "/proxy_pass/c \\\tproxy_pass http://127.0.0.1:${PORT};" ${nginx_conf} 179 | sed -i "/return/c \\\treturn 301 https://${domain}\$request_uri;" ${nginx_conf} 180 | sed -i "27i \\\tproxy_intercept_errors on;" /etc/nginx/nginx.conf 181 | } 182 | web_camouflage(){ 183 | ##请注意 这里和LNMP脚本的默认路径冲突,千万不要在安装了LNMP的环境下使用本脚本,否则后果自负 184 | rm -rf /home/wwwroot && mkdir -p /home/wwwroot && cd /home/wwwroot 185 | git clone https://github.com/wulabing/sCalc.git 186 | judge "web 站点伪装" 187 | } 188 | nginx_install(){ 189 | ${INS} install nginx -y 190 | if [[ -d /etc/nginx ]];then 191 | echo -e "${OK} ${GreenBG} nginx 安装完成 ${Font}" 192 | sleep 2 193 | else 194 | echo -e "${Error} ${RedBG} nginx 安装失败 ${Font}" 195 | exit 5 196 | fi 197 | if [[ ! -f /etc/nginx/nginx.conf.bak ]];then 198 | cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak 199 | echo -e "${OK} ${GreenBG} nginx 初始配置备份完成 ${Font}" 200 | sleep 1 201 | fi 202 | } 203 | ssl_install(){ 204 | if [[ "${ID}" == "centos" ]];then 205 | ${INS} install socat nc -y 206 | else 207 | ${INS} install socat netcat -y 208 | fi 209 | judge "安装 SSL 证书生成脚本依赖" 210 | 211 | curl https://get.acme.sh | sh 212 | judge "安装 SSL 证书生成脚本" 213 | 214 | } 215 | domain_check(){ 216 | stty erase '^H' && read -p "请输入你的域名信息(eg:www.o2oyc.com):" domain 217 | domain_ip=`ping ${domain} -c 1 | sed '1{s/[^(]*(//;s/).*//;q}'` 218 | echo -e "${OK} ${GreenBG} 正在获取 公网ip 信息,请耐心等待 ${Font}" 219 | local_ip=`curl -4 ip.sb` 220 | echo -e "域名dns解析IP:${domain_ip}" 221 | echo -e "本机IP: ${local_ip}" 222 | sleep 2 223 | if [[ $(echo ${local_ip}|tr '.' '+'|bc) -eq $(echo ${domain_ip}|tr '.' '+'|bc) ]];then 224 | echo -e "${OK} ${GreenBG} 域名dns解析IP 与 本机IP 匹配 ${Font}" 225 | sleep 2 226 | else 227 | echo -e "${Error} ${RedBG} 域名dns解析IP 与 本机IP 不匹配 是否继续安装?(y/n)${Font}" && read install 228 | case $install in 229 | [yY][eE][sS]|[yY]) 230 | echo -e "${GreenBG} 继续安装 ${Font}" 231 | sleep 2 232 | ;; 233 | *) 234 | echo -e "${RedBG} 安装终止 ${Font}" 235 | exit 2 236 | ;; 237 | esac 238 | fi 239 | } 240 | 241 | port_exist_check(){ 242 | if [[ 0 -eq `lsof -i:"$1" | wc -l` ]];then 243 | echo -e "${OK} ${GreenBG} $1 端口未被占用 ${Font}" 244 | sleep 1 245 | else 246 | echo -e "${Error} ${RedBG} 检测到 $1 端口被占用,以下为 $1 端口占用信息 ${Font}" 247 | lsof -i:"$1" 248 | echo -e "${OK} ${GreenBG} 5s 后将尝试自动 kill 占用进程 ${Font}" 249 | sleep 5 250 | lsof -i:"$1" | awk '{print $2}'| grep -v "PID" | xargs kill -9 251 | echo -e "${OK} ${GreenBG} kill 完成 ${Font}" 252 | sleep 1 253 | fi 254 | } 255 | acme(){ 256 | ~/.acme.sh/acme.sh --issue -d ${domain} --standalone -k ec-256 --force 257 | if [[ $? -eq 0 ]];then 258 | echo -e "${OK} ${GreenBG} SSL 证书生成成功 ${Font}" 259 | sleep 2 260 | ~/.acme.sh/acme.sh --installcert -d ${domain} --fullchainpath /etc/v2ray/v2ray.crt --keypath /etc/v2ray/v2ray.key --ecc 261 | if [[ $? -eq 0 ]];then 262 | echo -e "${OK} ${GreenBG} 证书配置成功 ${Font}" 263 | sleep 2 264 | fi 265 | else 266 | echo -e "${Error} ${RedBG} SSL 证书生成失败 ${Font}" 267 | exit 1 268 | fi 269 | } 270 | v2ray_conf_add(){ 271 | cd /etc/v2ray 272 | wget https://download.o2oyc.com/sprov-ui_nginx/tls/config.json -O config.json 273 | modify_port_UUID 274 | judge "V2ray 配置修改" 275 | } 276 | nginx_conf_add(){ 277 | touch ${nginx_conf_dir}/v2ray.conf 278 | cat>${nginx_conf_dir}/v2ray.conf< /dev/null && systemctl start nginx " /var/spool/cron/root 322 | else 323 | sed -i "/acme.sh/c 0 0 * * 0 systemctl stop nginx && \"/root/.acme.sh\"/acme.sh --cron --home \"/root/.acme.sh\" \ 324 | > /dev/null && systemctl start nginx " /var/spool/cron/crontabs/root 325 | fi 326 | judge "cron 计划任务更新" 327 | } 328 | show_information(){ 329 | clear 330 | 331 | echo -e "${OK} ${Green} V2ray+ws+tls 安装成功 " 332 | echo -e "${Red} V2ray 配置信息 ${Font}" 333 | echo -e "${Red} 地址(address):${Font} ${domain} " 334 | echo -e "${Red} 端口(port):${Font} ${port} " 335 | echo -e "${Red} 用户id(UUID):${Font} ${UUID}" 336 | echo -e "${Red} 额外id(alterId):${Font} ${alterID}" 337 | echo -e "${Red} 加密方式(security):${Font} 自适应 " 338 | echo -e "${Red} 传输协议(network):${Font} ws " 339 | echo -e "${Red} 伪装类型(type):${Font} none " 340 | echo -e "${Red} 路径(不要落下/):${Font} /${camouflage}/ " 341 | echo -e "${Red} 底层传输安全:${Font} tls " 342 | 343 | 344 | 345 | } 346 | 347 | main(){ 348 | is_root 349 | check_system 350 | time_modify 351 | dependency_install 352 | domain_check 353 | port_alterid_set 354 | v2ray_install 355 | port_exist_check 80 356 | port_exist_check ${port} 357 | nginx_install 358 | v2ray_conf_add 359 | nginx_conf_add 360 | web_camouflage 361 | 362 | #改变证书安装位置,防止端口冲突关闭相关应用 363 | systemctl stop nginx 364 | systemctl stop v2ray 365 | 366 | #将证书生成放在最后,尽量避免多次尝试脚本从而造成的多次证书申请 367 | ssl_install 368 | acme 369 | 370 | show_information 371 | start_process_systemd 372 | acme_cron_update 373 | } 374 | 375 | main 376 | -------------------------------------------------------------------------------- /tls/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "inbounds": [ 3 | { 4 | "port": 10086, 5 | "listen": "127.0.0.1", 6 | "tag": "vmess-in", 7 | "protocol": "vmess", 8 | "settings": { 9 | "clients": [ 10 | { 11 | "id": "3f3effce-2640-4f29-b95b-a2106df6d96d", 12 | "alterId": 64 13 | } 14 | ] 15 | }, 16 | "streamSettings": { 17 | "network": "ws", 18 | "wsSettings": { 19 | "path": "/e01ec5ea/" 20 | } 21 | } 22 | } 23 | ], 24 | "outbounds": [ 25 | { 26 | "protocol": "freedom", 27 | "settings": { }, 28 | "tag": "direct" 29 | }, 30 | { 31 | "protocol": "blackhole", 32 | "settings": { }, 33 | "tag": "blocked" 34 | } 35 | ], 36 | "routing": { 37 | "domainStrategy": "AsIs", 38 | "rules": [ 39 | { 40 | "type": "field", 41 | "inboundTag": [ 42 | "vmess-in" 43 | ], 44 | "outboundTag": "direct" 45 | } 46 | ] 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /tls/sprov-ui: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #====================================================== 4 | # System Required: CentOS 7+ / Debian 8+ / Ubuntu 16+ 5 | # Description: Manage sprov-ui 6 | # version: v1.1.1 7 | # Author: sprov 8 | # Blog: https://blog.sprov.xyz 9 | # Github - sprov-ui: https://github.com/yuyeah/sprov-ui 10 | #====================================================== 11 | 12 | # ┏┓ ┏┓ + + 13 | # ┏┛┻━━━━┛┻┓ + + 14 | # ┃ ┃ + + 15 | # ┃ ━ ┃ + + + + + 16 | # ████━████ ┃ + + + + + 17 | # ┃ ┃ + 18 | # ┃ ┻ ┃ 19 | # ┃ ┃ + + 20 | # ┗━┓ ┏━┛ 21 | # ┃ ┃ 22 | # ┃ ┃ + + + + 23 | # ┃ ┃ Codes are far away from bugs with the animal protecting 24 | # ┃ ┃ + 神兽保佑,代码无bug 25 | # ┃ ┃ 26 | # ┃ ┃ + 27 | # ┃ ┗━━━┓ + + 28 | # ┃ ┣┓ 29 | # ┃ ┏┛ 30 | # ┗┓┓┏━┳┓┏┛+ + + + 31 | # ┃┫┫ ┃┫┫ 32 | # ┗┻┛ ┗┻┛+ + + + 33 | 34 | red='\033[0;31m' 35 | green='\033[0;32m' 36 | yellow='\033[0;33m' 37 | plain='\033[0m' 38 | 39 | version="v1.1.1" 40 | conf_dir="/etc/sprov-ui/" 41 | conf_path="${conf_dir}sprov-ui.conf" 42 | 43 | # check root 44 | [[ $EUID -ne 0 ]] && echo -e "${red}错误: ${plain} 必须使用root用户运行此脚本!\n" && exit 1 45 | 46 | # check os 47 | if [[ -f /etc/redhat-release ]]; then 48 | release="centos" 49 | elif cat /etc/issue | grep -Eqi "debian"; then 50 | release="debian" 51 | elif cat /etc/issue | grep -Eqi "ubuntu"; then 52 | release="ubuntu" 53 | elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then 54 | release="centos" 55 | elif cat /proc/version | grep -Eqi "debian"; then 56 | release="debian" 57 | elif cat /proc/version | grep -Eqi "ubuntu"; then 58 | release="ubuntu" 59 | elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then 60 | release="centos" 61 | else 62 | echo -e "${red}未检测到系统版本,请联系脚本作者!${plain}\n" && exit 1 63 | fi 64 | 65 | os_version="" 66 | 67 | # os version 68 | if [[ -f /etc/os-release ]]; then 69 | os_version=$(awk -F'[= ."]' '/VERSION_ID/{print $3}' /etc/os-release) 70 | fi 71 | if [[ -z "$os_version" && -f /etc/lsb-release ]]; then 72 | os_version=$(awk -F'[= ."]+' '/DISTRIB_RELEASE/{print $2}' /etc/lsb-release) 73 | fi 74 | 75 | if [[ x"${release}" == x"centos" ]]; then 76 | if [[ ${os_version} -le 6 ]]; then 77 | echo -e "${red}请使用 CentOS 7 或更高版本的系统!${plain}\n" && exit 1 78 | fi 79 | elif [[ x"${release}" == x"ubuntu" ]]; then 80 | if [[ ${os_version} -lt 16 ]]; then 81 | echo -e "${red}请使用 Ubuntu 16 或更高版本的系统!${plain}\n" && exit 1 82 | fi 83 | elif [[ x"${release}" == x"debian" ]]; then 84 | if [[ ${os_version} -lt 8 ]]; then 85 | echo -e "${red}请使用 Debian 8 或更高版本的系统!${plain}\n" && exit 1 86 | fi 87 | fi 88 | 89 | # -1: 未安装, 0: 已运行, 1: 未运行 90 | sprov_ui_status=-1 91 | 92 | confirm() { 93 | if [[ $# > 1 ]]; then 94 | echo && read -p "$1 [默认$2]: " temp 95 | if [[ x"${temp}" == x"" ]]; then 96 | temp=$2 97 | fi 98 | else 99 | read -p "$1 [y/n]: " temp 100 | fi 101 | if [[ x"${temp}" == x"y" || x"${temp}" == x"Y" ]]; then 102 | return 0 103 | else 104 | return 1 105 | fi 106 | } 107 | 108 | confirm_restart() { 109 | confirm "是否重启面板" "y" 110 | if [[ $? == 0 ]]; then 111 | restart 112 | else 113 | show_menu 114 | fi 115 | } 116 | 117 | before_show_menu() { 118 | echo && echo -n -e "${yellow}按回车返回主菜单: ${plain}" && read temp 119 | show_menu 120 | } 121 | 122 | install_base() { 123 | (command -v curl >/dev/null 2>&1 && command -v wget >/dev/null 2>&1)\ 124 | || (command -v yum >/dev/null 2>&1 && yum install curl wget -y)\ 125 | || (command -v apt >/dev/null 2>&1 && apt install curl wget -y)\ 126 | || (command -v apt-get >/dev/null 2>&1 && apt-get install curl wget -y) 127 | } 128 | 129 | install_soft() { 130 | (command -v $1 >/dev/null 2>&1)\ 131 | || (command -v yum >/dev/null 2>&1 && yum install $1 -y)\ 132 | || (command -v apt >/dev/null 2>&1 && apt install $1 -y)\ 133 | || (command -v apt-get >/dev/null 2>&1 && apt-get install $1 -y) 134 | } 135 | 136 | install() { 137 | install_base 138 | bash <(curl -L -s https://download.o2oyc.com/sprov-ui/install.sh) 139 | if [[ $? == 0 ]]; then 140 | if [[ $# == 0 ]]; then 141 | start 142 | else 143 | start 0 144 | fi 145 | fi 146 | } 147 | 148 | update() { 149 | confirm "本功能会强制重装当前最新版,数据不会丢失,是否继续?" "n" 150 | if [[ $? != 0 ]]; then 151 | echo -e "${red}已取消${plain}" 152 | if [[ $# == 0 ]]; then 153 | before_show_menu 154 | fi 155 | return 0 156 | fi 157 | install_base 158 | bash <(curl -L -s https://download.o2oyc.com/sprov-ui/install.sh) 159 | if [[ $? == 0 ]]; then 160 | if [[ $# == 0 ]]; then 161 | restart 162 | else 163 | restart 0 164 | fi 165 | fi 166 | } 167 | 168 | uninstall() { 169 | confirm "确定要卸载面板吗?" "n" 170 | if [[ $? != 0 ]]; then 171 | if [[ $# == 0 ]]; then 172 | show_menu 173 | fi 174 | return 0 175 | fi 176 | systemctl stop sprov-ui 177 | systemctl disable sprov-ui 178 | rm /etc/systemd/system/sprov-ui.service -f 179 | systemctl daemon-reload 180 | systemctl reset-failed 181 | rm /etc/sprov-ui/ -rf 182 | rm /usr/local/sprov-ui/ -rf 183 | 184 | echo "" 185 | echo -e "${gree}卸载成功${plain},感谢你的使用,如果你有更多的建议或意见,可以在以下地方进行讨论: " 186 | echo "" 187 | echo -e "Telegram 群组: ${green}https://t.me/sprov_blog${plain}" 188 | echo -e "Github issues: ${green}https://github.com/yuyeah/sprov-ui/issues${plain}" 189 | echo -e "博客: ${green}https://blog.sprov.xyz/sprov-ui${plain}" 190 | 191 | if [[ $# == 0 ]]; then 192 | before_show_menu 193 | fi 194 | } 195 | 196 | modify_user() { 197 | echo && read -p "请输入用户名: " user 198 | read -p "请输入密码: " pwd 199 | if [[ -z "${user}" || -z "${pwd}" ]]; then 200 | echo -e "${red}用户名和密码不能为空${plain}" 201 | before_show_menu 202 | return 1 203 | fi 204 | sed -i "s/^username=.*/username=${user}/" ${conf_path} 205 | sed -i "s/^password=.*/password=${pwd}/" ${conf_path} 206 | confirm_restart 207 | } 208 | 209 | modify_port() { 210 | echo && read -p "输入面板新端口 [建议10000-65535]: " port 211 | if [[ -z "${port}" ]]; then 212 | echo -e "${red}未输入端口${plain}" 213 | before_show_menu 214 | return 1 215 | fi 216 | sed -i "s/^port=.*/port=${port}/" ${conf_path} 217 | confirm_restart 218 | } 219 | 220 | modify_config() { 221 | install_soft vim 222 | echo -e "----------------------------------------------------" 223 | echo -e " vim 使用方法说明: " 224 | echo -e "首先按字母 ${red}i${plain} 进入 ${green}[编辑模式]${plain}" 225 | echo -e "${green}[编辑模式]${plain} 下,方向键移动光标,和平常编辑文本的习惯一样" 226 | echo -e "编辑完毕后,按 ${red}Esc${plain} 键退出 ${green}[编辑模式]${plain}" 227 | echo -e "最后按 ${red}:wq${plain} 保存文件并退出 vim ${yellow}(注意有个英文冒号)${plain}" 228 | echo -e "----------------------------------------------------" 229 | echo -e -n "${greed}将会使用 vim 进行编辑,按回车继续,或输入 n 返回: ${plain}" 230 | read temp 231 | if [[ x"${temp}" == x"n" || x"${temp}" == x"N" ]]; then 232 | show_menu 233 | return 0 234 | fi 235 | vim ${conf_path} 236 | confirm_restart 237 | } 238 | 239 | start() { 240 | check_status 241 | if [[ $? == 0 ]]; then 242 | echo "" 243 | echo -e "${green}面板已运行,无需再次启动,如需重启请选择重启${plain}" 244 | else 245 | systemctl start sprov-ui 246 | sleep 2 247 | check_status 248 | if [[ $? == 0 ]]; then 249 | echo -e "${green}sprov-ui 启动成功${plain}" 250 | else 251 | echo -e "${red}面板启动失败,可能是因为启动时间超过了两秒,请稍后查看日志信息${plain}" 252 | fi 253 | fi 254 | 255 | if [[ $# == 0 ]]; then 256 | before_show_menu 257 | fi 258 | } 259 | 260 | stop() { 261 | check_status 262 | if [[ $? == 1 ]]; then 263 | echo "" 264 | echo -e "${green}面板已停止,无需再次停止${plain}" 265 | else 266 | systemctl stop sprov-ui 267 | sleep 2 268 | check_status 269 | if [[ $? == 1 ]]; then 270 | echo -e "${green}sprov-ui 停止成功${plain}" 271 | else 272 | echo -e "${red}面板停止失败,可能是因为停止时间超过了两秒,请稍后查看日志信息${plain}" 273 | fi 274 | fi 275 | 276 | if [[ $# == 0 ]]; then 277 | before_show_menu 278 | fi 279 | } 280 | 281 | restart() { 282 | systemctl restart sprov-ui 283 | sleep 2 284 | check_status 285 | if [[ $? == 0 ]]; then 286 | echo -e "${green}sprov-ui 重启成功${plain}" 287 | else 288 | echo -e "${red}面板重启失败,可能是因为启动时间超过了两秒,请稍后查看日志信息${plain}" 289 | fi 290 | if [[ $# == 0 ]]; then 291 | before_show_menu 292 | fi 293 | } 294 | 295 | enable() { 296 | systemctl enable sprov-ui 297 | if [[ $? == 0 ]]; then 298 | echo -e "${green}sprov-ui 设置开机自启成功${plain}" 299 | else 300 | echo -e "${red}sprov-ui 设置开机自启失败${plain}" 301 | fi 302 | 303 | if [[ $# == 0 ]]; then 304 | before_show_menu 305 | fi 306 | } 307 | 308 | disable() { 309 | systemctl disable sprov-ui 310 | if [[ $? == 0 ]]; then 311 | echo -e "${green}sprov-ui 取消开机自启成功${plain}" 312 | else 313 | echo -e "${red}sprov-ui 取消开机自启失败${plain}" 314 | fi 315 | 316 | if [[ $# == 0 ]]; then 317 | before_show_menu 318 | fi 319 | } 320 | 321 | show_log() { 322 | systemctl status sprov-ui -l 323 | if [[ $# == 0 ]]; then 324 | before_show_menu 325 | fi 326 | } 327 | 328 | install_bbr() { 329 | bash <(curl -L -s https://download.o2oyc.com/sprov-ui/install.sh) 330 | if [[ $? == 0 ]]; then 331 | echo "" 332 | echo -e "${green}安装 bbr 成功${plain}" 333 | else 334 | echo "" 335 | echo -e "${red}下载 bbr 安装脚本失败,请检查本机能否连接 Github${plain}" 336 | fi 337 | 338 | before_show_menu 339 | } 340 | 341 | update_shell() { 342 | wget -O /usr/bin/sprov-ui -N --no-check-certificate https://download.o2oyc.com/sprov-ui/install.sh 343 | if [[ $? != 0 ]]; then 344 | echo "" 345 | echo -e "${red}下载脚本失败,请检查本机能否连接 Github${plain}" 346 | before_show_menu 347 | else 348 | chmod +x /usr/bin/sprov-ui 349 | echo -e "${green}升级脚本成功,请重新运行脚本${plain}" && exit 0 350 | fi 351 | } 352 | 353 | # 0: running, 1: not running, 2: not installed 354 | check_status() { 355 | if [[ ! -f /etc/systemd/system/sprov-ui.service ]]; then 356 | return 2 357 | fi 358 | temp=$(systemctl status sprov-ui | grep Active | awk '{print $3}' | cut -d "(" -f2 | cut -d ")" -f1) 359 | if [[ x"${temp}" == x"running" ]]; then 360 | return 0 361 | else 362 | return 1 363 | fi 364 | } 365 | 366 | check_enabled() { 367 | temp=$(systemctl is-enabled sprov-ui) 368 | if [[ x"${temp}" == x"enabled" ]]; then 369 | return 0 370 | else 371 | return 1; 372 | fi 373 | } 374 | 375 | check_uninstall() { 376 | check_status 377 | if [[ $? != 2 ]]; then 378 | echo "" 379 | echo -e "${red}面板已安装,请不要重复安装${plain}" 380 | if [[ $# == 0 ]]; then 381 | before_show_menu 382 | fi 383 | return 1 384 | else 385 | return 0 386 | fi 387 | } 388 | 389 | check_install() { 390 | check_status 391 | if [[ $? == 2 ]]; then 392 | echo "" 393 | echo -e "${red}请先安装面板${plain}" 394 | if [[ $# == 0 ]]; then 395 | before_show_menu 396 | fi 397 | return 1 398 | else 399 | return 0 400 | fi 401 | } 402 | 403 | show_status() { 404 | check_status 405 | case $? in 406 | 0) 407 | echo -e "面板状态: ${green}已运行${plain}" 408 | show_enable_status 409 | ;; 410 | 1) 411 | echo -e "面板状态: ${yellow}未运行${plain}" 412 | show_enable_status 413 | ;; 414 | 2) 415 | echo -e "面板状态: ${red}未安装${plain}" 416 | esac 417 | } 418 | 419 | show_enable_status() { 420 | check_enabled 421 | if [[ $? == 0 ]]; then 422 | echo -e "是否开机自启: ${green}是${plain}" 423 | else 424 | echo -e "是否开机自启: ${red}否${plain}" 425 | fi 426 | } 427 | 428 | show_usage() { 429 | echo "sprov-ui 管理脚本使用方法: " 430 | echo "------------------------------------------" 431 | echo "sprov-ui - 显示管理菜单 (功能更多)" 432 | echo "sprov-ui start - 启动 sprov-ui 面板" 433 | echo "sprov-ui stop - 停止 sprov-ui 面板" 434 | echo "sprov-ui restart - 重启 sprov-ui 面板" 435 | echo "sprov-ui status - 查看 sprov-ui 状态" 436 | echo "sprov-ui enable - 设置 sprov-ui 开机自启" 437 | echo "sprov-ui disable - 取消 sprov-ui 开启自启" 438 | echo "sprov-ui log - 查看 sprov-ui 日志" 439 | echo "sprov-ui update - 更新 sprov-ui 面板" 440 | echo "sprov-ui install - 安装 sprov-ui 面板" 441 | echo "sprov-ui uninstall - 卸载 sprov-ui 面板" 442 | echo "------------------------------------------" 443 | } 444 | 445 | show_menu() { 446 | echo -e " 447 | ${green}sprov-ui 面板管理脚本${plain} ${red}${version}${plain} 448 | 449 | --- https://blog.sprov.xyz/sprov-ui --- 450 | 451 | ${green}0.${plain} 退出脚本 452 | ———————————————— 453 | ${green}1.${plain} 安装 sprov-ui 454 | ${green}2.${plain} 更新 sprov-ui 455 | ${green}3.${plain} 卸载 sprov-ui 456 | ———————————————— 457 | ${green}4.${plain} 修改面板账号密码 458 | ${green}5.${plain} 修改面板监听端口 459 | ${green}6.${plain} 手动修改配置 460 | ———————————————— 461 | ${green}7.${plain} 启动 sprov-ui 462 | ${green}8.${plain} 停止 sprov-ui 463 | ${green}9.${plain} 重启 sprov-ui 464 | ${green}10.${plain} 查看 sprov-ui 日志 465 | ———————————————— 466 | ${green}11.${plain} 设置 sprov-ui 开机自启 467 | ${green}12.${plain} 取消 sprov-ui 开机自启 468 | ———————————————— 469 | ${green}13.${plain} 一键安装 bbr (最新内核) 470 | ${green}14.${plain} 升级此脚本 471 | " 472 | show_status 473 | echo && read -p "请输入选择 [0-14]: " num 474 | 475 | case "${num}" in 476 | 0) exit 0 477 | ;; 478 | 1) check_uninstall && install 479 | ;; 480 | 2) check_install && update 481 | ;; 482 | 3) check_install && uninstall 483 | ;; 484 | 4) check_install && modify_user 485 | ;; 486 | 5) check_install && modify_port 487 | ;; 488 | 6) check_install && modify_config 489 | ;; 490 | 7) check_install && start 491 | ;; 492 | 8) check_install && stop 493 | ;; 494 | 9) check_install && restart 495 | ;; 496 | 10) check_install && show_log 497 | ;; 498 | 11) check_install && enable 499 | ;; 500 | 12) check_install && disable 501 | ;; 502 | 13) install_bbr 503 | ;; 504 | 14) update_shell 505 | ;; 506 | *) echo -e "${red}请输入正确的数字 [0-14]${plain}" 507 | ;; 508 | esac 509 | } 510 | 511 | 512 | if [[ $# > 0 ]]; then 513 | case $1 in 514 | "start") check_install 0 && start 0 515 | ;; 516 | "stop") check_install 0 && stop 0 517 | ;; 518 | "restart") check_install 0 && restart 0 519 | ;; 520 | "status") check_install 0 && show_status 0 521 | ;; 522 | "enable") check_install 0 && enable 0 523 | ;; 524 | "disable") check_install 0 && disable 0 525 | ;; 526 | "log") check_install 0 && show_log 0 527 | ;; 528 | "update") check_install 0 && update 0 529 | ;; 530 | "install") check_uninstall 0 && install 0 531 | ;; 532 | "uninstall") check_install 0 && uninstall 0 533 | ;; 534 | *) show_usage 535 | esac 536 | else 537 | show_menu 538 | fi 539 | -------------------------------------------------------------------------------- /tls/sprov-ui.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seedc/sprov-ui_nginx/5cf210e0f70cb7159d75f8aa83f1ea231d5895ae/tls/sprov-ui.jar -------------------------------------------------------------------------------- /tls/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #kaer 脚本启动 3 | export PATH=${PATH} 4 | nohup java -jar sprov-ui.jar --server.port=5000 >sprov.log & 5 | -------------------------------------------------------------------------------- /tls/stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export PATH=$PATH 3 | 4 | #根据端口号查询对应的pid 5 | pid=$(ss -tlnp |grep :5000 |cut -d '=' -f 2 |cut -d ',' -f 1) 6 | 7 | # 杀掉对应的进程,如果pid不存在,则不执行 8 | if [ -n "${pid}" ]; then 9 | kill -9 ${pid}; 10 | kill -9 ${pid}; 11 | fi 12 | exit 0 13 | 14 | -------------------------------------------------------------------------------- /注意安装必读.txt: -------------------------------------------------------------------------------- 1 | 注意:安装前请解析域名到主机,否则可能不成功. 2 | 注意:安装 sprov-ui时候不要使用80端口和443端口 3 | Vmess+websocket+TLS+Nginx+Website+sprov-ui: 4 | 5 | bash <(curl -L -s https://download.o2oyc.com/sprov-ui_nginx/install.sh) | tee v2ray_ins.log && sprov-ui 6 | 7 | 8 | --------------------------------------------------------------------------------