Node RED Settings - langanjp/PI-NodeRED GitHub Wiki

Editing settings

cd ~/.node-red  
nano settings.js

Note:

  • nano is a quick text based editor built into Raspian. The standard unix vi editor is also available out of the box
  • ~ is your user home directory

Ignore self-signed / invalid certificates

After the copyright info, add this line only if your PI Web API server will not have a valid certificate (note: a self-signed certificate is not valid). This does mean that Node-RED will accept any certificate.

// add to ignore self signed certs  
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";

Securing Node-RED (with username and password)

If you want to secure your Node-RED (required if this will be out in the open internet)
Find the // Securing Node-RED section

Add a section like:

adminAuth: {  
    type: "credentials",  
    users: [{  
        username: "admin",  
        password: "a8$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN.",  
        permissions: "*"  
    }]  
}  

Refer to http://nodered.org/docs/security.html for details, including generating the password hash

Additional Information

If you want to add additional security or different authentication (e.g. https or ldap), take a look at: https://www.hardill.me.uk/wordpress/2015/05/11/securing-node-red/

If you want more information on securing your PI Web API server with a no cost, trusted certificate, look at: https://pisquare.osisoft.com/message/73381-re-pi-web-api-lets-encrypt

Next Section:

PI Web API Settings