Generate a self-signed openssl certificate valid for localhost, IP v4 127.0.0.1, and IP v6 ::1.
I frequently have to google instructions for how to generate SSL certs. Therefore, I created this repository to remove one more obstacle to properly securing endpoints.
This configuration generates a certificate valid for localhost, IP v4 127.0.0.1, and IP v6 ::1.
From your shell:
./generate.sh
Create a self-signed localhost certificate
mkdir -p output
openssl req -config cert.config -new -x509 \
-sha256 -newkey rsa:2048 -nodes \
-keyout output/localhost.key.pem -days 365 \
-out output/localhost.cert.pem
Show the certificate details
openssl x509 -in output/localhost.cert.pem -text -noout
Create a signing request
openssl req -config cert.config -new -sha256 -newkey rsa:2048 -nodes \
-keyout output/localhost.key.pem -days 365 -out output/localhost.req.pem
Start a simple NodeJs server and call with curl, passing the self-signed cert to validate HTTPS
.
./test.sh
Go to the original Stack Overflow question.