You’ll find plenty of articles on adding or improving the security of Node-Red and countless other programs and utilities. What are not quite so prevalent are articles about removing security.
I’ve been using Node-Red for my home automation for years now and frequently get annoyed, as the dashboard security, when used on my mobile, often forgets the password or even the username and only this weekend in a call with my friend Mr Shark in Italy (Antonio) did we hit on the (presumably obvious) way around this.
/*
adminAuth: {
type: "credentials",
users: [{
username: "admin",
password: "$2a$0nonsenseHere/PasswordChangedToProtectTheInnocent/ruBBish",
permissions: "*"
}]
},
httpNodeAuth: {user:"user", pass:"$2a$0nonsenseHere/9eJMs4ZjeeAzeQ/BlegNottheRealPassword"},
*/
So – the code above has always (as far back as I remember) been in my Node-Red settings.js file (in the /home/pi/.node-red folder)
I stopped Node-Red, commented out the code as you see above, with a single set of C-style block-comment delimiters, saved the file (as user pi) and then restarted Node-Red. It WORKS. But why would anyone want to open up their Node-Red to all and sundry on the network or for that matter, the outside world?
Simple. No-one in my household of two people + 3 cats would have any idea of the relevance of the Node-Red access ports or how to find them (just as I have no idea where the my wife hides many of the household utensils) – as for the outside world, the ONLY way to access any of my network is via the VPN I have on my kit – and I’m the only one with access to that. No I don’t use standard ports.
Linux itself seems to be built on the foundation that you are at school and have a “supervisor” or are at work with a network manager. Well, can I be the only person in the world (5 million SMEs in the UK alone, many of whom have few if any employees other than the person who owns the business) who has never worked FOR anyone, never had a supervisor and never had my own handy network administrator (though I do lean on certain blog subscribers occasionally when I get stuck).
The general idea seems to be based on the premise that you, the user are basically computer-illiterate but you have access to someone who is not. I am not and I do not. I run my home automation for me, no-one else will go near it (the cats can’t reach the keyboard) and hopefully thanks to the VPN, no-one outside of my network has access. Did I EVER need any of that security palaver? apparently not.
Can it really be that simple?
The answer of course, is no – and my gratitude to those of you who have responded in the blog and many more who got in touch privately. If there is a security breach in the VPN then removing the passwords on Node-Red could indeed open up the system to abuse – so for now in the light of comments received I have re-instated that extra layer of security and anyone interested in the above might like to consider my doubts on the subject, tempting as it is to simplify security – but that does beg the question – how do we ensure that there ARE no issues with the likes of PiVPN- I keep it fully up to date – what else can be done to make sure it does it’s job at all times? Thoughts?
And please don’t suggest more complicated-to-set-up VPN solutions – but ideas for keeping PiVPN as secure as possible at all times would be most welcome.
Hi guys – I just spotted a perfectly usable comment in here – but whoever wrote it signed themselves “Sorry, wont say” and they don’t appear to be in the subscriber database – which left me with no choice but to delete the comment.
I think that is something that you added “way back when….”. I always run mine without security (the default) and do the same as you via WireGuard vpn
Wireguard is on my Todo list…
If you are trying out Home Assistant I would recommend wireguard from the add-on store – installation and configuration is only a couple of minutes and it even provides a QR code to allow fast authorisation of your phone without the need for file transfer. It’s a much smaller binary than OpenVPN and seems faster and is very reliable. Just remember to add the port forwarding in your router.
While I have your attention…. Wireguard.. is there any easy setup for that without HA? For example – PiVPN was a Doddle to set up and a doddle to add clients to Android, my Android TV and my PC. Anything like that for Wireguard?
I think I used this guide https://github.com/adrianmihalko/raspberrypiwireguard the first time I set up wireguard over native raspbian but to be honest it was over a year ago but I seem to remember it was straightforward – every time I have installed/re-installed it since I just used the HA add on because it is so simple.
Hi – thanks for that Steve 🙂 – out of interest, compared to setting up and using PiVPN, that guide is rocket science…
https://github.com/adrianmihalko/raspberrypiwireguard
versus
https://www.pivpn.io/
I took one look at the Wireguard semi-automatic user management script and nearly fainted…
https://github.com/adrianmihalko/raspberrypiwireguard/wiki/User-management-with-Wireguard-User-Management-script
If you were happy using PiVPN then just keep on doing so… it supports WireGuard as well as OpenVPN if you use the latest version.
https://pivpn.io/#tech
just download latest pivpn, as it includes the option to choose between openvpn and wireguard now: https://www.youtube.com/watch?v=ag5hhqNrN4I
I was planningf on that – but as you now know I got sidetracked with a 3 hour failed print on my new Anycubic printer, not to mention documenting the whole affair.