From 1e256e169b611329e9e97b718da7e155a2553d3e Mon Sep 17 00:00:00 2001 From: gyurix Date: Wed, 5 Nov 2025 09:43:37 +0100 Subject: [PATCH] Refactor start.letsencrypt.sh to simplify curl command and enhance certificate management with config-home option --- start.letsencrypt.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/start.letsencrypt.sh b/start.letsencrypt.sh index 69568e5..97a6265 100755 --- a/start.letsencrypt.sh +++ b/start.letsencrypt.sh @@ -55,7 +55,7 @@ create_json() { start_letsencrypt() { cd /root if [ "$LETSENCRYPT_INSTALLED" != "true" ]; then - curl https://get.acme.sh | sh -s -- --home /acme.sh/$DOMAIN email=$EMAIL + curl https://get.acme.sh | sh -s email=$EMAIL LETSENCRYPT_INSTALLED=true fi @@ -64,12 +64,12 @@ start_letsencrypt() { SUBJECT=$(openssl x509 -in /acme.sh/$DOMAIN/fullchain.pem -text -noout | grep -w CN | grep Subject | cut -d '=' -f2) if [ "$ISSUER" == "$SUBJECT" ]; then echo "Self signed certificate found" - sh /root/.acme.sh/acme.sh $L_S $EK $EHK --issue --standalone --keylength 4096 -d $DOMAIN --cert-file /acme.sh/$DOMAIN/cert.pem --key-file /acme.sh/$DOMAIN/key.pem --fullchain-file /acme.sh/$DOMAIN/fullchain.pem >$LOG_FILE 2>&1 - else sh /root/.acme.sh/acme.sh $L_S $EK $EHK --renew --standalone --keylength 4096 -d $DOMAIN --cert-file /acme.sh/$DOMAIN/cert.pem --key-file /acme.sh/$DOMAIN/key.pem --fullchain-file /acme.sh/$DOMAIN/fullchain.pem >$LOG_FILE 2>&1 + sh /root/.acme.sh/acme.sh $L_S $EK $EHK --config-home /acme.sh --issue --standalone --keylength 4096 -d $DOMAIN --cert-file /acme.sh/$DOMAIN/cert.pem --key-file /acme.sh/$DOMAIN/key.pem --fullchain-file /acme.sh/$DOMAIN/fullchain.pem >$LOG_FILE 2>&1 + else sh /root/.acme.sh/acme.sh $L_S $EK $EHK --config-home /acme.sh --renew --standalone --keylength 4096 -d $DOMAIN --cert-file /acme.sh/$DOMAIN/cert.pem --key-file /acme.sh/$DOMAIN/key.pem --fullchain-file /acme.sh/$DOMAIN/fullchain.pem >$LOG_FILE 2>&1 fi else - sh /root/.acme.sh/acme.sh $L_S $EK $EHK --issue --standalone --keylength 4096 -d $DOMAIN --cert-file /acme.sh/$DOMAIN/cert.pem --key-file /acme.sh/$DOMAIN/key.pem --fullchain-file /acme.sh/$DOMAIN/fullchain.pem >$LOG_FILE 2>&1 + sh /root/.acme.sh/acme.sh $L_S $EK $EHK --config-home /acme.sh --issue --standalone --keylength 4096 -d $DOMAIN --cert-file /acme.sh/$DOMAIN/cert.pem --key-file /acme.sh/$DOMAIN/key.pem --fullchain-file /acme.sh/$DOMAIN/fullchain.pem >$LOG_FILE 2>&1 fi RESPONSE=$? @@ -78,7 +78,7 @@ start_letsencrypt() { if [ "$(echo $RESPONSE)" == "1" ]; then for retries in $(seq 0 $((RESTART + 1))); do if [[ $retries -le $RESTART ]]; then - sh /root/.acme.sh/acme.sh $L_S $EK $EHK --issue --standalone --keylength 4096 -d $DOMAIN --cert-file /acme.sh/$DOMAIN/cert.pem --key-file /acme.sh/$DOMAIN/key.pem --fullchain-file /acme.sh/$DOMAIN/fullchain.pem >>$LOG_FILE 2>&1 + sh /root/.acme.sh/acme.sh $L_S $EK $EHK --config-home /acme.sh --issue --standalone --keylength 4096 -d $DOMAIN --cert-file /acme.sh/$DOMAIN/cert.pem --key-file /acme.sh/$DOMAIN/key.pem --fullchain-file /acme.sh/$DOMAIN/fullchain.pem >>$LOG_FILE 2>&1 RESPONSE=$? if [[ "$(echo $RESPONSE)" == "1" && "$(cat $LOG_FILE | grep force)" == "" ]]; then sleep $TIMEOUT