Code Monkey home page Code Monkey logo

Comments (3)

rido-min avatar rido-min commented on June 27, 2024

Hi @Basko-Dev

Thanks for describing your issue.

To help with this we need to understand how the endpoint is configured:

  1. Does the endpoint use a trusted CA certificate? (this might be a different by OS, since Linux and Windows have different trust stores)
  2. Which version of .NET are you using?
  3. Can you run openssl s_client -connect 10.76.75.106:8883 and paste the results here? If you are using a custom CA, run the command with the parameter --CAfile

Flow and errors should be the same on Windows and Linux.

I understand the expectation, but MQTTnet is not implementing the TLS stack, it's based on .NET having different implementations per platform, and each platform might handle CA certificates differently.

I guess the callback is not triggered in Windows because the TLS stack fails before starting the certificate validation.

from mqttnet.

Basko-Dev avatar Basko-Dev commented on June 27, 2024

Hi @rido-min,

ad1. my MQTT broker uses self-signed CA certificate.
ad2. .NETCore 6.0.27
ad3. See the attached logs:
openssl s_client -connect broker_ip:8883 --CAfile cacert-v3.crt: s_client_with_cafile.txt
openssl s_client -connect broker_ip:8883: s_client_without_cafile.txt

from mqttnet.

rido-min avatar rido-min commented on June 27, 2024

.NET 7 introduced a new API to validate the chain with a CAfile, since you are in .NET6 you might need to implement the validation by yourself. Here is an example (note it's not in main, and I'm pointing to a specific commit)

https://github.com/Azure-Samples/MqttApplicationSamples/blob/4e785ae65e331d95cefd38a7b8d4f944a83fe209/mqttclients/dotnet/MQTTnet.Client.Extensions/WithTlsSettings.cs#L18

https://github.com/Azure-Samples/MqttApplicationSamples/blob/4e785ae65e331d95cefd38a7b8d4f944a83fe209/mqttclients/dotnet/MQTTnet.Client.Extensions/X509ChainValidator.cs

from mqttnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.