feat(tmp): tmp路径全部换成永久路径
parent
9f3d1c8747
commit
77d56d4b83
85
install.sh
85
install.sh
|
@ -199,8 +199,8 @@ installTools(){
|
||||||
mkdirTools
|
mkdirTools
|
||||||
|
|
||||||
progressTools "yellow" "检查、安装acme--->" 13
|
progressTools "yellow" "检查、安装acme--->" 13
|
||||||
mkdir -p /tmp/tls/
|
mkdir -p /etc/tls/
|
||||||
curl -s https://get.acme.sh | sh > /tmp/tls/acme.log
|
curl -s https://get.acme.sh | sh > /etc/tls/acme.log
|
||||||
if [[ -z `find ~/.acme.sh -name "acme.sh"` ]]
|
if [[ -z `find ~/.acme.sh -name "acme.sh"` ]]
|
||||||
then
|
then
|
||||||
echoContent red " acme安装失败--->"
|
echoContent red " acme安装失败--->"
|
||||||
|
@ -251,9 +251,9 @@ installNginx(){
|
||||||
# 安装TLS
|
# 安装TLS
|
||||||
installTLS(){
|
installTLS(){
|
||||||
mkdir -p /etc/nginx/v2ray-agent-https/
|
mkdir -p /etc/nginx/v2ray-agent-https/
|
||||||
|
mkdir -p /etc/v2ray-agent/tls/
|
||||||
touch /etc/nginx/v2ray-agent-https/config
|
touch /etc/nginx/v2ray-agent-https/config
|
||||||
|
if [[ -z `find /etc/v2ray-agent/tls/ -name "$1*"` ]]
|
||||||
if [[ -z `find /tmp -name "$1*"` ]]
|
|
||||||
then
|
then
|
||||||
progressTools "yellow" "检查、安装TLS证书--->" 16
|
progressTools "yellow" "检查、安装TLS证书--->" 16
|
||||||
|
|
||||||
|
@ -272,20 +272,20 @@ installTLS(){
|
||||||
|
|
||||||
echo $1 `date +%s` > /etc/nginx/v2ray-agent-https/config
|
echo $1 `date +%s` > /etc/nginx/v2ray-agent-https/config
|
||||||
|
|
||||||
cp -R /etc/nginx/v2ray-agent-https/config /tmp/tls/config
|
cp -R /etc/nginx/v2ray-agent-https/config /etc/v2ray-agent/tls/config
|
||||||
cp -R /etc/nginx/v2ray-agent-https/$1.crt /tmp/tls/$1.crt
|
cp -R /etc/nginx/v2ray-agent-https/$1.crt /etc/v2ray-agent/tls/$1.crt
|
||||||
cp -R /etc/nginx/v2ray-agent-https/$1.key /tmp/tls/$1.key
|
cp -R /etc/nginx/v2ray-agent-https/$1.key /etc/v2ray-agent/tls/$1.key
|
||||||
progressTools "yellow" " TLS证书备份成功,证书位置:/tmp/tls--->"
|
progressTools "yellow" " TLS证书备份成功,证书位置:/etc/v2ray-agent/tls--->"
|
||||||
elif [[ -z `cat /tmp/tls/$1.crt` ]] || [[ -z `cat /tmp/tls/$1.key` ]]
|
elif [[ -z `cat /etc/v2ray-agent/tls/$1.crt` ]] || [[ -z `cat /etc/v2ray-agent/tls/$1.key` ]]
|
||||||
then
|
then
|
||||||
progressTools "red" " 检测到错误证书,需重新生成,重新生成中--->" 17
|
progressTools "red" " 检测到错误证书,需重新生成,重新生成中--->" 17
|
||||||
rm -rf /tmp/tls
|
rm -rf /etc/v2ray-agent/tls/
|
||||||
installTLS $1
|
installTLS $1
|
||||||
else
|
else
|
||||||
progressTools "yellow" "检测到备份证书,使用--->"
|
progressTools "yellow" "检测到备份证书,使用--->"
|
||||||
cp -R /tmp/tls/$1.crt /etc/nginx/v2ray-agent-https/$1.crt
|
cp -R /etc/v2ray-agent/tls/$1.crt /etc/nginx/v2ray-agent-https/$1.crt
|
||||||
cp -R /tmp/tls/$1.key /etc/nginx/v2ray-agent-https/$1.key
|
cp -R /etc/v2ray-agent/tls/$1.key /etc/nginx/v2ray-agent-https/$1.key
|
||||||
cp -R /tmp/tls/config /etc/nginx/v2ray-agent-https/config
|
cp -R /etc/v2ray-agent/tls/config /etc/nginx/v2ray-agent-https/config
|
||||||
fi
|
fi
|
||||||
# nginxInstallLine=`cat /etc/nginx/nginx.conf|grep -n "}"|awk -F "[:]" 'END{print $1-1}'`
|
# nginxInstallLine=`cat /etc/nginx/nginx.conf|grep -n "}"|awk -F "[:]" 'END{print $1-1}'`
|
||||||
# sed -i "${nginxInstallLine}i server {listen 443 ssl;server_name $1;root /usr/share/nginx/html;ssl_certificate /etc/nginx/$1.crt;ssl_certificate_key /etc/nginx/$1.key;ssl_protocols TLSv1 TLSv1.1 TLSv1.2;ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;ssl_prefer_server_ciphers on;location / {} location /alone { proxy_redirect off;proxy_pass http://127.0.0.1:31299;proxy_http_version 1.1;proxy_set_header Upgrade \$http_upgrade;proxy_set_header Connection "upgrade";proxy_set_header X-Real-IP \$remote_addr;proxy_set_header Host \$host;proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;}}" /etc/nginx/nginx.conf
|
# sed -i "${nginxInstallLine}i server {listen 443 ssl;server_name $1;root /usr/share/nginx/html;ssl_certificate /etc/nginx/$1.crt;ssl_certificate_key /etc/nginx/$1.key;ssl_protocols TLSv1 TLSv1.1 TLSv1.2;ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;ssl_prefer_server_ciphers on;location / {} location /alone { proxy_redirect off;proxy_pass http://127.0.0.1:31299;proxy_http_version 1.1;proxy_set_header Upgrade \$http_upgrade;proxy_set_header Connection "upgrade";proxy_set_header X-Real-IP \$remote_addr;proxy_set_header Host \$host;proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;}}" /etc/nginx/nginx.conf
|
||||||
|
@ -322,7 +322,7 @@ reInstallTLS(){
|
||||||
progressTools "yellow" "检查、添加定时维护证书--->" 18
|
progressTools "yellow" "检查、添加定时维护证书--->" 18
|
||||||
touch /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
touch /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
||||||
touch /etc/nginx/v2ray-agent-https/backup_crontab.cron
|
touch /etc/nginx/v2ray-agent-https/backup_crontab.cron
|
||||||
touch /tmp/tls/tls.log
|
touch /etc/v2ray-agent/tls/tls.log
|
||||||
if [[ -z `crontab -l|grep -v grep|grep 'reloadInstallTLS'` ]]
|
if [[ -z `crontab -l|grep -v grep|grep 'reloadInstallTLS'` ]]
|
||||||
then
|
then
|
||||||
crontab -l >> /etc/nginx/v2ray-agent-https/backup_crontab.cron
|
crontab -l >> /etc/nginx/v2ray-agent-https/backup_crontab.cron
|
||||||
|
@ -336,9 +336,9 @@ reInstallTLS(){
|
||||||
echo "#!/usr/bin/env bash" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
echo "#!/usr/bin/env bash" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
||||||
echo "domain=${domain}" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
echo "domain=${domain}" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
||||||
echo "eccPath=\`find ~/.acme.sh -name \"\${domain}_ecc\"|head -1\`" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
echo "eccPath=\`find ~/.acme.sh -name \"\${domain}_ecc\"|head -1\`" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
||||||
echo "mkdir -p /tmp/tls" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
echo "mkdir -p /etc/v2ray-agent/tls" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
||||||
echo "touch /tmp/tls/tls.log" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
echo "touch /etc/v2ray-agent/tls/tls.log" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
||||||
echo "touch /tmp/tls/acme.log" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
echo "touch /etc/v2ray-agent/tls/acme.log" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
||||||
echo "if [[ ! -z \${eccPath} ]]" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
echo "if [[ ! -z \${eccPath} ]]" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
||||||
echo "then" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
echo "then" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
||||||
echo "modifyTime=\`stat \${eccPath}/\${domain}.key|sed -n '6,6p'|awk '{print \$2\" \"\$3\" \"\$4\" \"\$5}'\`" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
echo "modifyTime=\`stat \${eccPath}/\${domain}.key|sed -n '6,6p'|awk '{print \$2\" \"\$3\" \"\$4\" \"\$5}'\`" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
||||||
|
@ -357,7 +357,7 @@ reInstallTLS(){
|
||||||
echo "fi" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
echo "fi" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
||||||
echo "echo \"域名:\${domain},modifyTime:\"\`date -d @\${modifyTime} +\"%F %H:%M:%S\"\`,\"检查时间:\"\`date -d @\${currentTime} +\"%F %H:%M:%S\"\`,"上次生成证书的时:"\`expr \${minutes} / 1440\`\"天前\",\"证书状态:\"\${status},\"重新生成日期:\"\${reloadTime} >> /tmp/tls/tls.log" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
echo "echo \"域名:\${domain},modifyTime:\"\`date -d @\${modifyTime} +\"%F %H:%M:%S\"\`,\"检查时间:\"\`date -d @\${currentTime} +\"%F %H:%M:%S\"\`,"上次生成证书的时:"\`expr \${minutes} / 1440\`\"天前\",\"证书状态:\"\${status},\"重新生成日期:\"\${reloadTime} >> /tmp/tls/tls.log" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
||||||
echo "else" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
echo "else" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
||||||
echo "echo '无法找到证书路径' >> /tmp/tls/tls.log" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
echo "echo '无法找到证书路径' >> /etc/v2ray-agent/tls/tls.log" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
||||||
echo "fi" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
echo "fi" >> /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
|
||||||
|
|
||||||
if [[ ! -z `crontab -l|grep -v grep|grep 'reloadInstallTLS'` ]]
|
if [[ ! -z `crontab -l|grep -v grep|grep 'reloadInstallTLS'` ]]
|
||||||
|
@ -374,7 +374,8 @@ reInstallTLS(){
|
||||||
installV2Ray(){
|
installV2Ray(){
|
||||||
# ls -F /usr/bin/v2ray/|grep "v2ray"
|
# ls -F /usr/bin/v2ray/|grep "v2ray"
|
||||||
mkdir -p /usr/bin/v2ray/
|
mkdir -p /usr/bin/v2ray/
|
||||||
if [[ -z `ls -F /tmp/v2ray/|grep "v2ray"` ]] || [[ -z `ls -F /tmp/v2ray/|grep "v2ctl"` ]]
|
mkdir -p /etc/v2ray-agent/v2ray/
|
||||||
|
if [[ -z `ls -F /etc/v2ray-agent/v2ray/|grep "v2ray"` ]] || [[ -z `ls -F /etc/v2ray-agent/v2ray/|grep "v2ctl"` ]]
|
||||||
then
|
then
|
||||||
if [[ -z `ls -F /usr/bin/v2ray/|grep "v2ray"` ]] || [[ -z `ls -F /usr/bin/v2ray/|grep "v2ctl"` ]]
|
if [[ -z `ls -F /usr/bin/v2ray/|grep "v2ray"` ]] || [[ -z `ls -F /usr/bin/v2ray/|grep "v2ctl"` ]]
|
||||||
then
|
then
|
||||||
|
@ -382,14 +383,14 @@ installV2Ray(){
|
||||||
version=`curl -s https://github.com/v2ray/v2ray-core/releases|grep /v2ray/v2ray-core/releases/tag/|head -1|awk -F "[/]" '{print $6}'|awk -F "[>]" '{print $2}'|awk -F "[<]" '{print $1}'`
|
version=`curl -s https://github.com/v2ray/v2ray-core/releases|grep /v2ray/v2ray-core/releases/tag/|head -1|awk -F "[/]" '{print $6}'|awk -F "[>]" '{print $2}'|awk -F "[<]" '{print $1}'`
|
||||||
progressTools "green" " v2ray-core版本:${version}"
|
progressTools "green" " v2ray-core版本:${version}"
|
||||||
|
|
||||||
wget -q -P /tmp/v2ray https://github.com/v2fly/v2ray-core/releases/download/${version}/v2ray-linux-64.zip
|
wget -q -P /etc/v2ray-agent/v2ray https://github.com/v2fly/v2ray-core/releases/download/${version}/v2ray-linux-64.zip
|
||||||
unzip /tmp/v2ray/v2ray-linux-64.zip -d /tmp/v2ray > /dev/null
|
unzip /etc/v2ray-agent/v2ray/v2ray-linux-64.zip -d /etc/v2ray-agent/v2ray > /dev/null
|
||||||
cp /tmp/v2ray/v2ray /usr/bin/v2ray/v2ray && cp /tmp/v2ray/v2ctl /usr/bin/v2ray/v2ctl
|
cp /etc/v2ray-agent/v2ray/v2ray /usr/bin/v2ray/v2ray && cp /etc/v2ray-agent/v2ray/v2ctl /usr/bin/v2ray/v2ctl
|
||||||
rm -rf /tmp/v2ray/v2ray-linux-64.zip
|
rm -rf /etc/v2ray-agent/v2ray/v2ray-linux-64.zip
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
progressTools "green" " v2ray-core版本:`/tmp/v2ray/v2ray --version|awk '{print $2}'|head -1`"
|
progressTools "green" " v2ray-core版本:`/etc/v2ray-agent/v2ray/v2ray --version|awk '{print $2}'|head -1`"
|
||||||
cp /tmp/v2ray/v2ray /usr/bin/v2ray/v2ray && cp /tmp/v2ray/v2ctl /usr/bin/v2ray/v2ctl
|
cp /etc/v2ray-agent/v2ray/v2ray /usr/bin/v2ray/v2ray && cp /etc/v2ray-agent/v2ray/v2ctl /usr/bin/v2ray/v2ctl
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -z `find /bin /usr/bin -name "systemctl"` ]]
|
if [[ ! -z `find /bin /usr/bin -name "systemctl"` ]]
|
||||||
|
@ -538,14 +539,6 @@ qrEncode(){
|
||||||
# | qrencode -t UTF8
|
# | qrencode -t UTF8
|
||||||
# echo ${qrCodeBase64}
|
# echo ${qrCodeBase64}
|
||||||
}
|
}
|
||||||
# 查看dns解析ip
|
|
||||||
checkDNS(){
|
|
||||||
echo '' > /tmp/pingLog
|
|
||||||
ping -c 3 $1 >> /tmp/pingLog
|
|
||||||
serverStatus=`ping -c 3 $1|head -1|awk -F "[service]" '{print $1}'`
|
|
||||||
pingLog=`ping -c 3 $1|tail -n 5|head -1|awk -F "[ ]" '{print $4 $7}'`
|
|
||||||
echoContent skyBlue "DNS解析ip:"${pingLog}
|
|
||||||
}
|
|
||||||
# 查看本机ip
|
# 查看本机ip
|
||||||
checkDomainIP(){
|
checkDomainIP(){
|
||||||
currentIP=`curl -s ifconfig.me|awk '{print}'`
|
currentIP=`curl -s ifconfig.me|awk '{print}'`
|
||||||
|
@ -613,8 +606,8 @@ installProgressFunction(){
|
||||||
|
|
||||||
# 卸载安装的内容
|
# 卸载安装的内容
|
||||||
removeInstall(){
|
removeInstall(){
|
||||||
rm -rf /tmp/v2ray
|
rm -rf /etc/v2ray-agent/v2ray
|
||||||
rm -rf /tmp/tls
|
rm -rf /etc/v2ray-agent/tls
|
||||||
rm -rf /etc/v2ray
|
rm -rf /etc/v2ray
|
||||||
rm -rf /root/.acme.sh
|
rm -rf /root/.acme.sh
|
||||||
echo ${removeType},${installType}
|
echo ${removeType},${installType}
|
||||||
|
@ -625,18 +618,12 @@ init(){
|
||||||
mkdirTools
|
mkdirTools
|
||||||
cd
|
cd
|
||||||
echoContent red "=============================================================="
|
echoContent red "=============================================================="
|
||||||
echoContent red "脚本概述"
|
echoContent green "CDN+WebSocket+TLS+Nginx+伪装博客一键脚本"
|
||||||
echoContent green "欢迎使用Cloudflare+WebSocket+TLS+Nginx+伪装博客 一键脚本"
|
echoContent green "作者:mack-a"
|
||||||
echo
|
|
||||||
echoContent green "作者:mack-a [https://t.me/mack_a]"
|
|
||||||
echo
|
|
||||||
echoContent green "Version:v1.0.6"
|
echoContent green "Version:v1.0.6"
|
||||||
echo
|
|
||||||
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
|
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
|
||||||
echo
|
echoContent green "TG群:https://t.me/technologyshare"
|
||||||
echoContent green "TG:https://t.me/technologyshare"
|
echoContent green "欢迎找我请求协助与反馈问题"
|
||||||
echo
|
|
||||||
echoContent green "如遇到解决不了的问题可以提issues或者直接私聊作者,欢迎聊骚"
|
|
||||||
echoContent red "=============================================================="
|
echoContent red "=============================================================="
|
||||||
echoContent red "状态展示"
|
echoContent red "状态展示"
|
||||||
echoContent green "已安装账号:"
|
echoContent green "已安装账号:"
|
||||||
|
@ -687,8 +674,8 @@ init(){
|
||||||
then
|
then
|
||||||
echoContent yellow " 定时更新tls脚本路径:/etc/nginx/v2ray-agent-https/reloadInstallTLS.sh"
|
echoContent yellow " 定时更新tls脚本路径:/etc/nginx/v2ray-agent-https/reloadInstallTLS.sh"
|
||||||
echoContent yellow " 定时任务文件路径:/etc/nginx/v2ray-agent-https/backup_crontab.cron"
|
echoContent yellow " 定时任务文件路径:/etc/nginx/v2ray-agent-https/backup_crontab.cron"
|
||||||
echoContent yellow " 定时任务日志路径:/tmp/tls/tls.log"
|
echoContent yellow " 定时任务日志路径:/etc/v2ray-agent/tls/tls.log"
|
||||||
echoContent yellow " acme.sh日志路径:/tmp/tls/acme.log"
|
echoContent yellow " acme.sh日志路径:/etc/v2ray-agent/tls/acme.log"
|
||||||
else
|
else
|
||||||
echoContent yellow " 暂未安装或未使用最新的脚本安装"
|
echoContent yellow " 暂未安装或未使用最新的脚本安装"
|
||||||
fi
|
fi
|
||||||
|
@ -755,8 +742,8 @@ init(){
|
||||||
elif [[ "${installStatus}" = "2" ]]
|
elif [[ "${installStatus}" = "2" ]]
|
||||||
then
|
then
|
||||||
rm -rf /usr/bin/v2ray
|
rm -rf /usr/bin/v2ray
|
||||||
rm -rf /tmp/v2ray
|
rm -rf /etc/v2ray-agent/v2ray
|
||||||
rm -rf /tmp/tls
|
rm -rf /etc/v2ray-agent/tls
|
||||||
rm -rf /etc/v2ray
|
rm -rf /etc/v2ray
|
||||||
installTools
|
installTools
|
||||||
installNginx
|
installNginx
|
||||||
|
|
Loading…
Reference in New Issue