51 lines
1.4 KiB
Bash
Executable File
51 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
email=$EMAIL
|
|
|
|
start_letsencrypt() {
|
|
|
|
mkdir -p /acme.sh/$DOMAIN/ ;
|
|
|
|
ACME_PARAMS="--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"
|
|
|
|
if acme.sh --register-account -m $email $ACME_PARAMS | grep 'Already registered' ; then
|
|
|
|
acme.sh $ACME_PARAMS ;
|
|
|
|
fi
|
|
|
|
#mkdir -p /acme.sh/$DOMAIN/ecc-certs ;
|
|
|
|
#acme.sh --issue --standalone --keylength ec-384 -d $DOMAIN --cert-file /acme.sh/$DOMAIN/ecc-certs/cert.pem --key-file /acme.sh/$DOMAIN/ecc-certs/key.pem --fullchain-file /acme.sh/$DOMAIN/ecc-certs/fullchain.pem
|
|
|
|
}
|
|
|
|
LETSENCRYPT_FILE=$(find /acme.sh/ -type f -name letsencrypt);
|
|
if [ -n "$LETSENCRYPT_FILE" ] ; then
|
|
DOMAIN=$(jq -r .DOMAIN $LETSENCRYPT_FILE) ;
|
|
start_letsencrypt;
|
|
rm $LETSENCRYPT_FILE;
|
|
else
|
|
cd /domains
|
|
for i in `ls` ; do
|
|
DOMAIN=$(jq -r .DOMAIN $i) ;
|
|
if [[ -f /acme.sh/$DOMAIN/key.pem && -f /acme.sh/$DOMAIN/fullchain.pem && -f /acme.sh/$DOMAIN/cert.pem ]] ; then
|
|
start_letsencrypt ;
|
|
touch /acme.sh/$DOMAIN/renew_certificate;
|
|
else
|
|
start_letsencrypt;
|
|
if [[ -f /acme.sh/$DOMAIN/key.pem && -f /acme.sh/$DOMAIN/fullchain.pem && -f /acme.sh/$DOMAIN/cert.pem ]] ; then
|
|
touch /acme.sh/$DOMAIN/new_certificate;
|
|
|
|
else
|
|
while [[ ! -f /acme.sh/$DOMAIN/key.pem || ! -f /acme.sh/$DOMAIN/fullchain.pem || ! -f /acme.sh/$DOMAIN/cert.pem ]] ; do
|
|
sleep 10;
|
|
start_letsencrypt ;
|
|
done
|
|
fi
|
|
fi
|
|
done ;
|
|
fi
|
|
|
|
|