Does anyone successfully has successfully set up a TLS MQTT communication with IIoT Library ?
I have created a PKI and a Mosquitto broker. It works fine and I can use it with several client.
Then I want to do it with MQTT function block from CODESYS (WAGO dataagent works fine).
I import my client certificate in .pfx file. I even tried to import the CA certificate.
As soon as I enable Peer verification in the TLSContext the connection is bad and I get this message on my mosquitto broker :
OpenSSL Error[0]: error:0A000410:SSL routines::ssl/tls alert handshake failure
1764601655: Client disconnected: Protocol error.
Any idea ?
Thanks
Idk if this is related but for an application with a customer which use TLS connection I had to do this from time to time:
_sWgetCommand := 'wget https://curl.se/ca/cacert.pem -P /etc/ssl/certs';
WagoSysProcess.FuExecuteCommand(
sCommand := _sWgetCommand,
R_sStdOut := _sWgetStdOut,
uiStdOutSize := SIZEOF(_sWgetStdOut),
R_sStdError := _sWgetStdError,
uiStdErrorSize := SIZEOF(_sWgetStdError),
tTimeout := T#5S,
pResult := ADR(_eWgetResult)
);
Hey @quenorha,
i ran across your thread yesterday while searching for a working example myself. I managed to fix it myself today and learned a lot about codesys-specialties regarding TLS. If your question is still present, just give me some information about the steps you already tried and we will find a solution!
Best regards
Marcel
Hello Marcel,
Thanks. I finally find it out. I was totally missing that I had to add my CA cert in the trust area.
I’ll try to send capture when I find some time.
1 Like