更新 trojan.sh
This commit is contained in:
19
trojan.sh
19
trojan.sh
@@ -102,7 +102,7 @@ EOF
|
|||||||
mkdir /usr/src/trojan-cert/$your_domain
|
mkdir /usr/src/trojan-cert/$your_domain
|
||||||
~/.acme.sh/acme.sh --register-account -m myemail@example.com --server zerossl
|
~/.acme.sh/acme.sh --register-account -m myemail@example.com --server zerossl
|
||||||
~/.acme.sh/acme.sh --issue -d $your_domain --nginx
|
~/.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"
|
cert_success="1"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -427,6 +427,12 @@ function repair_cert(){
|
|||||||
real_addr=`ping ${your_domain} -c 1 | sed '1{s/[^(]*(//;s/).*//;q}'`
|
real_addr=`ping ${your_domain} -c 1 | sed '1{s/[^(]*(//;s/).*//;q}'`
|
||||||
local_addr=`curl ipv4.icanhazip.com`
|
local_addr=`curl ipv4.icanhazip.com`
|
||||||
if [ $real_addr == $local_addr ] ; then
|
if [ $real_addr == $local_addr ] ; then
|
||||||
|
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 --register-account -m myemail@example.com --server zerossl
|
||||||
~/.acme.sh/acme.sh --issue -d $your_domain --standalone
|
~/.acme.sh/acme.sh --issue -d $your_domain --standalone
|
||||||
~/.acme.sh/acme.sh --installcert -d $your_domain \
|
~/.acme.sh/acme.sh --installcert -d $your_domain \
|
||||||
@@ -440,6 +446,15 @@ function repair_cert(){
|
|||||||
else
|
else
|
||||||
red "申请证书失败"
|
red "申请证书失败"
|
||||||
fi
|
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
|
else
|
||||||
red "================================"
|
red "================================"
|
||||||
red "域名解析地址与本VPS IP地址不一致"
|
red "域名解析地址与本VPS IP地址不一致"
|
||||||
@@ -502,7 +517,7 @@ function update_trojan(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function install_acme(){
|
function install_acme(){
|
||||||
file_path="~/.acme.sh/acme.sh/"
|
file_path="/root/.acme.sh/acme.sh"
|
||||||
if [ -f "$file_path" ]
|
if [ -f "$file_path" ]
|
||||||
then
|
then
|
||||||
red "$file_path 已存在"
|
red "$file_path 已存在"
|
||||||
|
|||||||
Reference in New Issue
Block a user