Refactor start.letsencrypt.sh to streamline curl command and enhance certificate management with config-home option
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user