Skip to content

Commit 7d03f2a

Browse files
committed
upgrade acme.sh
1 parent 6e929e0 commit 7d03f2a

File tree

2 files changed

+13
-28
lines changed

2 files changed

+13
-28
lines changed

acme.sh/cert_utils.sh

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ acmecmd() {
3838
stop_nginx_acme(){
3939
echo "" >/opt/hiddify-manager/nginx/parts/acme.conf
4040
systemctl reload --now hiddify-nginx
41+
systemctl reload hiddify-haproxy
4142
}
4243

4344

@@ -70,55 +71,35 @@ function get_cert() {
7071
if isipv4 "$DOMAIN"; then
7172
acmecmd -d $DOMAIN --server letsencrypt --certificate-profile shortlived --days 6
7273
elif isipv6 "$DOMAIN"; then
73-
acmecmd -d [$DOMAIN] --server letsencrypt --certificate-profile shortlived --days 6
74+
acmecmd -d [$DOMAIN] --server letsencrypt --certificate-profile shortlived --days 6 --listen-v6
7475
else
7576
acmecmd -d "$DOMAIN" --server letsencrypt
76-
err=$?
7777

7878
if [ "$err" -ne 0 ] && is_ok_domain_zerossl "$DOMAIN"; then
79-
acmecmd -d "$DOMAIN" --server zerossl
80-
err=$?
79+
acmecmd -d "$DOMAIN" --server zerossl
8180
fi
8281

83-
if [ "$err" -ne 0 ]; then
84-
echo "acme issue failed, skipping installcert"
85-
bash generate_self_signed_cert.sh $DOMAIN
86-
return 1
87-
fi
8882
fi
89-
cp $ssl_cert_path/$DOMAIN.crt $ssl_cert_path/$DOMAIN.crt.bk
90-
cp $ssl_cert_path/$DOMAIN.crt.key $ssl_cert_path/$DOMAIN.crt.key.bk
83+
9184
acme.sh --installcert -d $DOMAIN \
9285
--fullchainpath $ssl_cert_path/$DOMAIN.crt \
9386
--keypath $ssl_cert_path/$DOMAIN.crt.key \
9487
--reloadcmd "echo success"
88+
9589
err=$?
96-
if [ $err == 0 ]; then
97-
rm $ssl_cert_path/$DOMAIN.crt.bk
98-
rm $ssl_cert_path/$DOMAIN.crt.key.bk
99-
else
100-
mv $ssl_cert_path/$DOMAIN.crt.key.bk $ssl_cert_path/$DOMAIN.crt.key
101-
mv $ssl_cert_path/$DOMAIN.crt.bk $ssl_cert_path/$DOMAIN.crt
102-
fi
103-
90+
10491
else
10592
err=1
10693
fi
10794

10895
if [[ $err != 0 ]]; then
109-
bash generate_self_signed_cert.sh $DOMAIN
96+
get_self_signed_cert $DOMAIN #it will check the certificate if is valid it will not create
11097
fi
11198

11299
chmod 600 $ssl_cert_path/$DOMAIN.crt.key
113100
chmod 600 -R $ssl_cert_path
114-
115-
systemctl reload --now hiddify-nginx
116-
systemctl reload hiddify-haproxy
117101
}
118102

119-
function has_valid_cert() {
120-
certificate="/opt/hiddify-manager/ssl/$1.crt"
121-
}
122103

123104
function get_self_signed_cert() {
124105
cd /opt/hiddify-manager/acme.sh/

acme.sh/install.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@ install_package socat
33
remove_package certbot
44

55
mkdir -p /opt/hiddify-manager/acme.sh/lib/
6+
67
if ! is_installed ./lib/acme.sh; then
78
curl -s -L https://get.acme.sh | sh -s -- home /opt/hiddify-manager/acme.sh/lib \
89
--config-home /opt/hiddify-manager/acme.sh/lib/data \
910
--cert-home /opt/hiddify-manager/acme.sh/lib/certs --nocron
10-
11-
sed -i 's|_sleep_overload_retry_sec=$_retryafter|_sleep_overload_retry_sec=$_retryafter; if [[ "$_retryafter" > 20 ]];then return 10; fi|g' lib/acme.sh
1211
fi
12+
./lib/acme.sh --upgrade
1313

14+
if ! grep -q 'return 10; fi' "./lib/acme.sh"; then
15+
sed -i 's|_sleep_overload_retry_sec=$_retryafter|_sleep_overload_retry_sec=$_retryafter; if [[ "$_retryafter" > 20 ]];then return 10; fi|g' lib/acme.sh
16+
fi
1417
mkdir -p ../ssl/
18+
1519
./lib/acme.sh --uninstall-cronjob
1620
shopt -s expand_aliases
1721
source ./lib/acme.sh.env

0 commit comments

Comments
 (0)