1

I am new to mqtt mosquitto. I want to create some user in mosquitto programmatically in C#, so that when I create topic only assigned users can subscribe to that topic.

  • can I create x509certificate ,so that my device will install these certificate and I can authenticate at the time of subscribe message. If possible then how.
  • if x509certificate is not supported by mqtt mosquitto so how authentication will work(by creation of user only or there is some other mechanism).
  • when I am using this:

    _client = MqttClientFactory.CreateClient(address, obj.ClientID,"username","password");
    

    then broker connection error occurs.

  • with one topic how much user can be created.

jezrael
  • 822,522
  • 95
  • 1,334
  • 1,252
Abhinav Sharma
  • 299
  • 1
  • 8
  • 20

2 Answers2

1

Yes, Mosquitto supports X.506 certificates and you can use that as your authentication method. The option in the config file is

use_identity_as_username true

Check the config file documentation for specific details on how to use it. Here: http://mosquitto.org/man/mosquitto-conf-5.html

0

1. Authenticating users using Mosquitto As per the man page of mosquitto MQTT provides username/password authentication as part of the protocol. Use the password_file option to define the valid usernames and passwords. Be sure to use network encryption if you are using this option otherwise the username and password will be vulnerable to interception.

Also check this SO question which gives more insight Programmatically setting access control limits in mosquitto

2. Using X.506 Certificates As already mentioned by Luis Obando you can use the x.506 certificates

3. Handling ACL May be you might need to handle separate program to manage using the plug in mosquitto-auth-plug

Community
  • 1
  • 1
Siva Karthikeyan
  • 544
  • 8
  • 25