Just some notes around generating SSL certs to play with. When working with your NodeJS app it is something handy to be able to generate some SSL certs to use locally for development so this will help you generate a self-signed SSL certificate using
A file used for your default preferences so you don't have to fill out the form (prompts) when generating your certificate.
To make it work with multiple hostnames, use the
[alt_names] area to fill out the Certificate SAN (Subject Alt Names) fields.
## NodeJS Self Signed Certs # cert.conf # Update the defaults to what you want, then use this as your template to generate a SSL cert [req] distinguished_name = req_distinguished_name req_extensions = v3_req [req_distinguished_name] countryName = Country Name (2 letter code) countryName_default = CA stateOrProvinceName = State or Province Name (full name) stateOrProvinceName_default = Alberta localityName = Locality Name (eg, city) localityName_default = Your City organizationName = Organization Name (eg, company) [Internet Widgits Pty Ltd] organizationName_default = Your Company Name Here organizationalUnitName = Organizational Unit Name (eg, section) organizationalUnitName_default = Engineering commonName = yourdomain.com commonName_default = your_domain_here.com commonName_max = 64 [ v3_req ] # Extensions to add to a certificate request basicConstraints = CA:FALSE keyUsage = nonRepudiation, digitalSignature, keyEncipherment subjectAltName = @alt_names [alt_names] DNS.1 = server1.com DNS.2 = server2.com
# This is a 1 year cert (356 days) openssl req -newkey rsa:2048 -new -config cert.conf -nodes -x509 -days 365 -keyout key.pem -out cert.pem