First make sure you are working with the copy of settings.js
in the .node-red
directory in. This file and it's location will be logged when Node-RED starts
18 May 11:41:51 - [info] Settings file : /home/hardillb/.node-red/settings.js
18 May 11:41:51 - [info] User directory : /home/hardillb/.node-red
18 May 11:41:51 - [info] Flows file : /home/hardillb/.node-red/testing.json
18 May 11:41:51 - [info] Server now running at http://127.0.0.1:1880/
18 May 11:41:51 - [info] Starting flows
Next do you want to secure the Node-RED Editor UI or the Dashboard UI?
If the Editor UI then you need to find the adminAuth
section:
adminAuth: {
type: "credentials",
users: [{
username: "admin",
password: "$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN.",
permissions: "*"
}]
},
You generate the password hash using the following command:
node-red-admin hash-pw
or
node -e "console.log(require('bcryptjs').hashSync(process.argv[1], 8));" [your-password-here]
If you want to secure the Dashboard UI then it's the httpNodeAuth
option that needs changing.
httpNodeAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
If you have enabled the service of static content using the httpStatic
then this content is protected via the httpStaticAuth
directive.
httpStaticAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."}
The password hash in both cases is generated in the same way as for the adminAuth
section.
The docs for securing Node-RED can be found here: http://nodered.org/docs/security