From 2ee0bf086e65422f5d4b8374f55515468aacc573 Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Thu, 12 Aug 2021 15:33:32 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=84=9A=E6=9C=AC):=20tls=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=A4=B1=E8=B4=A5=E6=97=B6=EF=BC=8C=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E9=98=B2=E7=81=AB=E5=A2=99=E5=B9=B6=E5=85=B3?= =?UTF-8?q?=E9=97=AD=E5=90=8E=E9=87=8D=E6=96=B0=E5=B0=9D=E8=AF=95=E5=AE=89?= =?UTF-8?q?=E8=A3=85tls=E3=80=81=E4=BF=AE=E6=94=B9ipv6=E5=9F=9F=E5=90=8Dip?= =?UTF-8?q?=E9=98=B2=E5=91=86=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 55852ff..bda492f 100644 --- a/install.sh +++ b/install.sh @@ -179,6 +179,9 @@ initVar() { # 集成更新证书逻辑不再使用单独的脚本--RenewTLS renewTLS=$1 + + # tls安装失败后尝试的次数 + installTLSCount= } # 检测安装方式 @@ -823,7 +826,7 @@ checkIP() { if [[ "${pingIP}" == "null" ]]; then echoContent skyBlue " ---> 检查ipv6中" local pingIP=$(curl -s -H 'accept:application/dns-json' 'https://cloudflare-dns.com/dns-query?name='${domain}'&type=AAAA' | jq -r ".Answer") - if [[ "${pingIP}" -ne "null" ]];then + if [[ "${pingIP}" != "null" ]];then pingIP=$(echo "${pingIP}"|jq -r ".[]|select(.type==28)|.data") pingIPv6=${pingIP} fi @@ -886,11 +889,17 @@ installTLS() { if [[ -d "$HOME/.acme.sh/${tlsDomain}_ecc" && -f "$HOME/.acme.sh/${tlsDomain}_ecc/${tlsDomain}.key" && -f "$HOME/.acme.sh/${tlsDomain}_ecc/${tlsDomain}.cer" ]]; then sudo "$HOME/.acme.sh/acme.sh" --installcert -d "${tlsDomain}" --fullchainpath "/etc/v2ray-agent/tls/${tlsDomain}.crt" --keypath "/etc/v2ray-agent/tls/${tlsDomain}.key" --ecc >/dev/null fi - if [[ ! -f "/etc/v2ray-agent/tls/${tlsDomain}.crt" || ! -f "/etc/v2ray-agent/tls/${tlsDomain}.key" ]] || [[ -z $(cat "/etc/v2ray-agent/tls/${tlsDomain}.key") || -z $(cat "/etc/v2ray-agent/tls/${tlsDomain}.crt") ]]; then tail -n 10 /etc/v2ray-agent/tls/acme.log - echoContent red " ---> TLS安装失败,请检查acme日志" - exit 0 + if [[ ${installTLSCount} == "1" ]];then + echoContent red " ---> TLS安装失败,请检查acme日志" + exit 0 + fi + echoContent red " ---> TLS安装失败,检查防火墙中" + handleFirewall stop + echoContent yellow " ---> 重新尝试安装TLS证书" + installTLSCount=1 + installTLS "$1" fi echoContent green " ---> TLS生成成功" else @@ -3229,6 +3238,22 @@ updateV2RayAgent() { exit 0 } +# 防火墙 +handleFirewall(){ + if systemctl status ufw 2>/dev/null|grep -q "active (exited)" && [[ "$1" == "stop" ]]; then + systemctl stop ufw >/dev/null 2>&1 + systemctl disable ufw >/dev/null 2>&1 + echoContent green " ---> ufw关闭成功" + + fi + + if systemctl status firewalld 2>/dev/null|grep -q "active (running)" && [[ "$1" == "stop" ]]; then + systemctl stop firewalld >/dev/null 2>&1 + systemctl disable firewalld >/dev/null 2>&1 + echoContent green " ---> firewalld关闭成功" + fi +} + # 安装BBR bbrInstall() { echoContent red "\n==============================================================" @@ -4326,7 +4351,7 @@ menu() { cd "$HOME" || exit echoContent red "\n==============================================================" echoContent green "作者:mack-a" - echoContent green "当前版本:v2.5.21" + echoContent green "当前版本:v2.5.22" echoContent green "Github:https://github.com/mack-a/v2ray-agent" echoContent green "描述:八合一共存脚本\c" showInstallStatus