• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Node-Red MQTT with SSL/TLS can't connect to broker
#1
hey there

i'm trying to connect my node-red flow to our MQTT-Broker with a secure TLS connection (Port 8883). I have the same node-red flow on a normal raspberry pi and it works without a problem. Within the "hilschernetpi/netpi-nodered-fieldbus" docker container, it just can't connect. i checked the port with nmap within the docker container, and it says "8883/tcp open secure-mqtt" which should be allright.

I can connect to the MQTT-Broker without TLS (Port 1883) without any problems, but thats not secure enough for our application.

Do you have any ideas what to try next?

Thank you for your answer!
  Reply
#2
The main question I have is what happens if you install "Docker" on your Rpi and let then run the same container there. I just want to exclude that this problem is in any relation to netPI plattform itself.

I think you might have recognize that netPI is just a Docker host and not designed to make any in-deep developments and debugging tasks. For netPI a Raspberry Pi 3 is the cheapest development platform you can think of. So please try to run the container on your Rpi3 first and check if it works.

Then a word to the secured communication. Your referenced container "hilschernetpi/netpi-nodered-fieldbus" has no TLS respectively openssl installed by default. Hence no client certificates have been generated in accordance with your secured MQTT broker. Have you uploaded those certificates in your MQTT node-red node correctly?
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#3
Meanwhile I made tests across the web site https://test.mosquitto.org/ which hosts a secured and public MQTT server for everybody that can be used for test purposes.

In accordance with the description provided on this page I configured my MQTT node-red node that comes in the "hilschernetpi/netpi-nodered-fieldbus" by default. I generated a client.key file on my windows machine as described using openssl and I used it on the web page to generate the certificate file "client.crt" and I was using the provided CA certificate "mosquitto.org.crt" as well and inserted all 3 files in the upload dialog and configured the server as "test.mosquitto.org:8883"

Immediately after deploy the node-red MQTT output node goes into connected state. I also configured a input node as well and send data to a topic "test" which I was receiving back to my flow in this input node when I injected a test pattern.

So I cannot confirm what you are seeing.
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#4
387 Wrote:The main question I have is what happens if you install "Docker" on your Rpi and let then run the same container there. I just want to exclude that this problem is in any relation to netPI plattform itself.

unfortunately i can't get the docker running on my RPi3, propably due to the missing hat...
i get following error messages :
SPIHWIFInit: Failed to read from serial DPM. Incorrect DPM status of SPI device '/dev/spidev0.0' (0x0).
SPIHWIFInit: Check the SPI connection and the serial DPM configuration of the device connected on '/dev/spidev0.0'.
Error adding plugin (netx-spm.so) device 0@0x0. (Status=0x800A0009)
unknown hardware detected, cannot start

so i can't verify the behaviour on a normal RPi
  Reply
#5
Yes if you use the "hilschernetpi/netpi-nodered-fieldbus" image as it comes and you have no HAT on your Rpi it will indeed report this error.

You could start the container differently on your Rpi with different parameters in order not to start the default script file which is looking for netPI or HAT:

docker run -it -p 1880:1880 -p 9000:9000 --device=/dev/spidev0.0 -e "FIELD=pns"--restart=always --network=host --entrypoint=/bin/bash hilschernetpi/netpi-nodered-fieldbus

Use this command line above to jump into the container and suppress starting the default start script file. No error will arise then.

After the container is now started, then please enter the command node-red which starts now node-red manually. There will be some warnings that can be ignored, node-red will start anyway and also the MQTT node can be used.

By this procedure you can use the fieldbus container and test MQTT. Of course the fieldbus node cannot be used in this constellation but this is not matter of this topic. You just want to test MQTT connectivity, right?

Thanks











You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#6
I was able to solve the problem. You can consider the thread as SOLVED. thank you for your help.

we are using server side certificates only.
i tested the certificate with openssl in the docker console :
openssl s_client -showcerts -servername [server] --connect [server]:8883
and saw that the certificate wasn't accepted.

Issue was a faulty system-time. i connected the module through the webinterface to a ntp-server and now everything works fine.
  Reply
#7
Thanks for letting me know. Indeed setting the system time is the first thing to be done on netPI to get proper operation.
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Node Red configuration LucioFiam 3 1,653 November-30th-2022, 05:14 PM
Last Post: Armin@netPI
  secure node-red with a username and password Christian_Rau 3 2,848 December-3rd-2021, 11:06 AM
Last Post: Armin@netPI
  cifx0 and Node-Red fabio1975 5 3,108 November-22nd-2021, 01:13 PM
Last Post: Armin@netPI
  Node red web UI issue DSongra 3 3,154 July-22nd-2021, 02:47 PM
Last Post: Armin@netPI
  Node-RED 'projects' possible on netPI? JG_KIT 2 2,305 July-20th-2021, 01:11 PM
Last Post: JG_KIT
  Node-RED: OpcUa Client node tad 4 4,398 June-9th-2021, 08:51 AM
Last Post: tad
  Mosquitto MQTT Broker Armin@netPI 8 5,384 March-3rd-2021, 11:57 AM
Last Post: tad
  MQTT test DSongra 12 7,597 October-20th-2020, 08:20 AM
Last Post: Armin@netPI
  Accessing a modbus device connected to RTE port from Node-RED tad 10 7,907 October-2nd-2020, 07:21 AM
Last Post: Armin@netPI
  5 x NL 50-Mpi and Node Red like colector data? Jotarod 4 3,887 September-14th-2020, 01:59 PM
Last Post: Armin@netPI

Forum Jump:


Users browsing this thread: 1 Guest(s)