Blog Archives

Working around untrusted certificate errors in Express JS


A few very common fatal errors thrown by the request module for express while trying to access data from self-signed web servers are Error: DEPTH_ZERO_SELF_SIGNED_CERT and UNABLE_TO_VERIFY_LEAF_SIGNATURE

This is because of https://github.com/nodejs/node-v0.x-archive/pull/4023 which mandates NodeJS to validate a server’s certificate by default, which needless to say is how things should be in a production environment.

However, more often than none we tend to use self-signed SSL certificates in our development environments or even within internal networks.

Thankfully for such brain-wracking moments, two particular flags come to our rescue. Enter strictSSL and rejectUnauthorized. The way I personally like to use these flags, is to set defaults within my development environments as follows to bypass SSL validation hence, saving the day! 🙂

var request = require('request').defaults({
    strictSSL: false,
    rejectUnauthorized: false
 });

Please do note, that I do not recommend that you ever try this on your production systems without understanding the true implications of what disabling strictSSL and rejectUnauthorized means for you node server. By disabling these, you are essentially telling your server to skip validation of the requested server’s identity, which leaves your application in quite a vulnerable position.

Installing Sublime Text 2 on Fedora 18 / 19 / 20


Here’s another three step guide to installing Sublime Text 2 on Fedora 19 – Schrodinger’s Cat:-

  1. Download the installation script from the following gist.
    https://gist.github.com/sayak-sarkar/5810101
  2. Extract it to your home directory [or anywhere you like].
    $tar -xvf gist5810101-3b0e9bb3ef5128760df9e3e06877fa4f7e5689ec.tar.gz
  3. Open your terminal (preferably as super user), navigate to your home directory and execute the shell script.
     #./sublime-text-2.sh

Voila!! You now have Sublime Text 2 installed on your machine. You may run it from the terminal or via the alt+f2 shortcut by simply typing in “sublime-text”.

Credits to Henrique Moody for the original script gist!!
I’ve simply added a symbolic link at /usr/bin to enable terminal execution. 😉

Enjoy!! 🙂