Mosquitto: Difference between revisions

imported>Onny
Add usage example
imported>Onny
Add authentication config example
Line 23: Line 23:
</syntaxHighlight>
</syntaxHighlight>


== Configuration ==
=== Password authentication ===
The following command will generate a hashed representation for the password <code>mypasswd</code>.
<syntaxHighlight lang="bash">
echo mypasswd | mkpasswd -m sha-512 -s | sed 's/$/==/'
</syntaxHighlight>
Change the Mosquitto listeners configuration by addming a user, in this example called <code>root</code> with the hased password from the command above.
<syntaxHighlight lang="nix">
mosquitto = {
  enable = true;
  listeners = [
    {
      users.root = {
        acl = [
          "readwrite #"
        ];
        hashedPassword = "$6$ww4noj7Iu2BWqfaL$FyM68Iq5mpqoQZWnB/.xbgq3e3eM2J/Fe7qGBfz52TFu9DpTflliL2oo8iK26ARZckYpZF7lLltrqENSEahgk.==";
      };
    }
  ];
};
</syntaxHighlight>


== Usage ==
== Usage ==