Skip to content

Latest commit

 

History

History
71 lines (48 loc) · 2.44 KB

README.md

File metadata and controls

71 lines (48 loc) · 2.44 KB

Generate a TLS server certificate on Windows and macOS

Generate-TlsCertificate.ps1 generates a TLS server certificate for localtest.me and *.localtest.me (localhost testing done right).

🚨 this is only intended to be used on your machine for development purposes. For everything else please use Let's Encrypt 🙇.

Goals

  • No configuration
  • Generates a Certificate Authority so that it can be trusted in Firefox and other systems as required

Pre-requisites

Usage

.\Generate-TlsCertificate.ps1

You can optionally decide to trust the Certificate Authority:

.\Generate-TlsCertificate.ps1 -TrustCa

📓 you can get Firefox to import Certificate Authorities from the Windows certificate store automatically. You can enable this feature in about:config by creating this boolean value:

security.enterprise_roots.enabled

and set it to true. The Certificate Authority needs to be added to the Trusted Root Certification Authorities store of the Local Computer.

Troubleshooting

The easiest way to troubleshoot is to get yourself a terminal using the same image that was used to create the TLS server certificate:

docker run -it --rm -v "${PWD}/out:/tls" -w '/tls' node bash

Inspecting the Certificate Authority certificate

openssl x509 -noout -text -in ./ca.crt

Inspecting the localtest.me CSR

openssl req -noout -text -in ./tls-cert.csr

Inspecting the localtest.me TLS server certificate

openssl x509 -noout -text -in ./tls-cert.crt