Generate a self-signed certificate in PEM format
DOMAIN=dev.penneo.com
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout $DOMAIN.key -out $DOMAIN.crt
For a certificate that gets accepted by Chrome 68+, see the self signed certificate generator by Jesus Otero Gomez.
For making the OS trust the certificate, the requirements for Debian are:
.0
appended to it. Why we do that? No idea.. let me know when you find outor in bash lingo:
CERTS=/etc/ssl/certs
sudo cp $DOMAIN.crt $CERTS/
cd $CERTS
HASH=`openssl x509 -noout -hash -in $DOMAIN.crt`.0
sudo ln -s $DOMAIN.crt $HASH
Source: Trusting self-signed certificates in redhat
You can check the details for the newly generated certificate as follows:
openssl x509 -in $DOMAIN.crt -text -noout
Some applications rely on the OS level trusted certificates. Browsers have a different way to established trust. For Chrome, you have to add the rootCA
certificate instead of the self signed certificate. Check out Jesus’s self signed certificate generator to generate the rootCA.pem
. Once you have that, it needs to be imported in Chrome:
Chrome Settings
> Show advanced settings
> HTTPS/SSL
> Manage Certificates
> Import certificate
PEM is a container format for storing certificates. There are a number of ways to store certificates and here is a quick reference for some extensions that I have bumped into: