Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for certificate connection via mqtt #804

Closed
hisabimbola opened this issue May 7, 2023 · 4 comments
Closed

Add support for certificate connection via mqtt #804

hisabimbola opened this issue May 7, 2023 · 4 comments
Labels
backend Backend related enhancement New feature or request prio:medium

Comments

@hisabimbola
Copy link

I'm using victron and to connect to public mqtt one needs to pass in a certificate. This is currently not possible.

Is it possible to add this functionality?

Thanks for the work

@pkuehnel
Copy link
Owner

pkuehnel commented May 7, 2023

It should be possible, as I am using MqttNET for MQTT connections. (Note for me: dotnet/MQTTnet#115 (comment)).

But as I am currently pretty busy and this is a lot of work to do (adding file upload for certificate upload), this is nothing that will be implemented in the near future. I recommend you use Modbus TCP (should work on Victron) or any other Middleware for that, e.g., HomeAssistant or something like that.

If you could create a PR for that, the Solar MQTT Authentication is here from line 49 to 54.

@pkuehnel pkuehnel added enhancement New feature or request backend Backend related prio:medium labels May 7, 2023
@hisabimbola
Copy link
Author

Yeah, I have a very dirty implementation for that here but it works for me.

I think a quick implementation could be to store the cert in a folder, same as the docker-compose and then maybe add a checkbox in the UI that selects tls if true, then it'll search for the cert name and if found, will use that to connect.

What you think about that basic implementation

@pkuehnel
Copy link
Owner

pkuehnel commented May 8, 2023

Little dirty, yes, but easily fixable: Add the file to the docker volume and implement the file name pattern like baseConfig.json. To do that follow these steps:

  • Add the filename of the cert to the appsettings.json
  • Do not use a fixed path for your cert but implement a new Method for getting the path in IConfigurationWrapper (just do the same what ConfigurationWrapper.BaseConfigFileFullName() does)
  • Use the newly created IConfigurationWrapper.SolarMqttCertFileFullName() in SolarMqttService
  • Add .WithTls only if that file exists

When done, you can create a pull request, and I will do the UI and file upload things when I have time to do it. But you can already use that feature when you manually copy your certificate in your Docker Volume and get all future updates.

@pkuehnel pkuehnel added the waiting for feedback Waiting for feedback of issue creator label May 8, 2023
@hisabimbola
Copy link
Author

I'll close this issue as I ended using local mqtt and that works for me.

@github-actions github-actions bot removed the waiting for feedback Waiting for feedback of issue creator label May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Backend related enhancement New feature or request prio:medium
Projects
None yet
Development

No branches or pull requests

2 participants