github.com/lei006/gmqtt-broker@v0.0.1/plugins/auth/authfile/Readme.md (about) 1 ## ACL Configure 2 ``` 3 Attention: Acl Type Change, change `pub =1, sub=2` to `sub =1, pub=2` 4 ``` 5 #### The ACL rules define: 6 ~~~ 7 Allow | type | value | pubsub | Topics 8 ~~~ 9 #### ACL Config 10 ~~~ 11 ## type clientid , username, ipaddr 12 ##sub 1 , pub 2, pubsub 3 13 ## %c is clientid , %u is username 14 allow ip 127.0.0.1 2 $SYS/# 15 allow clientid 0001 3 # 16 allow username admin 3 # 17 allow username joy 3 /test,hello/world 18 allow clientid * 1 toCloud/%c 19 allow username * 1 toCloud/%u 20 deny clientid * 3 # 21 ~~~ 22 23 ~~~ 24 #allow local sub $SYS topic 25 allow ip 127.0.0.1 1 $SYS/# 26 ~~~ 27 ~~~ 28 #allow client who's id with 0001 or username with admin pub sub all topic 29 allow clientid 0001 3 # 30 allow username admin 3 # 31 ~~~ 32 ~~~ 33 #allow client with the username joy can pub sub topic '/test' and 'hello/world' 34 allow username joy 3 /test,hello/world 35 ~~~ 36 ~~~ 37 #allow all client pub the topic toCloud/{clientid/username} 38 allow clientid * 2 toCloud/%c 39 allow username * 2 toCloud/%u 40 ~~~ 41 ~~~ 42 #deny all client pub sub all topic 43 deny clientid * 3 # 44 ~~~ 45 Client match acl rule one by one 46 ~~~ 47 --------- --------- --------- 48 Client -> | Rule1 | --nomatch--> | Rule2 | --nomatch--> | Rule3 | --> 49 --------- --------- --------- 50 | | | 51 match match match 52 \|/ \|/ \|/ 53 allow | deny allow | deny allow | deny 54 ~~~