node-red

How to secure nodered with username and password


How can I add authentication for nodered console while running through docker?

docker-compose :

  node-red:
    container_name: nodered
    image: nodered/node-red
    ports:
      - "1880:1880"
    links:
      - redis
    volumes:
      - node_red_data:/node_modules      
    networks:
     - unifactNetwork 

I tried to volume mount the node_modules directory inside the container and tried to run node-red-admin hash-pw inside the container and updated the node-red-admin/settings.js file with the new token. But that didn't help.


Solution

  • Your volume mount won't work. /node_modules is not a directory used by anything.

    As described in the README.md for the Node-RED container, the userDir is at /data. You will need to include a modified settings.js in a volume mounted to this directory.

    Running node-red-admin in an already running container again won't work because the /data/settings.js file is read when Node-RED is started so editing after the start will not change what it running.