From 7c2aaa0293ff9412659c54b13e9d191face1fa16 Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Sun, 2 Oct 2022 20:50:46 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=84=9A=E6=9C=AC):=20dns=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E8=AF=81=E4=B9=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 3e770f6..2795fcd 100644 --- a/install.sh +++ b/install.sh @@ -208,13 +208,15 @@ initVar() { # dns tls domain dnsTLSDomain= + + # + dnsTLSDomainStatus= } # 读取tls证书详情 readAcmeTLS() { - # todo if [[ -d "$HOME/.acme.sh/*.${dnsTLSDomain}_ecc" && -f "$HOME/.acme.sh/*.${dnsTLSDomain}_ecc/*.${dnsTLSDomain}.key" && -f "$HOME/.acme.sh/*.${dnsTLSDomain}_ecc/*.${dnsTLSDomain}.cer" ]]; then - dnsTLSDomain=true + dnsTLSDomainStatus=true fi } # 检测安装方式 @@ -847,6 +849,8 @@ EOF handleNginx start checkIP fi + + readAcmeTLS } # 修改nginx重定向配置 @@ -1168,6 +1172,7 @@ installTLS() { switchSSLType customSSLEmail + ## todo 添加证书已安装判断 acmeInstallSSL if [[ "${dnsSSLStatus}" == "true" ]]; then @@ -1363,8 +1368,15 @@ renewalTLS() { fi fi - if [[ -d "$HOME/.acme.sh/${domain}_ecc" ]] && [[ -f "$HOME/.acme.sh/${domain}_ecc/${domain}.key" ]] && [[ -f "$HOME/.acme.sh/${domain}_ecc/${domain}.cer" ]]; then - modifyTime=$(stat "$HOME/.acme.sh/${domain}_ecc/${domain}.cer" | sed -n '7,6p' | awk '{print $2" "$3" "$4" "$5}') + if [[ -d "$HOME/.acme.sh/${domain}_ecc" && -f "$HOME/.acme.sh/${domain}_ecc/${domain}.key" && -f "$HOME/.acme.sh/${domain}_ecc/${domain}.cer" ]] || [[ "${dnsTLSDomainStatus}" == "true" ]]; then + modifyTime= + + if [[ "${dnsTLSDomainStatus}" == "true" ]]; then + modifyTime=$(stat "$HOME/.acme.sh/*.${dnsTLSDomain}_ecc/*.${dnsTLSDomain}.cer" | sed -n '7,6p' | awk '{print $2" "$3" "$4" "$5}') + else + modifyTime=$(stat "$HOME/.acme.sh/${domain}_ecc/${domain}.cer" | sed -n '7,6p' | awk '{print $2" "$3" "$4" "$5}') + fi + modifyTime=$(date +%s -d "${modifyTime}") currentTime=$(date +%s)