Commit a69096e1 authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Merge branch 'dev' into 'master'

Dev

See merge request redmic-project/mqtt/vernemq!6
parents a662166f 015412ef
Loading
Loading
Loading
Loading
+46 −1
Original line number Diff line number Diff line
# VerneMQ

MQTT broker
 No newline at end of file
MQTT broker.


## Client management

Check official docs about this topic here: https://docs.vernemq.com/configuration/db-auth#redis

To interact with database, you have to run `redis-cli` inside `vmq-redis` running container.
Use `docker exec ...` or start a shell session through Portainer to access `vmq-redis`.


### List clients

```
$ redis-cli

> KEYS *

```


### Create client

```
$ redis-cli

> SET "[\"\",\"test-client\",\"test-user\"]" "{\"passhash\":\"$2a$12$WDzmynWSMRVzfszQkB2MsOWYQK9qGtfjVpO8iBdimTOjCK/u6CzJK\",\"subscribe_acl\":[{\"pattern\":\"a/+/c\"}]}"

```

Here, you define a new key `"[\"\",\"test-client\",\"test-user\"]"` (empty mountpoint, `test-client` client ID, `test-user` username) with value `"{\"passhash\":\"$2a$12$WDzmynWSMRVzfszQkB2MsOWYQK9qGtfjVpO8iBdimTOjCK/u6CzJK\",\"subscribe_acl\":[{\"pattern\":\"a/+/c\"}]}"`.

This value contains a bcrypt password hash `passhash` and a list of topic patterns `subscribe_acl` with granted access for this client.

Decide a new password and generate a bcrypt hash (with 12 rounds) for it.
You can use any tool, https://www.browserling.com/tools/bcrypt for example.


### Delete client

```
$ redis-cli

> DEL "[\"\",\"test-client\",\"test-user\"]"

```
+1 −0
Original line number Diff line number Diff line
@@ -14,3 +14,4 @@ EXTERNAL_SECURE_MQTT_PORT=8883
SECURE_MQTT_PORT=8883
PORT_MODE=ingress
REDIS_DATA_VOL_NAME=vernemq-redis-data-vol
TRAEFIK_SUBDOMAIN=vernemq
+2 −1
Original line number Diff line number Diff line
@@ -60,7 +60,8 @@ services:
      update_config:
        delay: ${VERNEMQ_UPDATE_DELAY:-1m}
      labels:
        traefik.frontend.rule: Host:${TRAEFIK_SUBDOMAIN:-vernemq}.${PUBLIC_HOSTNAME};PathPrefix:/status
        traefik.root.frontend.rule: Host:${TRAEFIK_SUBDOMAIN}.${PUBLIC_HOSTNAME};Path:/;AddPrefix:/status
        traefik.resources.frontend.rule: Host:${TRAEFIK_SUBDOMAIN}.${PUBLIC_HOSTNAME};PathPrefix:/status/{path:js|css|img},/status.json
        traefik.backend: vernemq
        traefik.port: '${HTTP_PORT:-8888}'
      resources: