Skip to content

Guide

How to Secure Node-RED: Password, HTTPS, MQTT TLS and Backups

Node-RED has no login by default. Add an editor password, protect the dashboard, enable HTTPS, use a VPN, lock down MQTT with TLS and ACLs, and back up safely.

  • 6 min read
  • Updated November 2, 2026
How to Secure Node-RED: Password, HTTPS, MQTT TLS and Backups

Quick answer: to secure Node-RED, (1) generate a password hash with node-red admin hash-pw and paste it into the adminAuth block of ~/.node-red/settings.js so the editor needs a login; (2) protect dashboards and HTTP In routes separately with httpNodeAuth; (3) serve it over HTTPS, either with the https option in settings.js or behind a reverse proxy, and reach it from outside through a VPN rather than an open port 1880; (4) give MQTT a password, topic ACLs and TLS on port 8883; (5) set a credentialSecret and back up flows.json, flows_cred.json, settings.js and package.json. Then restart Node-RED and test the login from another device.

Out of the box, Node-RED has no login at all: anyone who can reach port 1880 can open the editor, read your flows, change what your relays do, and run code through Function and exec nodes. That's fine on a laptop, risky on a home network, and dangerous on the internet, where exposed Node-RED instances are routinely found by scanners.

LayerDefaultAfter this guide
Editor and admin APIOpen to anyone on the networkUsername + bcrypt password
Dashboard and HTTP In routesOpenSeparate login (httpNodeAuth)
TransportPlain HTTPHTTPS
Remote accessPort forwarding (please don't)VPN or authenticated reverse proxy
MQTTOften anonymous on 1883Per-device users, ACLs, TLS on 8883
Stored credentialsEncrypted with an auto-generated keyEncrypted with your own credentialSecret, backed up

1. Add a login to the editor (adminAuth)

Generate a bcrypt hash of your chosen password (Node-RED 1.1 or newer):

terminal
node-red admin hash-pw

Type the password when asked; it prints a hash starting with $2b$08$. Open ~/.node-red/settings.js (on Windows: C:\Users\<you>\.node-red\settings.js), find the commented-out adminAuth block, and replace it with:

script.js
adminAuth: {
  type: "credentials",
  users: [{
      username: "admin",
      password: "$2b$08$PASTE_YOUR_OWN_HASH_HERE",
      permissions: "*"
  }]
},

Restart Node-RED (node-red-stop && node-red-start on a Pi installed with the official script, or sudo systemctl restart nodered) and reload the editor: you should now get a login screen. Want a second, read-only account for someone who only needs to look? Add another user with permissions: "read".

Never copy a sample hash from a tutorial: it belongs to a password someone else knows. If node-red admin hash-pw isn't found, install the admin tool with sudo npm install -g node-red-admin and run node-red-admin hash-pw.

2. Protect the dashboard and HTTP endpoints

adminAuth only protects the editor and admin API. HTTP In routes, and in a standard install the dashboard, are served separately and stay open until you add httpNodeAuth (one shared login for all of them):

script.js
httpNodeAuth: { user: "family", pass: "$2b$08$PASTE_ANOTHER_HASH" },

Use a different password from the admin account, so people who use the dashboard can't edit flows. Static files served with httpStatic have their own httpStaticAuth option in the same format. For per-user dashboard logins, put the dashboard behind a reverse proxy or an identity-aware proxy that handles accounts.

Any HTTP In endpoint a device posts to should also validate its input (method, fields, value ranges) and, ideally, check a shared token header. "It's only on my LAN" isn't a security model: one compromised smart plug is on your LAN too.

3. Turn on HTTPS

Without HTTPS, your login password crosses the network in plain text. Two ways to fix it:

MethodGood forHow
Node-RED's own HTTPSOne machine on your LANPoint the https option at a certificate and key
Reverse proxy (Caddy, nginx, Traefik)Several services, a real domain, automatic Let's Encrypt certificatesProxy terminates TLS and forwards to localhost:1880

For a LAN-only setup, create a self-signed certificate (or use mkcert for one your devices can trust):

terminal
cd ~/.node-red
openssl req -x509 -newkey rsa:2048 -nodes -keyout privkey.pem -out cert.pem -days 825 -subj "/CN=nodered.local"

Then, in settings.js:

script.js
https: {
  key: require("fs").readFileSync("/home/pi/.node-red/privkey.pem"),
  cert: require("fs").readFileSync("/home/pi/.node-red/cert.pem")
},
requireHttps: true,

Restart, and open https://<pi-ip>:1880. Browsers warn about a self-signed certificate the first time; that is expected for a private cert, unlike a warning on a public site. If you use a reverse proxy instead, leave Node-RED on plain HTTP but bind it to localhost (uiHost: "127.0.0.1") so the proxy is the only way in.

4. Remote access: VPN, not port forwarding

Do not forward port 1880 on your router. Even with a password, you are exposing the editor to every scanner on the internet. Safer options, in order of simplicity:

  1. Tailscale or WireGuard VPN: your phone joins your home network privately and you open Node-RED as if you were at home. Nothing is exposed.
  2. Cloudflare Tunnel or a reverse proxy with an extra login in front of Node-RED, with HTTPS and adminAuth still enabled.
  3. FlowFuse or another managed host, if you'd rather not run the security yourself.

5. Lock down MQTT: passwords, ACLs and TLS

Mosquitto 2.x refuses remote anonymous clients by default; keep it that way and give every device its own account:

terminal
sudo mosquitto_passwd -c /etc/mosquitto/passwd nodered
sudo mosquitto_passwd /etc/mosquitto/passwd esp32-kitchen

Restrict what each account may touch with an ACL file (/etc/mosquitto/acl):

Output
user nodered
topic readwrite home/#

user esp32-kitchen
topic write home/kitchen/sensor/#
topic read home/kitchen/cmd/#

Add a TLS listener next to (or instead of) port 1883 in /etc/mosquitto/conf.d/secure.conf:

Output
listener 8883
cafile /etc/mosquitto/certs/ca.crt
certfile /etc/mosquitto/certs/server.crt
keyfile /etc/mosquitto/certs/server.key
password_file /etc/mosquitto/passwd
acl_file /etc/mosquitto/acl
allow_anonymous false

In Node-RED, open the mqtt-broker config node: set port 8883, tick Use TLS, add a TLS configuration with your ca.crt, and keep Verify server certificate on. Enter the username and password on the Security tab: Node-RED stores them in the encrypted credentials file, not in the flow.

Inside a trusted LAN, passwords and ACLs on 1883 are a reasonable start; TLS becomes essential once traffic crosses Wi-Fi you don't control or the internet. Full broker setup: install Mosquitto on a Raspberry Pi.

6. Protect stored credentials and back up properly

Passwords and tokens you type into config nodes are saved, encrypted, in flows_cred.json. If you don't set a key, Node-RED generates one and hides it in .config.runtime.json; lose that file and every stored credential becomes unreadable on restore. Set your own key in settings.js:

script.js
credentialSecret: "a-long-random-string-you-store-in-your-password-manager",

(Changing it on an existing install re-encrypts credentials on the next deploy, so do it once and keep the value safe.)

Back up these files from ~/.node-red:

FileContains
flows.jsonYour flows
flows_cred.jsonEncrypted credentials (useless without the credentialSecret)
settings.jsLogin, HTTPS and all runtime options
package.jsonThe list of installed palette nodes, so npm install can restore them
.config.runtime.jsonThe auto-generated credential key, if you didn't set your own

A simple nightly backup on a Pi:

terminal
tar czf ~/backups/node-red-$(date +%F).tgz -C ~/.node-red flows.json flows_cred.json settings.js package.json .config.runtime.json

Copy the archive off the device (NAS, another machine, encrypted cloud storage). Test a restore once: unpack into a fresh ~/.node-red, run npm install there, start Node-RED and confirm the flows and connections work.

Version control: enable Projects (editorTheme: { projects: { enabled: true } } in settings.js) to commit flows to Git from inside the editor. Use a private repository, and never commit settings.js containing real hashes or keys to a public one.

7. Keep Node-RED and its nodes up to date

  • Update Node-RED and Node.js regularly; on a Pi, re-running the official install script upgrades both.
  • Install only the palette nodes you need, prefer ones that are actively maintained, and remove unused ones.
  • Back up before a major update and read the release notes for breaking changes.
  • Be careful with nodes that run shell commands (exec, daemon): anyone who can edit flows can use them, which is exactly why the editor login matters.
  • Run Node-RED as a normal user, never as root.

Security checklist

CheckDone when
Editor loginLogin screen appears from another device; wrong password is rejected
Read-only usersViewers have permissions: "read"
Dashboard / HTTP InhttpNodeAuth set, with a different password
HTTPSEditor loads on https://; plain http:// is refused or redirected
Remote accessNo router port forward to 1880; VPN or authenticated proxy instead
MQTTNo anonymous access; one account per device; ACLs; TLS on 8883 where needed
SecretsTokens only in config nodes or env variables, never in Function code or exported flows
BackupscredentialSecret stored safely; nightly archive copied off-device; restore tested
UpdatesNode-RED, Node.js and palette nodes current
Physical safetyCritical equipment has local interlocks, not just a dashboard button

Troubleshooting

ProblemLikely causeFix
Node-RED won't start after editing settings.jsSyntax error (missing comma or bracket)Run node-red in a terminal to see the line number; check commas between blocks
Login always says "Login failed"Hash pasted with spaces or truncated; wrong usernameRegenerate with node-red admin hash-pw and paste the whole string
Locked out of the editorForgotten passwordEdit settings.js on the device, put in a new hash, restart
ENOENT on startup after enabling httpsWrong certificate pathUse absolute paths and check file permissions for the Node-RED user
Dashboard still opens without a passwordOnly adminAuth setAdd httpNodeAuth and restart
"Credentials could not be decrypted" after restoreDifferent or missing credentialSecret / .config.runtime.jsonRestore the original key, or re-enter the credentials
MQTT node stuck "connecting" on 8883CA file wrong, hostname doesn't match the certificate, or port blockedTest with mosquitto_sub --cafile ca.crt -p 8883 -h <host> ...; the certificate CN/SAN must match the host name you use
Missing nodes after restorePalette packages not reinstalledRun npm install in ~/.node-red, then restart

FAQ

Does Node-RED have a password by default? No. The editor is open until you configure adminAuth in settings.js.

Where is settings.js? In the Node-RED user directory: ~/.node-red/settings.js on Linux and a Raspberry Pi, C:\Users\<you>\.node-red\settings.js on Windows, and /data/settings.js in the official Docker image. The startup log prints the exact path.

Is it safe to expose Node-RED to the internet with just a password? It's much better than no password, but still not recommended. Use a VPN such as Tailscale or WireGuard, or an authenticated reverse proxy with HTTPS in front of it.

Does adminAuth protect the dashboard? No. Use httpNodeAuth for the dashboard and HTTP In routes.

How do I reset a forgotten Node-RED password? Generate a new hash, replace it in settings.js and restart. Anyone with shell access to the device can do this, so protect the device itself too.

Next steps

Official reference: Securing Node-RED and the Mosquitto configuration manual.

Continue learning

Related articles

All articles

Signal In

Built from what makers search for

The lookups piling up in SolderHub's search bar every day shape what we publish next — new component pages, board guides, and firmware notes, sent out as they go live.

By subscribing you agree to our Privacy Policy. Unsubscribe anytime.