Node-red: verschil tussen versies

Uit Installatie Rocky 9 Webserver
Naar navigatie springen Naar zoeken springen
Geen bewerkingssamenvatting
Geen bewerkingssamenvatting
 
(Een tussenliggende versie door dezelfde gebruiker niet weergegeven)
Regel 55: Regel 55:


Deze kun je toevoegen via de manage-pallets in node-red.
Deze kun je toevoegen via de manage-pallets in node-red.
Om een gebruiker toe te voegen:
<code>nano ~/.node-red/settings.js</code>
2. 🔐 Genereer een wachtwoord-hash
Node-RED accepteert alleen gehashte wachtwoorden. Maak er één met dit commando (in de terminal):
<code>node -e "console.log(require('bcryptjs').hashSync('jouwWachtwoord', 8));"</code>
Vervang "jouwWachtwoord" door het gewenste wachtwoord. Je krijgt iets zoals:
$2a$08$xJmWvZcZzzqWJZAG2F8JGegjsdFWevgb1raAnzIMLBwKcDj7fzJxe
Voeg gebruiker toe in settings.js
Zoek naar of voeg toe (bij voorkeur net onder adminAuth:):
adminAuth: {
    type: "credentials",
    users: [{
        username: "admin",
        password: "$2a$08$xJmWvZcZzzqWJZAG2F8JGegjsdFWevgb1raAnzIMLBwKcDj7fzJxe",
        permissions: "*"
    },
    {
        username: "gebruiker",
        password: "$2a$08$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        permissions: "read"  // alleen lezen
    }]
},
• "permissions": "*" = volledige toegang (lezen + schrijven)
• "permissions": "read" = alleen lezen (geen deploy)
Herstart Node-RED
<code>node-red-stop
node-red-start</code
of
<code>systemctl restart nodered</code>
bcryptjs installeren:
Oplossing: Installeer bcryptjs
1. Open een terminal (macOS/Linux) of command prompt (Windows)
2. Ga naar de map van Node-RED (meestal in je home directory):
<code>cd ~/.node-red
npm install bcryptjs</code>

Huidige versie van 1 jun 2025 om 09:38

Menu PhpMyAdmin Mariadb MQTT

Node-Red

Installatie Node-red.

  1. Installatie

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)


2. aanpassen pasword.


Once logged in,  a password hash needs to be generated by the Node-RED admin tool. A password hash is an encrypted representation of the chosen password. This prevents the storage of passwords as readable text.

This admin tool is already installed on the Moduline controllers. The commands below can be used directly.

Generate new pasword hash:

node-red admin hash-pw

At this point, a new password can be chosen. After –enter– the hash is generated and is shown. Select the hash and copy it to the clipboard or local file on your computer.

Now we’re going to open the Node-RED settings file where the password hash needs to be stored. The settingsfile is a .js file that can be opened and editted by nano (Linux CLI editor)

Open the file:

nano ~/.node-red/settings.js

Scroll down (arrow down when using Putty) to adminAuth: {  (see picture)

Replace both hashes for password: and pass: with the hash created during former steps. Ensure that the hash is between the quotes!

Note: If another username is required, username: and user: can also be changed here.

Once the hashes are replaces with the new one, the file can be saved with:


Na installatie voeg ik de volgende modules toe:

node-red-contrib-config

node-red-contrib-modbus

node-red-contrib-knx-ultimate

node-red-contrib-buffer-parser

node-red-dashboard

node-red-node-mysql

node-red-node-pushover

Deze kun je toevoegen via de manage-pallets in node-red.


Om een gebruiker toe te voegen:

nano ~/.node-red/settings.js

2. 🔐 Genereer een wachtwoord-hash

Node-RED accepteert alleen gehashte wachtwoorden. Maak er één met dit commando (in de terminal):

node -e "console.log(require('bcryptjs').hashSync('jouwWachtwoord', 8));"

Vervang "jouwWachtwoord" door het gewenste wachtwoord. Je krijgt iets zoals:

$2a$08$xJmWvZcZzzqWJZAG2F8JGegjsdFWevgb1raAnzIMLBwKcDj7fzJxe

Voeg gebruiker toe in settings.js

Zoek naar of voeg toe (bij voorkeur net onder adminAuth:):

adminAuth: {

   type: "credentials",
   users: [{
       username: "admin",
       password: "$2a$08$xJmWvZcZzzqWJZAG2F8JGegjsdFWevgb1raAnzIMLBwKcDj7fzJxe",
       permissions: "*"
   },
   {
       username: "gebruiker",
       password: "$2a$08$xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
       permissions: "read"  // alleen lezen
   }]

},

• "permissions": "*" = volledige toegang (lezen + schrijven) • "permissions": "read" = alleen lezen (geen deploy)

Herstart Node-RED

node-red-stop node-red-start</code

of

systemctl restart nodered

bcryptjs installeren:

Oplossing: Installeer bcryptjs

1. Open een terminal (macOS/Linux) of command prompt (Windows)

2. Ga naar de map van Node-RED (meestal in je home directory):

cd ~/.node-red

npm install bcryptjs