Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add section on Mosquitto ACLs #5542

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

Merged
merged 2 commits into from
Jun 14, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion source/_addons/mosquitto.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Set up [Mosquitto](https://mosquitto.org/) as MQTT broker.
"ssl": false,
"anonymous": true,
"logins": [
{"username": "testuser", "password": "mypw"}
{"username": "testuser", "password": "mypw"},
{"username": "testuser2", "password": "mypw2"}
],
"customize": {
"active": false,
Expand Down Expand Up @@ -76,3 +77,22 @@ protocol mqtt
<p class='note warning'>
It's recommended that you only open your firewall to the SSL/TLS port (8883) and only use the insecure port (1883) for local devices. Also, disable `anonymous:` and set `logins:`.
</p>

### {% linkable_title Access Control Lists (ACLs) %}

It is possible to restrict access to topics based upon the user logged in to Mosquitto. In this scenario it is recommended to create individual users for each of your clients and create an appropriate ACL.

See the following links for more information:

* [Mosquitto topic restrictions](http://www.steves-internet-guide.com/topic-restriction-mosquitto-configuration/)
* [Mosquitto.conf man page](https://mosquitto.org/man/mosquitto-conf-5.html)

Add the following configuration to enable ACLs:

1. Set `customize` flag to `true` in your configuration.
2. Create a file in `/share/mosquitto` named `acl.conf` with the following contents:

```text
acl_file /share/mosquitto/accesscontrollist
```
3. Create a file in `/share/mosquitto` named `accesscontrollist` and add contents according to your requirements.