Add SSH certification to Node-Red

Make sure you have a secure connection to your Node-Red before you expose your precious server to the internet!

In the post for setting up a new Pi the use of OAuth (GitHub) is already explained, otherwise you should setup a simple username/password scheme as described on the Node-Red website.

Now lets setup a HTTPS connection to Node-Red. First we need to make our own certificate.

cd ~/.node-red
openssl genrsa -out privatekey.pem 1024
openssl req -new -key privatekey.pem -out private-csr.pem 

You will be asked to enter some details in the second step. Pay attention to Common Namefield. This should be your Node-Red IP or a domain (external IP without the port or DNS if you use one).

openssl x509 -req -days 365 -in private-csr.pem -signkey privatekey.pem -out certificate.pem
nano settings.js 

uncomment :

var fs = require("fs");

add:

https: {
key: fs.readFileSync('/home/pi/.node-red/privatekey.pem'),
cert: fs.readFileSync('/home/pi/.node-red/certificate.pem')
},
requireHttps: true,

An finally restart Node-Red.

node-red-stop
node-red-start

You should now be able to reach your Node-Red server using https://hostname:1880/admin and feel a little safer in this world.

Advertisements

2 thoughts on “Add SSH certification to Node-Red

Add yours

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: