Checking any certificate exists for domain

This commit is contained in:
2022-11-06 09:43:57 +00:00
parent ab7bf3a1e1
commit 46ee936f3a

View File

@@ -79,11 +79,17 @@ letsencrypt_certificates() {
create_self_signed_certificate() {
# Check any certificate exxits
if [[ ! -f /acme.sh/$DOMAIN/key.pem && ! -f /acme.sh/$DOMAIN/fullchain.pem && ! -f /acme.sh/$DOMAIN/cert.pem ]] ; then
# generate key
openssl req -x509 -newkey rsa:4096 -keyout $DOMAIN_CERT_DIR/key.pem -out $DOMAIN_CERT_DIR/cert.pem -days 365 -sha256 -nodes -subj "/CN=$DOMAIN";
cp -a $DOMAIN_CERT_DIR/cert.pem $DOMAIN_CERT_DIR/fullchain.pem;
touch $DOMAIN_CERT_DIR/new_certificate;
fi
}
if [ ! -d "$DOMAIN_CERT_DIR" ]; then