mirror of https://github.com/wulabing/Xray_onekey
commit
5c0020bca4
210
install.sh
210
install.sh
|
@ -2,7 +2,10 @@
|
|||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
cd $(cd "$(dirname "$0")"; pwd)
|
||||
cd "$(
|
||||
cd "$(dirname "$0")" || exit
|
||||
pwd
|
||||
)" || exit
|
||||
#====================================================
|
||||
# System Request:Debian 9+/Ubuntu 18.04+/Centos 7+
|
||||
# Author: wulabing
|
||||
|
@ -15,13 +18,13 @@ cd $(cd "$(dirname "$0")"; pwd)
|
|||
#fonts color
|
||||
Green="\033[32m"
|
||||
Red="\033[31m"
|
||||
Yellow="\033[33m"
|
||||
# Yellow="\033[33m"
|
||||
GreenBG="\033[42;37m"
|
||||
RedBG="\033[41;37m"
|
||||
Font="\033[0m"
|
||||
|
||||
#notification information
|
||||
Info="${Green}[信息]${Font}"
|
||||
# Info="${Green}[信息]${Font}"
|
||||
OK="${Green}[OK]${Font}"
|
||||
Error="${Red}[错误]${Font}"
|
||||
|
||||
|
@ -50,18 +53,18 @@ nginx_version="1.16.1"
|
|||
openssl_version="1.1.1d"
|
||||
jemalloc_version="5.2.1"
|
||||
old_config_status="off"
|
||||
v2ray_plugin_version="$(wget -qO- "https://github.com/shadowsocks/v2ray-plugin/tags" |grep -E "/shadowsocks/v2ray-plugin/releases/tag/" |head -1|sed -r 's/.*tag\/v(.+)\">.*/\1/')"
|
||||
# v2ray_plugin_version="$(wget -qO- "https://github.com/shadowsocks/v2ray-plugin/tags" | grep -E "/shadowsocks/v2ray-plugin/releases/tag/" | head -1 | sed -r 's/.*tag\/v(.+)\">.*/\1/')"
|
||||
|
||||
#移动旧版本配置信息 对小于 1.1.0 版本适配
|
||||
[[ -f "/etc/v2ray/vmess_qr.json" ]] && mv /etc/v2ray/vmess_qr.json $v2ray_qr_config_file
|
||||
|
||||
#生成伪装路径
|
||||
camouflage="/`cat /dev/urandom | head -n 10 | md5sum | head -c 8`/"
|
||||
camouflage="/$(head -n 10 /dev/urandom | md5sum | head -c 8)/"
|
||||
|
||||
source /etc/os-release
|
||||
source '/etc/os-release'
|
||||
|
||||
#从VERSION中提取发行版系统的英文名称,为了在debian/ubuntu下添加相对应的Nginx apt源
|
||||
VERSION=`echo ${VERSION} | awk -F "[()]" '{print $2}'`
|
||||
VERSION=$(echo "${VERSION}" | awk -F "[()]" '{print $2}')
|
||||
|
||||
check_system() {
|
||||
if [[ "${ID}" == "centos" && ${VERSION_ID} -ge 7 ]]; then
|
||||
|
@ -72,7 +75,7 @@ check_system(){
|
|||
INS="apt"
|
||||
$INS update
|
||||
## 添加 Nginx apt源
|
||||
elif [[ "${ID}" == "ubuntu" && `echo "${VERSION_ID}" | cut -d '.' -f1` -ge 16 ]];then
|
||||
elif [[ "${ID}" == "ubuntu" && $(echo "${VERSION_ID}" | cut -d '.' -f1) -ge 16 ]]; then
|
||||
echo -e "${OK} ${GreenBG} 当前系统为 Ubuntu ${VERSION_ID} ${UBUNTU_CODENAME} ${Font}"
|
||||
INS="apt"
|
||||
$INS update
|
||||
|
@ -93,8 +96,8 @@ check_system(){
|
|||
}
|
||||
|
||||
is_root() {
|
||||
if [ `id -u` == 0 ]
|
||||
then echo -e "${OK} ${GreenBG} 当前用户是root用户,进入安装流程 ${Font}"
|
||||
if [ 0 == $UID ]; then
|
||||
echo -e "${OK} ${GreenBG} 当前用户是root用户,进入安装流程 ${Font}"
|
||||
sleep 3
|
||||
else
|
||||
echo -e "${Error} ${RedBG} 当前用户不是root用户,请切换到root用户后重新执行脚本 ${Font}"
|
||||
|
@ -102,7 +105,7 @@ is_root(){
|
|||
fi
|
||||
}
|
||||
judge() {
|
||||
if [[ $? -eq 0 ]];then
|
||||
if [[ 0 -eq $? ]]; then
|
||||
echo -e "${OK} ${GreenBG} $1 完成 ${Font}"
|
||||
sleep 1
|
||||
else
|
||||
|
@ -132,7 +135,7 @@ chrony_install(){
|
|||
chronyc sourcestats -v
|
||||
chronyc tracking -v
|
||||
date
|
||||
read -p "请确认时间是否准确,误差范围±3分钟(Y/N): " chrony_install
|
||||
read -rp "请确认时间是否准确,误差范围±3分钟(Y/N): " chrony_install
|
||||
[[ -z ${chrony_install} ]] && chrony_install="Y"
|
||||
case $chrony_install in
|
||||
[yY][eE][sS] | [yY])
|
||||
|
@ -166,8 +169,6 @@ dependency_install(){
|
|||
fi
|
||||
judge "crontab 自启动配置 "
|
||||
|
||||
|
||||
|
||||
${INS} -y install bc
|
||||
judge "安装 bc"
|
||||
|
||||
|
@ -228,26 +229,23 @@ basic_optimization(){
|
|||
|
||||
}
|
||||
port_alterid_set() {
|
||||
if [[ "on" != "$old_config_status" ]]
|
||||
then
|
||||
read -p "请输入连接端口(default:443):" port
|
||||
if [[ "on" != "$old_config_status" ]]; then
|
||||
read -rp "请输入连接端口(default:443):" port
|
||||
[[ -z ${port} ]] && port="443"
|
||||
read -p "请输入alterID(default:2 仅允许填数字):" alterID
|
||||
read -rp "请输入alterID(default:2 仅允许填数字):" alterID
|
||||
[[ -z ${alterID} ]] && alterID="2"
|
||||
fi
|
||||
}
|
||||
modify_path() {
|
||||
if [[ "on" == "$old_config_status" ]]
|
||||
then
|
||||
camouflage="$(cat $v2ray_qr_config_file | grep '\"path\"' | awk -F '"' '{print $4}')"
|
||||
if [[ "on" == "$old_config_status" ]]; then
|
||||
camouflage="$(grep '\"path\"' $v2ray_qr_config_file | awk -F '"' '{print $4}')"
|
||||
fi
|
||||
sed -i "/\"path\"/c \\\t \"path\":\"${camouflage}\"" ${v2ray_conf}
|
||||
judge "V2ray 伪装路径 修改"
|
||||
}
|
||||
modify_alterid() {
|
||||
if [[ "on" == "$old_config_status" ]]
|
||||
then
|
||||
alterID="$(cat $v2ray_qr_config_file | grep '\"aid\"' | awk -F '"' '{print $4}')"
|
||||
if [[ "on" == "$old_config_status" ]]; then
|
||||
alterID="$(grep '\"aid\"' $v2ray_qr_config_file | awk -F '"' '{print $4}')"
|
||||
fi
|
||||
sed -i "/\"alterId\"/c \\\t \"alterId\":${alterID}" ${v2ray_conf}
|
||||
judge "V2ray alterid 修改"
|
||||
|
@ -255,13 +253,11 @@ modify_alterid(){
|
|||
echo -e "${OK} ${GreenBG} alterID:${alterID} ${Font}"
|
||||
}
|
||||
modify_inbound_port() {
|
||||
if [[ "on" == "$old_config_status" ]]
|
||||
then
|
||||
if [[ "on" == "$old_config_status" ]]; then
|
||||
port="$(info_extraction '\"port\"')"
|
||||
fi
|
||||
if [[ "$shell_mode" != "h2" ]]
|
||||
then
|
||||
let PORT=$RANDOM+10000
|
||||
if [[ "$shell_mode" != "h2" ]]; then
|
||||
PORT=$((RANDOM + 10000))
|
||||
sed -i "/\"port\"/c \ \"port\":${PORT}," ${v2ray_conf}
|
||||
else
|
||||
sed -i "/\"port\"/c \ \"port\":${port}," ${v2ray_conf}
|
||||
|
@ -269,9 +265,8 @@ modify_inbound_port(){
|
|||
judge "V2ray inbound_port 修改"
|
||||
}
|
||||
modify_UUID() {
|
||||
[ -z $UUID ] && UUID=$(cat /proc/sys/kernel/random/uuid)
|
||||
if [[ "on" == "$old_config_status" ]]
|
||||
then
|
||||
[ -z "$UUID" ] && UUID=$(cat /proc/sys/kernel/random/uuid)
|
||||
if [[ "on" == "$old_config_status" ]]; then
|
||||
UUID="$(info_extraction '\"id\"')"
|
||||
fi
|
||||
sed -i "/\"id\"/c \\\t \"id\":\"${UUID}\"," ${v2ray_conf}
|
||||
|
@ -280,8 +275,7 @@ modify_UUID(){
|
|||
echo -e "${OK} ${GreenBG} UUID:${UUID} ${Font}"
|
||||
}
|
||||
modify_nginx_port() {
|
||||
if [[ "on" == "$old_config_status" ]]
|
||||
then
|
||||
if [[ "on" == "$old_config_status" ]]; then
|
||||
port="$(info_extraction '\"port\"')"
|
||||
fi
|
||||
sed -i "/ssl http2;$/c \\\tlisten ${port} ssl http2;" ${nginx_conf}
|
||||
|
@ -298,7 +292,9 @@ modify_nginx_other(){
|
|||
}
|
||||
web_camouflage() {
|
||||
##请注意 这里和LNMP脚本的默认路径冲突,千万不要在安装了LNMP的环境下使用本脚本,否则后果自负
|
||||
rm -rf /home/wwwroot && mkdir -p /home/wwwroot && cd /home/wwwroot
|
||||
rm -rf /home/wwwroot
|
||||
mkdir -p /home/wwwroot
|
||||
cd /home/wwwroot || exit
|
||||
git clone https://github.com/wulabing/3DCEList.git
|
||||
judge "web 站点伪装"
|
||||
}
|
||||
|
@ -309,7 +305,8 @@ v2ray_install(){
|
|||
if [[ -d /etc/v2ray ]]; then
|
||||
rm -rf /etc/v2ray
|
||||
fi
|
||||
mkdir -p /root/v2ray && cd /root/v2ray
|
||||
mkdir -p /root/v2ray
|
||||
cd /root/v2ray || exit
|
||||
wget -N --no-check-certificate https://install.direct/go.sh
|
||||
|
||||
## wget http://install.direct/go.sh
|
||||
|
@ -330,8 +327,7 @@ nginx_exist_check(){
|
|||
if [[ -f "/etc/nginx/sbin/nginx" ]]; then
|
||||
echo -e "${OK} ${GreenBG} Nginx已存在,跳过编译安装过程 ${Font}"
|
||||
sleep 2
|
||||
elif [[ -d "/usr/local/nginx/" ]]
|
||||
then
|
||||
elif [[ -d "/usr/local/nginx/" ]]; then
|
||||
echo -e "${OK} ${GreenBG} 检测到其他套件安装的Nginx,继续安装会造成冲突,请处理后安装${Font}"
|
||||
exit 1
|
||||
else
|
||||
|
@ -350,7 +346,7 @@ nginx_install(){
|
|||
wget -nc --no-check-certificate https://github.com/jemalloc/jemalloc/releases/download/${jemalloc_version}/jemalloc-${jemalloc_version}.tar.bz2 -P ${nginx_openssl_src}
|
||||
judge "jemalloc 下载"
|
||||
|
||||
cd ${nginx_openssl_src}
|
||||
cd ${nginx_openssl_src} || exit
|
||||
|
||||
[[ -d nginx-"$nginx_version" ]] && rm -rf nginx-"$nginx_version"
|
||||
tar -zxvf nginx-"$nginx_version".tar.gz
|
||||
|
@ -363,11 +359,10 @@ nginx_install(){
|
|||
|
||||
[[ -d "$nginx_dir" ]] && rm -rf ${nginx_dir}
|
||||
|
||||
|
||||
echo -e "${OK} ${GreenBG} 即将开始编译安装 jemalloc ${Font}"
|
||||
sleep 2
|
||||
|
||||
cd jemalloc-${jemalloc_version}
|
||||
cd jemalloc-${jemalloc_version} || exit
|
||||
./configure
|
||||
judge "编译检查"
|
||||
make && make install
|
||||
|
@ -378,7 +373,7 @@ nginx_install(){
|
|||
echo -e "${OK} ${GreenBG} 即将开始编译安装 Nginx, 过程稍久,请耐心等待 ${Font}"
|
||||
sleep 4
|
||||
|
||||
cd ../nginx-${nginx_version}
|
||||
cd ../nginx-${nginx_version} || exit
|
||||
|
||||
./configure --prefix="${nginx_dir}" \
|
||||
--with-http_ssl_module \
|
||||
|
@ -403,8 +398,6 @@ nginx_install(){
|
|||
sed -i 's/ worker_connections 1024;/ worker_connections 4096;/' ${nginx_dir}/conf/nginx.conf
|
||||
sed -i '$i include conf.d/*.conf;' ${nginx_dir}/conf/nginx.conf
|
||||
|
||||
|
||||
|
||||
# 删除临时文件
|
||||
rm -rf ../nginx-"${nginx_version}"
|
||||
rm -rf ../openssl-"${openssl_version}"
|
||||
|
@ -426,19 +419,19 @@ ssl_install(){
|
|||
judge "安装 SSL 证书生成脚本"
|
||||
}
|
||||
domain_check() {
|
||||
read -p "请输入你的域名信息(eg:www.wulabing.com):" domain
|
||||
domain_ip=`ping ${domain} -c 1 | sed '1{s/[^(]*(//;s/).*//;q}'`
|
||||
read -rp "请输入你的域名信息(eg:www.wulabing.com):" domain
|
||||
domain_ip=$(ping "${domain}" -c 1 | sed '1{s/[^(]*(//;s/).*//;q}')
|
||||
echo -e "${OK} ${GreenBG} 正在获取 公网ip 信息,请耐心等待 ${Font}"
|
||||
local_ip=`curl -4 ip.sb`
|
||||
local_ip=$(curl -4 ip.sb)
|
||||
echo -e "域名dns解析IP:${domain_ip}"
|
||||
echo -e "本机IP: ${local_ip}"
|
||||
sleep 2
|
||||
if [[ $(echo ${local_ip}|tr '.' '+'|bc) -eq $(echo ${domain_ip}|tr '.' '+'|bc) ]];then
|
||||
if [[ $(echo "${local_ip}" | tr '.' '+' | bc) -eq $(echo "${domain_ip}" | tr '.' '+' | bc) ]]; then
|
||||
echo -e "${OK} ${GreenBG} 域名dns解析IP 与 本机IP 匹配 ${Font}"
|
||||
sleep 2
|
||||
else
|
||||
echo -e "${Error} ${RedBG} 请确保域名添加了正确的 A 记录,否则将无法正常使用 V2ray ${Font}"
|
||||
echo -e "${Error} ${RedBG} 域名dns解析IP 与 本机IP 不匹配 是否继续安装?(y/n)${Font}" && read install
|
||||
echo -e "${Error} ${RedBG} 域名dns解析IP 与 本机IP 不匹配 是否继续安装?(y/n)${Font}" && read -r install
|
||||
case $install in
|
||||
[yY][eE][sS] | [yY])
|
||||
echo -e "${GreenBG} 继续安装 ${Font}"
|
||||
|
@ -453,7 +446,7 @@ domain_check(){
|
|||
}
|
||||
|
||||
port_exist_check() {
|
||||
if [[ 0 -eq `lsof -i:"$1" | grep -i "listen" | wc -l` ]];then
|
||||
if [[ 0 -eq $(lsof -i:"$1" | grep -i -c "listen") ]]; then
|
||||
echo -e "${OK} ${GreenBG} $1 端口未被占用 ${Font}"
|
||||
sleep 1
|
||||
else
|
||||
|
@ -467,8 +460,7 @@ port_exist_check(){
|
|||
fi
|
||||
}
|
||||
acme() {
|
||||
$HOME/.acme.sh/acme.sh --issue -d ${domain} --standalone -k ec-256 --force --test
|
||||
if [[ $? -eq 0 ]];then
|
||||
if "$HOME"/.acme.sh/acme.sh --issue -d "${domain}" --standalone -k ec-256 --force --test; then
|
||||
echo -e "${OK} ${GreenBG} SSL 证书测试签发成功,开始正式签发 ${Font}"
|
||||
rm -rf "$HOME/.acme.sh/${domain}_ecc"
|
||||
sleep 2
|
||||
|
@ -478,13 +470,11 @@ acme(){
|
|||
exit 1
|
||||
fi
|
||||
|
||||
$HOME/.acme.sh/acme.sh --issue -d ${domain} --standalone -k ec-256 --force
|
||||
if [[ $? -eq 0 ]];then
|
||||
if "$HOME"/.acme.sh/acme.sh --issue -d "${domain}" --standalone -k ec-256 --force; then
|
||||
echo -e "${OK} ${GreenBG} SSL 证书生成成功 ${Font}"
|
||||
sleep 2
|
||||
mkdir /data
|
||||
$HOME/.acme.sh/acme.sh --installcert -d ${domain} --fullchainpath /data/v2ray.crt --keypath /data/v2ray.key --ecc --force
|
||||
if [[ $? -eq 0 ]];then
|
||||
if "$HOME"/.acme.sh/acme.sh --installcert -d "${domain}" --fullchainpath /data/v2ray.crt --keypath /data/v2ray.key --ecc --force; then
|
||||
echo -e "${OK} ${GreenBG} 证书配置成功 ${Font}"
|
||||
sleep 2
|
||||
fi
|
||||
|
@ -495,7 +485,7 @@ acme(){
|
|||
fi
|
||||
}
|
||||
v2ray_conf_add_tls() {
|
||||
cd /etc/v2ray
|
||||
cd /etc/v2ray || exit
|
||||
wget --no-check-certificate https://raw.githubusercontent.com/wulabing/V2Ray_ws-tls_bash_onekey/${github_branch}/tls/config.json -O config.json
|
||||
modify_path
|
||||
modify_alterid
|
||||
|
@ -503,7 +493,7 @@ v2ray_conf_add_tls(){
|
|||
modify_UUID
|
||||
}
|
||||
v2ray_conf_add_h2() {
|
||||
cd /etc/v2ray
|
||||
cd /etc/v2ray || exit
|
||||
wget --no-check-certificate https://raw.githubusercontent.com/wulabing/V2Ray_ws-tls_bash_onekey/${github_branch}/http2/config.json -O config.json
|
||||
modify_path
|
||||
modify_alterid
|
||||
|
@ -511,8 +501,7 @@ v2ray_conf_add_h2(){
|
|||
modify_UUID
|
||||
}
|
||||
old_config_exist_check() {
|
||||
if [[ -f $v2ray_qr_config_file ]]
|
||||
then
|
||||
if [[ -f $v2ray_qr_config_file ]]; then
|
||||
echo -e "${OK} ${GreenBG} 检测到旧配置文件,是否读取旧文件配置 [Y/N]? ${Font}"
|
||||
read -r ssl_delete
|
||||
case $ssl_delete in
|
||||
|
@ -568,8 +557,7 @@ judge "Nginx 配置修改"
|
|||
|
||||
start_process_systemd() {
|
||||
systemctl daemon-reload
|
||||
if [[ "$shell_mode" != "h2" ]]
|
||||
then
|
||||
if [[ "$shell_mode" != "h2" ]]; then
|
||||
systemctl restart nginx
|
||||
judge "Nginx 启动"
|
||||
fi
|
||||
|
@ -580,8 +568,7 @@ start_process_systemd(){
|
|||
enable_process_systemd() {
|
||||
systemctl enable v2ray
|
||||
judge "设置 v2ray 开机自启"
|
||||
if [[ "$shell_mode" != "h2" ]]
|
||||
then
|
||||
if [[ "$shell_mode" != "h2" ]]; then
|
||||
systemctl enable nginx
|
||||
judge "设置 Nginx 开机自启"
|
||||
fi
|
||||
|
@ -589,8 +576,7 @@ enable_process_systemd(){
|
|||
}
|
||||
|
||||
stop_process_systemd() {
|
||||
if [[ "$shell_mode" != "h2" ]]
|
||||
then
|
||||
if [[ "$shell_mode" != "h2" ]]; then
|
||||
systemctl stop nginx
|
||||
fi
|
||||
systemctl stop v2ray
|
||||
|
@ -661,30 +647,34 @@ EOF
|
|||
}
|
||||
|
||||
vmess_qr_link_image() {
|
||||
vmess_link="vmess://$(cat $v2ray_qr_config_file | base64 -w 0)"
|
||||
echo -e "${Red} 二维码: ${Font}" >> ${v2ray_info_file}
|
||||
echo -n "${vmess_link}"| qrencode -o - -t utf8 >> ${v2ray_info_file}
|
||||
echo -e "${Red} URL导入链接:${vmess_link} ${Font}" >> ${v2ray_info_file}
|
||||
vmess_link="vmess://$(base64 -w 0 $v2ray_qr_config_file)"
|
||||
{
|
||||
echo -e "$Red 二维码: $Font"
|
||||
echo -n "${vmess_link}" | qrencode -o - -t utf8
|
||||
echo -e "${Red} URL导入链接:${vmess_link} ${Font}"
|
||||
} >>"${v2ray_info_file}"
|
||||
}
|
||||
|
||||
info_extraction() {
|
||||
grep $1 $v2ray_qr_config_file | awk -F '"' '{print $4}'
|
||||
grep "$1" $v2ray_qr_config_file | awk -F '"' '{print $4}'
|
||||
}
|
||||
basic_information() {
|
||||
echo -e "${OK} ${GreenBG} V2ray+ws+tls 安装成功" > ${v2ray_info_file}
|
||||
echo -e "${Red} V2ray 配置信息 ${Font}" >> ${v2ray_info_file}
|
||||
echo -e "${Red} 地址(address):${Font} $(info_extraction '\"add\"') " >> ${v2ray_info_file}
|
||||
echo -e "${Red} 端口(port):${Font} $(info_extraction '\"port\"') " >> ${v2ray_info_file}
|
||||
echo -e "${Red} 用户id(UUID):${Font} $(info_extraction '\"id\"')" >> ${v2ray_info_file}
|
||||
echo -e "${Red} 额外id(alterId):${Font} $(info_extraction '\"aid\"')" >> ${v2ray_info_file}
|
||||
echo -e "${Red} 加密方式(security):${Font} 自适应 " >> ${v2ray_info_file}
|
||||
echo -e "${Red} 传输协议(network):${Font} $(info_extraction '\"net\"') " >> ${v2ray_info_file}
|
||||
echo -e "${Red} 伪装类型(type):${Font} none " >> ${v2ray_info_file}
|
||||
echo -e "${Red} 路径(不要落下/):${Font} $(info_extraction '\"path\"') " >> ${v2ray_info_file}
|
||||
echo -e "${Red} 底层传输安全:${Font} tls " >> ${v2ray_info_file}
|
||||
{
|
||||
echo -e "${OK} ${GreenBG} V2ray+ws+tls 安装成功"
|
||||
echo -e "${Red} V2ray 配置信息 ${Font}"
|
||||
echo -e "${Red} 地址(address):${Font} $(info_extraction '\"add\"') "
|
||||
echo -e "${Red} 端口(port):${Font} $(info_extraction '\"port\"') "
|
||||
echo -e "${Red} 用户id(UUID):${Font} $(info_extraction '\"id\"')"
|
||||
echo -e "${Red} 额外id(alterId):${Font} $(info_extraction '\"aid\"')"
|
||||
echo -e "${Red} 加密方式(security):${Font} 自适应 "
|
||||
echo -e "${Red} 传输协议(network):${Font} $(info_extraction '\"net\"') "
|
||||
echo -e "${Red} 伪装类型(type):${Font} none "
|
||||
echo -e "${Red} 路径(不要落下/):${Font} $(info_extraction '\"path\"') "
|
||||
echo -e "${Red} 底层传输安全:${Font} tls "
|
||||
} >"${v2ray_info_file}"
|
||||
}
|
||||
show_information() {
|
||||
cat ${v2ray_info_file}
|
||||
cat "${v2ray_info_file}"
|
||||
}
|
||||
ssl_judge_and_install() {
|
||||
if [[ -f "/data/v2ray.key" || -f "/data/v2ray.crt" ]]; then
|
||||
|
@ -696,8 +686,8 @@ ssl_judge_and_install(){
|
|||
rm -rf /data/*
|
||||
echo -e "${OK} ${GreenBG} 已删除 ${Font}"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
*) ;;
|
||||
|
||||
esac
|
||||
fi
|
||||
|
||||
|
@ -705,7 +695,7 @@ ssl_judge_and_install(){
|
|||
echo "证书文件已存在"
|
||||
elif [[ -f "$HOME/.acme.sh/${domain}_ecc/${domain}.key" && -f "$HOME/.acme.sh/${domain}_ecc/${domain}.cer" ]]; then
|
||||
echo "证书文件已存在"
|
||||
$HOME/.acme.sh/acme.sh --installcert -d ${domain} --fullchainpath /data/v2ray.crt --keypath /data/v2ray.key --ecc
|
||||
"$HOME"/.acme.sh/acme.sh --installcert -d "${domain}" --fullchainpath /data/v2ray.crt --keypath /data/v2ray.key --ecc
|
||||
judge "证书应用"
|
||||
else
|
||||
ssl_install
|
||||
|
@ -743,7 +733,7 @@ tls_type(){
|
|||
echo "1: TLS1.1 TLS1.2 and TLS1.3(兼容模式)"
|
||||
echo "2: TLS1.2 and TLS1.3 (兼容模式)"
|
||||
echo "3: TLS1.3 only"
|
||||
read -p "请输入:" tls_version
|
||||
read -rp "请输入:" tls_version
|
||||
[[ -z ${tls_version} ]] && tls_version=3
|
||||
if [[ $tls_version == 3 ]]; then
|
||||
sed -i 's/ssl_protocols.*/ssl_protocols TLSv1.3;/' $nginx_conf
|
||||
|
@ -770,7 +760,7 @@ show_error_log(){
|
|||
ssl_update_manuel() {
|
||||
[ -f ${amce_sh_file} ] && "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" || echo -e "${RedBG}证书签发工具不存在,请确认你是否使用了自己的证书${Font}"
|
||||
domain="$(info_extraction '\"add\"')"
|
||||
$HOME/.acme.sh/acme.sh --installcert -d ${domain} --fullchainpath /data/v2ray.crt --keypath /data/v2ray.key --ecc
|
||||
"$HOME"/.acme.sh/acme.sh --installcert -d "${domain}" --fullchainpath /data/v2ray.crt --keypath /data/v2ray.key --ecc
|
||||
}
|
||||
bbr_boost_sh() {
|
||||
[ -f "tcp.sh" ] && rm -rf ./tcp.sh
|
||||
|
@ -786,8 +776,7 @@ uninstall_all(){
|
|||
[[ -f $nginx_systemd_file ]] && rm -f $nginx_systemd_file
|
||||
[[ -f $v2ray_systemd_file ]] && rm -f $v2ray_systemd_file
|
||||
[[ -d $v2ray_bin_dir ]] && rm -rf $v2ray_bin_dir
|
||||
if [[ -d $nginx_dir ]]
|
||||
then
|
||||
if [[ -d $nginx_dir ]]; then
|
||||
echo -e "${OK} ${Green} 是否卸载 Nginx [Y/N]? ${Font}"
|
||||
read -r uninstall_nginx
|
||||
case $uninstall_nginx in
|
||||
|
@ -795,8 +784,8 @@ uninstall_all(){
|
|||
rm -rf $nginx_dir
|
||||
echo -e "${OK} ${Green} 已卸载 Nginx ${Font}"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
*) ;;
|
||||
|
||||
esac
|
||||
fi
|
||||
[[ -d $v2ray_conf_dir ]] && rm -rf $v2ray_conf_dir
|
||||
|
@ -810,13 +799,10 @@ delete_tls_key_and_crt(){
|
|||
echo -e "${OK} ${GreenBG} 已清空证书遗留文件 ${Font}"
|
||||
}
|
||||
judge_mode() {
|
||||
if [ -f $v2ray_bin_dir/v2ray ]
|
||||
then
|
||||
if [[ -n $(grep "ws" $v2ray_qr_config_file) ]]
|
||||
then
|
||||
if [ -f $v2ray_bin_dir/v2ray ]; then
|
||||
if grep -q "ws" $v2ray_qr_config_file; then
|
||||
shell_mode="ws"
|
||||
elif [[ -n $(grep "h2" $v2ray_qr_config_file) ]]
|
||||
then
|
||||
elif grep -q "h2" $v2ray_qr_config_file; then
|
||||
shell_mode="h2"
|
||||
fi
|
||||
fi
|
||||
|
@ -832,7 +818,7 @@ install_v2ray_ws_tls(){
|
|||
port_alterid_set
|
||||
v2ray_install
|
||||
port_exist_check 80
|
||||
port_exist_check ${port}
|
||||
port_exist_check "${port}"
|
||||
nginx_exist_check
|
||||
v2ray_conf_add_tls
|
||||
nginx_conf_add
|
||||
|
@ -859,7 +845,7 @@ install_v2_h2(){
|
|||
port_alterid_set
|
||||
v2ray_install
|
||||
port_exist_check 80
|
||||
port_exist_check ${port}
|
||||
port_exist_check "${port}"
|
||||
v2ray_conf_add_h2
|
||||
ssl_judge_and_install
|
||||
vmess_qr_config_h2
|
||||
|
@ -874,8 +860,7 @@ update_sh(){
|
|||
ol_version=$(curl -L -s https://raw.githubusercontent.com/wulabing/V2Ray_ws-tls_bash_onekey/${github_branch}/install.sh | grep "shell_version=" | head -1 | awk -F '=|"' '{print $3}')
|
||||
echo "$ol_version" >$version_cmp
|
||||
echo "$shell_version" >>$version_cmp
|
||||
if [[ "$shell_version" < "$(sort -rV $version_cmp | head -1)" ]]
|
||||
then
|
||||
if [[ "$shell_version" < "$(sort -rV $version_cmp | head -1)" ]]; then
|
||||
echo -e "${OK} ${GreenBG} 存在新版本,是否更新 [Y/N]? ${Font}"
|
||||
read -r update_confirm
|
||||
case $update_confirm in
|
||||
|
@ -884,8 +869,8 @@ update_sh(){
|
|||
echo -e "${OK} ${GreenBG} 更新完成 ${Font}"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
*) ;;
|
||||
|
||||
esac
|
||||
else
|
||||
echo -e "${OK} ${GreenBG} 当前版本为最新版本 ${Font}"
|
||||
|
@ -947,7 +932,7 @@ menu(){
|
|||
echo -e "${Green}16.${Font} 清空 证书遗留文件"
|
||||
echo -e "${Green}17.${Font} 退出 \n"
|
||||
|
||||
read -p "请输入数字:" menu_num
|
||||
read -rp "请输入数字:" menu_num
|
||||
case $menu_num in
|
||||
0)
|
||||
update_sh
|
||||
|
@ -964,22 +949,20 @@ menu(){
|
|||
bash <(curl -L -s https://install.direct/go.sh)
|
||||
;;
|
||||
4)
|
||||
read -p "请输入UUID:" UUID
|
||||
read -rp "请输入UUID:" UUID
|
||||
modify_UUID
|
||||
start_process_systemd
|
||||
;;
|
||||
5)
|
||||
read -p "请输入alterID:" alterID
|
||||
read -rp "请输入alterID:" alterID
|
||||
modify_alterid
|
||||
start_process_systemd
|
||||
;;
|
||||
6)
|
||||
read -p "请输入连接端口:" port
|
||||
if [[ -n $(grep "ws" $v2ray_qr_config_file) ]]
|
||||
then
|
||||
read -rp "请输入连接端口:" port
|
||||
if grep -q "ws" $v2ray_qr_config_file; then
|
||||
modify_nginx_port
|
||||
elif [[ -n $(grep "h2" $v2ray_qr_config_file) ]]
|
||||
then
|
||||
elif grep -q "h2" $v2ray_qr_config_file; then
|
||||
modify_inbound_port
|
||||
fi
|
||||
start_process_systemd
|
||||
|
@ -1028,5 +1011,4 @@ menu(){
|
|||
}
|
||||
|
||||
judge_mode
|
||||
list $1
|
||||
|
||||
list "$1"
|
||||
|
|
Loading…
Reference in New Issue