After installing NodeRed for the first time, you can (or should) normally access the NodeRed configuration interface without any major obstacles. This is practical because you can start the configuration directly.
Unfortunately, it is also dangerous. Because if anyone on the network can access the NodeRed configuration interface, this also means that anyone on the network can execute commands on the respective system.
Access should be made as difficult as possible here. This is a must, especially as soon as you enable access to the NodeRed configuration via the Internet. Otherwise your own RaspberryPi will probably very quickly no longer only work for your own NodeRed server but also for the next botnet.
An important step to make access to NodeRed more difficult is to set up a user login for the configuration interface. How to set this up is explained in the following article.
In the article NodeRed - Encrypt connection also describes how you can encrypt the connection to your NodeRed configuration. Connection encryption is another important security plus, especially if you want to access your NodeRed configuration via the Internet.
Contents
Safety instructions
I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.
https://www.nerdiy.de/sicherheitshinweise/
Affiliate links/advertising links
The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, Nerdiy.de will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support Nerdiy.de in being able to offer other useful projects in the future. 🙂
Requirements
Helpful articles:
NodeRed should of course already be installed so that you can set up a user login.
How to prepare a RaspberryPi and then install NodeRed on it is described in the following articles.
The following three articles describe what needs to be done to prepare the RaspberryPi:
RaspberryPi – setup for nerdiys!
RaspberryPi – The first configuration!
RaspberryPi – Control the RaspberryPi via SSH
NodeRed – Installing NodeRed on the RaspberryPi
Required tool:
-no-
Required material:
In the following list you will find all the parts you need to implement this article.
Log in to the RaspberryPi via SSH
To start, you must first log in to the Rasp Pi with Putty via SSH. How to do this is in the article RaspberryPi - Control the RaspberryPi via SSH described.
Update package management
The package management in Linux is a "central place" through which various software packages can be installed. In order for this to work reliably, the lists and sources of the package management should be updated before each installation of new packages.
sudo apt-get update && sudo apt-get upgrade
Generate password hash value
The password for your user interface will later be entered in the configuration file of your NodeRed installation. As it is a security risk to save passwords as plain text (i.e. unencrypted) in configuration files, a hash value of your password is generated in this case and entered in the configuration file. It is not possible to directly deduce the password from the hash value.
So that you can generate the hash value, it is recommended to install the "node-red-admin" tools.
The command to do this is:
sudo npm install -g node-red-admin
Once the installation is complete, you can call up the hash value generator with the following command:
sudo node-red-admin hash-pw
Enter the user name and hash value in the config file
Now open the configuration file of your NodeRed installation
sudo nano /home/pi/.node-red/settings.js
Restart NodeRed
To apply the changes you have made, you must restart your NodeRed installation once. This can be done with the following command:
sudo service node red restart
Have fun with the project
I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂
PS Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂
Quick question is the whole thing under Portainer?
Once I've created a container, it takes me straight to nodered's page
Hi Mathias,
you mean you installed NodeRed as a docker container?
The same should actually work there. You probably connected the NodeRed user data to the file system of your host via a share, right?
Then you should also be able to edit the settings.js and Co. 🙂
Best regards
Fabian