update script for acme-tiny 4.0 and bug fixing
This commit is contained in:
parent
2c40146607
commit
2dc2bcc8a9
@ -6,12 +6,10 @@ path="$( cd "$(dirname "$0")" ; pwd -P )"
|
|||||||
# variables
|
# variables
|
||||||
acme_dir=/srv/certs/acme-challenge/.well-known/acme-challenge
|
acme_dir=/srv/certs/acme-challenge/.well-known/acme-challenge
|
||||||
opt_folder=$path/opt
|
opt_folder=$path/opt
|
||||||
le_cert=$opt_folder/lets-encrypt-x3-cross-signed.pem
|
|
||||||
account_key=$opt_folder/account.key
|
account_key=$opt_folder/account.key
|
||||||
acme_tiny=$opt_folder/acme_tiny.py
|
acme_tiny=$opt_folder/acme_tiny.py
|
||||||
openssl_conf=$opt_folder/openssl.conf
|
openssl_conf=$opt_folder/openssl.conf
|
||||||
|
|
||||||
|
|
||||||
#############
|
#############
|
||||||
# script
|
# script
|
||||||
|
|
||||||
@ -38,12 +36,6 @@ if [ ! -f "$acme_tiny" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "$le_cert" ]; then
|
|
||||||
echo "LetsEncrypt cert doesn't exists!"
|
|
||||||
echo "Downloading root cert..."
|
|
||||||
wget -O - https://letsencrypt.org/certs/lets-encrypt-x3-cross-signed.pem > $le_cert
|
|
||||||
fi
|
|
||||||
|
|
||||||
acme_dir=${acme_dir%/}
|
acme_dir=${acme_dir%/}
|
||||||
opt_folder=${opt_folder%/}
|
opt_folder=${opt_folder%/}
|
||||||
|
|
||||||
@ -77,7 +69,7 @@ do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ${#DOMAINS[@]} -eq 0 ]; then
|
if [ ${#DOMAINS[@]} -eq 0 ]; then
|
||||||
echo "No domains given for \"$name\"."
|
echo "No domains given for \"$NAME\"."
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -88,6 +80,7 @@ do
|
|||||||
if [ ! -f "$key" ]; then
|
if [ ! -f "$key" ]; then
|
||||||
echo "Domain key doesn't exists. Generating..."
|
echo "Domain key doesn't exists. Generating..."
|
||||||
openssl genrsa 4096 > "$key"
|
openssl genrsa 4096 > "$key"
|
||||||
|
#openssl ecparam -out "$key" -name secp384r1 -genkey
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# domain csr
|
# domain csr
|
||||||
@ -113,7 +106,7 @@ do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# get certificate
|
# get certificate
|
||||||
python "$path/$acme_tiny" --account-key "$account_key" --csr "$csr" --acme-dir "$acme_dir" > "$arg/tmp.crt"
|
python "$acme_tiny" --account-key "$account_key" --csr "$csr" --acme-dir "$acme_dir" > "$arg/tmp.crt"
|
||||||
|
|
||||||
if [ $? != 0 ]; then
|
if [ $? != 0 ]; then
|
||||||
rm -rf $arg/tmp.crt
|
rm -rf $arg/tmp.crt
|
||||||
@ -121,12 +114,9 @@ do
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mv -f "$arg/tmp.crt" "$path/$arg/$NAME.crt"
|
mv -f "$arg/tmp.crt" "$arg/$NAME.crt"
|
||||||
|
|
||||||
# append letsencrypt cert
|
echo "Certificate for \"$NAME\" successfully created!"
|
||||||
cat "$arg/$NAME.crt" "$le_cert" > "$arg/$NAME.pem"
|
|
||||||
|
|
||||||
echo "Certificate for \"$name\" successfully created!"
|
|
||||||
counter=$((counter+1))
|
counter=$((counter+1))
|
||||||
|
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user