Check whether any certificates exist via script.

This commit is contained in:
2021-06-29 11:41:49 +00:00
parent 470df579cf
commit 48e6883031
2 changed files with 24 additions and 0 deletions

16
scripts/check_certificates.sh Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/sh
# Set env variables
DOMAIN_DIR=$DOMAIN_DIR
CERT_DIR=$CERT_DIR
create_self_signed_certificate() {
# generate key
openssl req -x509 -newkey rsa:4096 -keyout $CERT_DIR/key.pem -out $CERT_DIR/cert.pem -days 365 -sha256 -nodes -subj '/CN=domain.tld'
# generate dhparam file
openssl dhparam -out $CERT_DIR/dhparam.pem 4096
}

View File

@@ -109,3 +109,11 @@ echo "location / {
}"
} >> "$file"
# check whether certificates exist or not
if [ $HTTPS_PORT != "" ]; then
./check_certificates.sh;
fi