Skip to content

Commit c9f4968

Browse files
committed
get cert alt
1 parent b61f1e3 commit c9f4968

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

src/v2gun.sh

+23-2
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ preinstall() {
201201
# get dependencies
202202
${sudoCmd} ${PACKAGE_MANAGEMENT_INSTALL} epel-release -y 2>/dev/null # centos
203203
${sudoCmd} ${PACKAGE_MANAGEMENT_UPDATE} -y
204-
${sudoCmd} ${PACKAGE_MANAGEMENT_INSTALL} coreutils curl git wget unzip xz-utils -y
204+
${sudoCmd} ${PACKAGE_MANAGEMENT_INSTALL} coreutils curl git socat wget unzip xz-utils -y
205205

206206
${sudoCmd} ${PACKAGE_MANAGEMENT_INSTALL} jq -y
207207
# install jq mannualy if the package management didn't
@@ -228,6 +228,21 @@ get_cert() {
228228
--reloadcmd "chmod 644 /etc/ssl/v2ray/fullchain.pem; chmod 644 /etc/ssl/v2ray/key.pem; systemctl restart v2ray"
229229
}
230230

231+
get_cert_alt() {
232+
# use standalone mode to issue cert
233+
${sudoCmd} stop caddy 2>/dev/null
234+
colorEcho ${BLUE} "Issuing certificate"
235+
${sudoCmd} /root/.acme.sh/acme.sh --issue -d "$1" --standalone --keylength ec-256
236+
237+
# install certificate
238+
colorEcho ${BLUE} "Installing certificate"
239+
${sudoCmd} /root/.acme.sh/acme.sh --install-cert --ecc -d "$1" \
240+
--key-file /etc/ssl/v2ray/key.pem --fullchain-file /etc/ssl/v2ray/fullchain.pem \
241+
--reloadcmd "chmod 644 /etc/ssl/v2ray/fullchain.pem; chmod 644 /etc/ssl/v2ray/key.pem; systemctl restart v2ray"
242+
243+
${sudoCmd} restart caddy 2>/dev/null
244+
}
245+
231246
get_trojan() {
232247
if [ ! -d "/usr/bin/trojan-go" ]; then
233248
colorEcho ${BLUE} "trojan-go is not installed. start installation"
@@ -819,7 +834,13 @@ install_v2ray() {
819834
colorEcho ${GREEN} "安装 VLESS + VMess + Trojan + NaiveProxy 成功!"
820835
show_links
821836
else
822-
colorEcho ${RED} "证书签发失败, 请运行修复证书"
837+
get_cert_alt "${V2_DOMAIN}"
838+
if [ -f "/root/.acme.sh/${V2_DOMAIN}_ecc/fullchain.cer" ]; then
839+
colorEcho ${GREEN} "安装 VLESS + VMess + Trojan + NaiveProxy 成功!"
840+
show_links
841+
else
842+
colorEcho ${RED} "证书签发失败, 请运行修复证书"
843+
fi
823844
fi
824845
}
825846

0 commit comments

Comments
 (0)