mirror of https://github.com/mack-a/v2ray-agent
feat(脚本): 添加SSL厂商类型的选择
parent
28e5409132
commit
ed255b17b8
66
install.sh
66
install.sh
|
@ -193,6 +193,12 @@ initVar() {
|
|||
|
||||
# 是否为预览版
|
||||
prereleaseStatus=false
|
||||
|
||||
# ssl类型
|
||||
sslType=
|
||||
|
||||
# ssl邮箱
|
||||
sslEmail=
|
||||
}
|
||||
|
||||
# 检测安装方式
|
||||
|
@ -523,7 +529,7 @@ mkdirTools() {
|
|||
mkdir -p /etc/v2ray-agent/xray/conf
|
||||
mkdir -p /etc/v2ray-agent/xray/tmp
|
||||
mkdir -p /etc/v2ray-agent/trojan
|
||||
mkdir -p /etc/v2ray-agent/hysteria/conf
|
||||
# mkdir -p /etc/v2ray-agent/hysteria/conf
|
||||
mkdir -p /etc/systemd/system/
|
||||
mkdir -p /tmp/v2ray-agent-tls/
|
||||
}
|
||||
|
@ -663,7 +669,8 @@ installTools() {
|
|||
|
||||
if [[ ! -d "$HOME/.acme.sh" ]] || [[ -d "$HOME/.acme.sh" && -z $(find "$HOME/.acme.sh/acme.sh") ]]; then
|
||||
echoContent green " ---> 安装acme.sh"
|
||||
curl -s https://get.acme.sh | sh -s >/etc/v2ray-agent/tls/acme.log 2>&1
|
||||
curl -s https://get.acme.sh | sh >/etc/v2ray-agent/tls/acme.log 2>&1
|
||||
|
||||
if [[ ! -d "$HOME/.acme.sh" ]] || [[ -z $(find "$HOME/.acme.sh/acme.sh") ]]; then
|
||||
echoContent red " acme安装失败--->"
|
||||
tail -n 100 /etc/v2ray-agent/tls/acme.log
|
||||
|
@ -1011,6 +1018,51 @@ checkIP() {
|
|||
fi
|
||||
|
||||
}
|
||||
# 自定义email
|
||||
customSSLEmail() {
|
||||
if [[ -d "/root/.acme.sh" && -f "/root/.acme.sh/account.conf" ]]; then
|
||||
if ! grep -q "ACCOUNT_EMAIL" <"/root/.acme.sh/account.conf"; then
|
||||
read -r -p "请输入邮箱地址:" sslEmail
|
||||
if echo "${sslEmail}" | grep -q "@"; then
|
||||
echo "ACCOUNT_EMAIL='${sslEmail}'" >>/root/.acme.sh/account.conf
|
||||
echoContent green " ---> 添加成功"
|
||||
else
|
||||
echoContent yellow "请重新输入正确的邮箱格式[例: username@example.com]"
|
||||
customSSLEmail
|
||||
fi
|
||||
fi
|
||||
echo
|
||||
fi
|
||||
|
||||
}
|
||||
# 选择ssl安装类型
|
||||
switchSSLType() {
|
||||
if [[ -z "${sslType}" ]]; then
|
||||
echoContent red "\n=============================================================="
|
||||
echoContent yellow "1.letsencrypt"
|
||||
echoContent yellow "2.zerossl"
|
||||
echoContent yellow "3.buypass"
|
||||
echoContent red "=============================================================="
|
||||
read -r -p "请选择:" selectSSLType
|
||||
if [[ "${selectSSLType}" =~ ^[1-3]$ ]]; then
|
||||
|
||||
case ${selectSSLType} in
|
||||
1)
|
||||
sslType="letsencrypt"
|
||||
;;
|
||||
2)
|
||||
sslType="zerossl"
|
||||
;;
|
||||
3)
|
||||
sslType="buypass"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echoContent red " ---> 选择错误,请重新选择"
|
||||
switchSSLType
|
||||
fi
|
||||
fi
|
||||
}
|
||||
# 安装TLS
|
||||
installTLS() {
|
||||
echoContent skyBlue "\n进度 $1/${totalProgress} : 申请TLS证书\n"
|
||||
|
@ -1034,10 +1086,14 @@ installTLS() {
|
|||
|
||||
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证书"
|
||||
|
||||
switchSSLType
|
||||
customSSLEmail
|
||||
|
||||
if echo "${localIP}" | grep -q ":"; then
|
||||
sudo "$HOME/.acme.sh/acme.sh" --issue -d "${tlsDomain}" --standalone -k ec-256 --server letsencrypt --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 | 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 letsencrypt | 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}" | 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
|
||||
|
@ -4731,7 +4787,7 @@ menu() {
|
|||
cd "$HOME" || exit
|
||||
echoContent red "\n=============================================================="
|
||||
echoContent green "作者:mack-a"
|
||||
echoContent green "当前版本:v2.5.75"
|
||||
echoContent green "当前版本:v2.5.76"
|
||||
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
|
||||
echoContent green "描述:八合一共存脚本\c"
|
||||
showInstallStatus
|
||||
|
|
Loading…
Reference in New Issue