Better security by default #81
Replies: 12 comments 26 replies
-
When we get to v4 - we will need a way for a scripted install to configure the admin in a valid way - either pass in user and password or set false - should this be as params to admin init ? |
Beta Was this translation helpful? Give feedback.
-
The script now prompts the user to run admin init if the settings file does not exist. (but they can say no of course, and there is a 60s timeout, default No). Also added a |
Beta Was this translation helpful? Give feedback.
-
In the install script, should "Allow Function nodes to load external modules" default to No? Also in the install script I'm conflicted over removing /etc/sudoers.d/010_pi-nopasswd. |
Beta Was this translation helpful? Give feedback.
-
"The challenge has always been that the settings file is a javascript file rather than JSON - so harder to parse and dynamically edit. This isn't difficult. Will the unedited settings.js contain commented out adminAuth lines as now, or the uncommented lines (so only the hash has to change)? |
Beta Was this translation helpful? Give feedback.
-
I do believe the suggestion made in the forum to refuse connections from the internet is a good one. The algorithm I would use:
Notes:
In addition, Caddy supports HTTPS with Let's Encrypt by default, you don't have to do or configure anything. Could provide a simple sample config for that. Main issue here is that it requires some form of DynamicDNS for most people. Maybe there's an NPM package that does Let's Encrypt, that could be possibly pulled into NR. |
Beta Was this translation helpful? Give feedback.
-
One change I made in my own config is to move the export and use a javascript variable then export that. While this is a tiny change, it does help people understand that the export is different from the settings object. It helps me at least, think about how to make changes and see more clearly if a mistake has been made. It might also help if trying to change it programatically? |
Beta Was this translation helpful? Give feedback.
-
Going to be doing some work with Bart around looking at NGINX configs. I already have a baseline for my own use, we are going to do something for him and possibly will then use that to look at how we might get a tool that could be used to create a parameterised set of configs. Not sure how feasible that is but worth a try. There is also some security documentation in the uibuilder tech docs and I'm more than happy for any of that to be reused. Bart has also started a useful diagram that we will work on and hopefully will be a useful addition to the docs at some point. |
Beta Was this translation helpful? Give feedback.
-
Nice one. 👍 |
Beta Was this translation helpful? Give feedback.
-
I would like to add a word of caution here. I know that I often drone on about node-red security. However, I would caution against trying to get Node-RED to take on too much of the security responsibilities itself. With the best will in the world, the more we force into Node-RED, the more people will assume that Node-RED will handle all cases. I don't believe this is sensible and it potentially takes away development resources from other areas. There are plenty of tools around to provide good security and they have been battle-tested over time. Having said that, I think the core suggestions are sensible and useful. |
Beta Was this translation helpful? Give feedback.
-
Two of the themes I noticed in the forum thread are:
I would add something like "Even if your Node-RED doesn't have anything valuable, (automated) attacks will happen and could provide a foothold in your local network". |
Beta Was this translation helpful? Give feedback.
-
How about adding a JSON file to handle script/ui based inputs, rather than trying to edit settings.js programmatically. AdminAuth could remain in settings, but depending on the attribute determine if the additional JSON file is needed. |
Beta Was this translation helpful? Give feedback.
-
Would it be fair to assume users that are 'embedding' are more technically capable, and thus perhaps are not so much of a risk to security unlike novice users, who typically install via the script or Docker...? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
A default install/configuration of Node-RED does not have security applied. This allows a user to get started with very little friction.
However it does result in too many insecure Node-RED instances being exposed on the internet.
We have had a number of attempts to look at this topic in the past, but none have resulted in action. We need some focussed activity to come up with an approach (or collection of approaches) that will satisfy the wide range of requirements.
We have to consider the range of usage scenarios for Node-RED and how any change in approach will impact them.
Some other things to consider:
settings.js
is a JavaScript file, not a JSON file - so programmatically editing it is hard to do safely.Proposal
1. In Node-RED 4.0, we will refuse to run if
adminAuth
has not been set to something.A user must either setup security, or explicitly acknowledge they do not want security by setting
adminAuth
tofalse
.This will only apply when running with a settings file - not in embedded mode where settings are passed in programmatically.
But to get to that point, we need to take action now:
adminAuth
isundefined
, log a clear warning that security is not enabled. Include links to docs on setting up security. Include a warning about Node-RED 4.0 will requireadminAuth
to be configured to either enable or disable security.adminAuth
isfalse
, log a warning that security is not enabled. But takefalse
this to indicate an explicit choice to do so.adminAuth
is not set - ie undefined2. Add command to
node-red admin
to do more to help setup securityRight now,
node-red admin
can be used to generate a password hash, but the user still needs to update their settings file.The challenge has always been that the settings file is a javascript file rather than JSON - so harder to parse and dynamically edit. Harder - but not impossible.
We should do the work to see if we can edit the file programmatically to setup adminAuth for the user.
3. Update Pi install script to prompt the user to setup security
This probably represents the largest population of regular users - especially those that may not have the depth of knowledge around securing systems. It is also where we have the most opportunity to intervene before Node-RED is run - by adding things to the install script.
node-red admin init
to the install script if the settings file doesn't exist. This will walk the user through configuring the system, including setting up basic admin auth.Beta Was this translation helpful? Give feedback.
All reactions