mirror of https://github.com/mack-a/v2ray-agent
feat(脚本): 完善dns申请证书
parent
7c2aaa0293
commit
a527e20aec
22
install.sh
22
install.sh
|
@ -209,14 +209,14 @@ initVar() {
|
||||||
# dns tls domain
|
# dns tls domain
|
||||||
dnsTLSDomain=
|
dnsTLSDomain=
|
||||||
|
|
||||||
#
|
# 该域名是否通过dns安装通配符证书
|
||||||
dnsTLSDomainStatus=
|
installDNSACMEStatus=
|
||||||
}
|
}
|
||||||
|
|
||||||
# 读取tls证书详情
|
# 读取tls证书详情
|
||||||
readAcmeTLS() {
|
readAcmeTLS() {
|
||||||
if [[ -d "$HOME/.acme.sh/*.${dnsTLSDomain}_ecc" && -f "$HOME/.acme.sh/*.${dnsTLSDomain}_ecc/*.${dnsTLSDomain}.key" && -f "$HOME/.acme.sh/*.${dnsTLSDomain}_ecc/*.${dnsTLSDomain}.cer" ]]; then
|
if [[ -d "$HOME/.acme.sh/*.${dnsTLSDomain}_ecc" && -f "$HOME/.acme.sh/*.${dnsTLSDomain}_ecc/*.${dnsTLSDomain}.key" && -f "$HOME/.acme.sh/*.${dnsTLSDomain}_ecc/*.${dnsTLSDomain}.cer" ]]; then
|
||||||
dnsTLSDomainStatus=true
|
installDNSACMEStatus=true
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# 检测安装方式
|
# 检测安装方式
|
||||||
|
@ -1123,6 +1123,7 @@ acmeInstallSSL() {
|
||||||
echoContent green " ---> name:_acme-challenge"
|
echoContent green " ---> name:_acme-challenge"
|
||||||
echoContent green " ---> value:${txtValue}"
|
echoContent green " ---> value:${txtValue}"
|
||||||
echoContent yellow " ---> 添加完成后等请等待1-2分钟"
|
echoContent yellow " ---> 添加完成后等请等待1-2分钟"
|
||||||
|
echo
|
||||||
read -r -p "是否添加完成[y/n]:" addDNSTXTRecordStatus
|
read -r -p "是否添加完成[y/n]:" addDNSTXTRecordStatus
|
||||||
if [[ "${addDNSTXTRecordStatus}" == "y" ]]; then
|
if [[ "${addDNSTXTRecordStatus}" == "y" ]]; then
|
||||||
local txtAnswer=
|
local txtAnswer=
|
||||||
|
@ -1143,6 +1144,7 @@ acmeInstallSSL() {
|
||||||
else
|
else
|
||||||
sudo "$HOME/.acme.sh/acme.sh" --issue -d "${tlsDomain}" --standalone -k ec-256 --server "${sslType}" "${installSSLIPv6}" 2>&1 | tee -a /etc/v2ray-agent/tls/acme.log >/dev/null
|
sudo "$HOME/.acme.sh/acme.sh" --issue -d "${tlsDomain}" --standalone -k ec-256 --server "${sslType}" "${installSSLIPv6}" 2>&1 | tee -a /etc/v2ray-agent/tls/acme.log >/dev/null
|
||||||
fi
|
fi
|
||||||
|
readAcmeTLS
|
||||||
}
|
}
|
||||||
|
|
||||||
# 安装TLS
|
# 安装TLS
|
||||||
|
@ -1170,12 +1172,15 @@ installTLS() {
|
||||||
elif [[ -d "$HOME/.acme.sh" ]] && [[ ! -f "$HOME/.acme.sh/${tlsDomain}_ecc/${tlsDomain}.cer" || ! -f "$HOME/.acme.sh/${tlsDomain}_ecc/${tlsDomain}.key" ]]; then
|
elif [[ -d "$HOME/.acme.sh" ]] && [[ ! -f "$HOME/.acme.sh/${tlsDomain}_ecc/${tlsDomain}.cer" || ! -f "$HOME/.acme.sh/${tlsDomain}_ecc/${tlsDomain}.key" ]]; then
|
||||||
echoContent green " ---> 安装TLS证书"
|
echoContent green " ---> 安装TLS证书"
|
||||||
|
|
||||||
switchSSLType
|
if [[ "${installDNSACMEStatus}" != "true" ]]; then
|
||||||
customSSLEmail
|
switchSSLType
|
||||||
## todo 添加证书已安装判断
|
customSSLEmail
|
||||||
acmeInstallSSL
|
acmeInstallSSL
|
||||||
|
else
|
||||||
|
echoContent green " ---> 检测到已安装通配符证书,自动生成中"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "${dnsSSLStatus}" == "true" ]]; then
|
if [[ "${installDNSACMEStatus}" == "true" ]]; then
|
||||||
echo
|
echo
|
||||||
if [[ -d "$HOME/.acme.sh/*.${dnsTLSDomain}_ecc" && -f "$HOME/.acme.sh/*.${dnsTLSDomain}_ecc/*.${dnsTLSDomain}.key" && -f "$HOME/.acme.sh/*.${dnsTLSDomain}_ecc/*.${dnsTLSDomain}.cer" ]]; then
|
if [[ -d "$HOME/.acme.sh/*.${dnsTLSDomain}_ecc" && -f "$HOME/.acme.sh/*.${dnsTLSDomain}_ecc/*.${dnsTLSDomain}.key" && -f "$HOME/.acme.sh/*.${dnsTLSDomain}_ecc/*.${dnsTLSDomain}.cer" ]]; then
|
||||||
sudo "$HOME/.acme.sh/acme.sh" --installcert -d "*.${dnsTLSDomain}" --fullchainpath "/etc/v2ray-agent/tls/${tlsDomain}.crt" --keypath "/etc/v2ray-agent/tls/${tlsDomain}.key" --ecc >/dev/null
|
sudo "$HOME/.acme.sh/acme.sh" --installcert -d "*.${dnsTLSDomain}" --fullchainpath "/etc/v2ray-agent/tls/${tlsDomain}.crt" --keypath "/etc/v2ray-agent/tls/${tlsDomain}.key" --ecc >/dev/null
|
||||||
|
@ -1377,7 +1382,6 @@ renewalTLS() {
|
||||||
modifyTime=$(stat "$HOME/.acme.sh/${domain}_ecc/${domain}.cer" | sed -n '7,6p' | awk '{print $2" "$3" "$4" "$5}')
|
modifyTime=$(stat "$HOME/.acme.sh/${domain}_ecc/${domain}.cer" | sed -n '7,6p' | awk '{print $2" "$3" "$4" "$5}')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
modifyTime=$(date +%s -d "${modifyTime}")
|
modifyTime=$(date +%s -d "${modifyTime}")
|
||||||
currentTime=$(date +%s)
|
currentTime=$(date +%s)
|
||||||
((stampDiff = currentTime - modifyTime))
|
((stampDiff = currentTime - modifyTime))
|
||||||
|
|
Loading…
Reference in New Issue