feat(脚本): 增加邮箱无法通过SSL厂商验证检测、兼容buypass 180天有效期检查
parent
a2155a8fc8
commit
7b5b9e48f0
43
install.sh
43
install.sh
|
@ -199,6 +199,9 @@ initVar() {
|
|||
|
||||
# ssl邮箱
|
||||
sslEmail=
|
||||
|
||||
# 检查天数
|
||||
sslRenewalDays=90
|
||||
}
|
||||
|
||||
# 检测安装方式
|
||||
|
@ -1020,6 +1023,15 @@ checkIP() {
|
|||
}
|
||||
# 自定义email
|
||||
customSSLEmail() {
|
||||
if echo "$1" | grep -q "validate email"; then
|
||||
read -r -p "是否重新输入邮箱地址[y/n]:" sslEmailStatus
|
||||
if [[ "${sslEmailStatus}" == "y" ]]; then
|
||||
sed '/ACCOUNT_EMAIL/d' /root/.acme.sh/account.conf >/root/.acme.sh/account.conf_tmp && mv /root/.acme.sh/account.conf_tmp /root/.acme.sh/account.conf
|
||||
else
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -d "/root/.acme.sh" && -f "/root/.acme.sh/account.conf" ]]; then
|
||||
if ! grep -q "ACCOUNT_EMAIL" <"/root/.acme.sh/account.conf" && ! echo "${sslType}" | grep -q "letsencrypt"; then
|
||||
read -r -p "请输入邮箱地址:" sslEmail
|
||||
|
@ -1031,7 +1043,6 @@ customSSLEmail() {
|
|||
customSSLEmail
|
||||
fi
|
||||
fi
|
||||
echo
|
||||
fi
|
||||
|
||||
}
|
||||
|
@ -1058,6 +1069,8 @@ switchSSLType() {
|
|||
sslType="letsencrypt"
|
||||
;;
|
||||
esac
|
||||
touch /etc/v2ray-agent/tls
|
||||
echo "${sslType}" >/etc/v2ray-agent/tls/ssl_type
|
||||
fi
|
||||
}
|
||||
# 安装TLS
|
||||
|
@ -1088,9 +1101,9 @@ installTLS() {
|
|||
customSSLEmail
|
||||
|
||||
if echo "${localIP}" | grep -q ":"; then
|
||||
sudo "$HOME/.acme.sh/acme.sh" --issue -d "${tlsDomain}" --standalone -k ec-256 --server "${sslType}" --listen-v6 | 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}" --listen-v6 2>&1 | tee -a /etc/v2ray-agent/tls/acme.log >/dev/null
|
||||
else
|
||||
sudo "$HOME/.acme.sh/acme.sh" --issue -d "${tlsDomain}" --standalone -k ec-256 --server "${sslType}" | 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}" 2>&1 | tee -a /etc/v2ray-agent/tls/acme.log >/dev/null
|
||||
fi
|
||||
|
||||
if [[ -d "$HOME/.acme.sh/${tlsDomain}_ecc" && -f "$HOME/.acme.sh/${tlsDomain}_ecc/${tlsDomain}.key" && -f "$HOME/.acme.sh/${tlsDomain}_ecc/${tlsDomain}.cer" ]]; then
|
||||
|
@ -1102,11 +1115,21 @@ installTLS() {
|
|||
echoContent red " ---> TLS安装失败,请检查acme日志"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
installTLSCount=1
|
||||
echo
|
||||
echoContent red " ---> TLS安装失败,正在检查80、443端口是否开放"
|
||||
allowPort 80
|
||||
allowPort 443
|
||||
echoContent yellow " ---> 重新尝试安装TLS证书"
|
||||
installTLSCount=1
|
||||
|
||||
if tail -n 10 /etc/v2ray-agent/tls/acme.log | grep -q "Could not validate email address as valid"; then
|
||||
echoContent red " ---> 邮箱无法通过SSL厂商验证,请重新输入"
|
||||
echo
|
||||
customSSLEmail "validate email"
|
||||
installTLS "$1"
|
||||
fi
|
||||
|
||||
installTLS "$1"
|
||||
fi
|
||||
echoContent green " ---> TLS生成成功"
|
||||
|
@ -1261,6 +1284,12 @@ renewalTLS() {
|
|||
domain=${tlsDomain}
|
||||
fi
|
||||
|
||||
if [[ -f "/etc/v2ray-agent/tls/ssl_type" ]]; then
|
||||
if grep -q "buypass" <"/etc/v2ray-agent/tls/ssl_type"; then
|
||||
sslRenewalDays=180
|
||||
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}')
|
||||
|
||||
|
@ -1268,7 +1297,7 @@ renewalTLS() {
|
|||
currentTime=$(date +%s)
|
||||
((stampDiff = currentTime - modifyTime))
|
||||
((days = stampDiff / 86400))
|
||||
((remainingDays = 90 - days))
|
||||
((remainingDays = sslRenewalDays - days))
|
||||
|
||||
tlsStatus=${remainingDays}
|
||||
if [[ ${remainingDays} -le 0 ]]; then
|
||||
|
@ -1305,7 +1334,7 @@ checkTLStatus() {
|
|||
currentTime=$(date +%s)
|
||||
((stampDiff = currentTime - modifyTime))
|
||||
((days = stampDiff / 86400))
|
||||
((remainingDays = 90 - days))
|
||||
((remainingDays = sslRenewalDays - days))
|
||||
|
||||
tlsStatus=${remainingDays}
|
||||
if [[ ${remainingDays} -le 0 ]]; then
|
||||
|
@ -4784,7 +4813,7 @@ menu() {
|
|||
cd "$HOME" || exit
|
||||
echoContent red "\n=============================================================="
|
||||
echoContent green "作者:mack-a"
|
||||
echoContent green "当前版本:v2.5.77"
|
||||
echoContent green "当前版本:v2.5.78"
|
||||
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
|
||||
echoContent green "描述:八合一共存脚本\c"
|
||||
showInstallStatus
|
||||
|
|
Loading…
Reference in New Issue