Skip to content

Commit

Permalink
feat(脚本): dns申请证书
Browse files Browse the repository at this point in the history
  • Loading branch information
mack-a committed Oct 2, 2022
1 parent 14ec7d1 commit 3792552
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
# 检测安装方式
Expand Down Expand Up @@ -847,6 +849,8 @@ EOF
handleNginx start
checkIP
fi

readAcmeTLS
}

# 修改nginx重定向配置
Expand Down Expand Up @@ -1168,6 +1172,7 @@ installTLS() {

switchSSLType
customSSLEmail
## todo 添加证书已安装判断
acmeInstallSSL

if [[ "${dnsSSLStatus}" == "true" ]]; then
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3792552

Please sign in to comment.