Monkey patching TLS in Node.js to support self-signed certificates with custom root certificate authorities

Click for: original source

David Barral wrote this detailed guide on updating TLS (Transport Layer Security) in Node.js and how to consume services that have been secured with self-signed certificates.

A self-signed SSL Certificate is an identity certificate that is signed by the same entity whose identity it certifies.

The self signed certificate in certificate chain error means that our client sees the certificates but does not know the CA that issued the server certificate and cannot trust it. That’s cool, node is helping us to protect against a man in the middle attack.

The article describes and explains:

  • Self-Signed certificates
  • How to test HTTPS server with self-signed certificates
  • Client Error: self signed certificate in certificate chain
  • How to add extra root certificates to node
  • Monkey patching tls.createSecureContext

A monkey patch is a way for a program to extend or modify supporting system software locally (affecting only the running instance of the program). good read.

[Read More]

Tags nodejs infosec web-development app-development