更新 trojan.sh

This commit is contained in:
2023-11-22 04:53:43 +08:00
parent 1b639dafe3
commit d387daf79c

View File

@@ -102,7 +102,7 @@ EOF
mkdir /usr/src/trojan-cert/$your_domain
~/.acme.sh/acme.sh --register-account -m myemail@example.com --server zerossl
~/.acme.sh/acme.sh --issue -d $your_domain --nginx
if test -s /root/.acme.sh/$your_domain/fullchain.cer; then
if test -s /root/.acme.sh/$your_domain_ecc/fullchain.cer; then
cert_success="1"
fi
fi
@@ -427,18 +427,33 @@ function repair_cert(){
real_addr=`ping ${your_domain} -c 1 | sed '1{s/[^(]*(//;s/).*//;q}'`
local_addr=`curl ipv4.icanhazip.com`
if [ $real_addr == $local_addr ] ; then
~/.acme.sh/acme.sh --register-account -m myemail@example.com --server zerossl
~/.acme.sh/acme.sh --issue -d $your_domain --standalone
~/.acme.sh/acme.sh --installcert -d $your_domain \
--key-file /usr/src/trojan-cert/$your_domain/private.key \
--fullchain-file /usr/src/trojan-cert/$your_domain/fullchain.cer \
--reloadcmd "systemctl restart trojan"
if test -s /usr/src/trojan-cert/$your_domain/fullchain.cer; then
green "证书申请成功"
systemctl restart trojan
systemctl start nginx
else
red "申请证书失败"
if [ -f "/usr/src/trojan-cert/$your_domain/fullchain.cer" ]; then
cd /usr/src/trojan-cert/$your_domain
create_time=`stat -c %Y fullchain.cer`
now_time=`date +%s`
minus=$(($now_time - $create_time ))
if [ $minus -gt 5184000 ]; then
~/.acme.sh/acme.sh --register-account -m myemail@example.com --server zerossl
~/.acme.sh/acme.sh --issue -d $your_domain --standalone
~/.acme.sh/acme.sh --installcert -d $your_domain \
--key-file /usr/src/trojan-cert/$your_domain/private.key \
--fullchain-file /usr/src/trojan-cert/$your_domain/fullchain.cer \
--reloadcmd "systemctl restart trojan"
if test -s /usr/src/trojan-cert/$your_domain/fullchain.cer; then
green "证书申请成功"
systemctl restart trojan
systemctl start nginx
else
red "申请证书失败"
fi
else
~/.acme.sh/acme.sh --installcert -d $your_domain \
--key-file /usr/src/trojan-cert/$your_domain/private.key \
--fullchain-file /usr/src/trojan-cert/$your_domain/fullchain.cer \
--reloadcmd "systemctl restart trojan"
green "检测到域名$your_domain证书存在且未超过60天,无需重新申请"
cert_success="1"
fi
fi
else
red "================================"
@@ -502,7 +517,7 @@ function update_trojan(){
}
function install_acme(){
file_path="~/.acme.sh/acme.sh/"
file_path="/root/.acme.sh/acme.sh"
if [ -f "$file_path" ]
then
red "$file_path 已存在"