If mkcert is not available, create certificates using openssl
This commit is contained in:
parent
5d7dc56684
commit
9bcffb08fb
@ -9,7 +9,19 @@ combined="src/combined.pem"
|
|||||||
if [[ ! -f $combined ]]; then
|
if [[ ! -f $combined ]]; then
|
||||||
echo "Creating certificates..."
|
echo "Creating certificates..."
|
||||||
cd src
|
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
|
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
|
cat localhost.pem localhost-key.pem > combined.pem
|
||||||
echo "done"
|
echo "done"
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user