Merge pull request #5485 from swilde/openslides4-dev

If mkcert is not available, create certificates using openssl
This commit is contained in:
Finn Stutzenstein 2020-07-27 11:17:51 +02:00 committed by GitHub
commit a489742494
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,7 +9,19 @@ combined="src/combined.pem"
if [[ ! -f $combined ]]; then
echo "Creating certificates..."
cd src
if type 2>1 >/dev/null mkcert ; then
mkcert -cert-file localhost.pem -key-file localhost-key.pem localhost 127.0.0.1
elif type 2>1 >/dev/null openssl ; then
echo "Command 'mkcert' not found, using openssl fallback."
echo "You will need to accept an security exception for the"
echo "generated certificate in your browser manually."
openssl req -x509 -newkey rsa:4096 -nodes -days 3650 \
-subj "/C=DE/O=Selfsigned Test/CN=localhost" \
-keyout localhost-key.pem -out localhost.pem
else
echo >&2 "FATAL: No valid certificate generation tool found!"
exit -1
fi
cat localhost.pem localhost-key.pem > combined.pem
echo "done"
else