From 0db51be38d116f81884483e371ab4ef048122048 Mon Sep 17 00:00:00 2001 From: gyurix Date: Wed, 5 Nov 2025 09:56:43 +0100 Subject: [PATCH] Refactor start.letsencrypt.sh to streamline curl command and enhance certificate management with config-home option --- start.letsencrypt.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/start.letsencrypt.sh b/start.letsencrypt.sh index 97a6265..35f165e 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 email=$EMAIL + curl https://get.acme.sh | sh -s email=$EMAIL --home /acme.sh 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 --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 - + sh /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 /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 fi else - 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 + sh /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 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 --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 + sh /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 RESPONSE=$? if [[ "$(echo $RESPONSE)" == "1" && "$(cat $LOG_FILE | grep force)" == "" ]]; then sleep $TIMEOUT