emqx / emqx/emqx-auth-pgsql

MQTT was disconnected due to badmatch error

Open
#188 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Erlang
Stars
36
Forks
30
PR merge metrics
No merged PRs in 30d

Description

I use mqtt acl table as follows
| id | allow | ipaddr | username | clientid | access | topic |
| :----: | :----: | :----: | :----: | :----: | :----: | :----: |
| 1 | 1 | NULL | test | NULL | 3 | # |

The following configuration has also been modified
```
allow_anonymous = false
acl_nomatch = deny
sed -i '/{allow, all}./d' /opt/emqx/etc/acl.conf # delete {allow, all}.
```

and use emqx-auth-pgsql to certification.

There is no problem with the `superuser` but the following problem occurs with **normal users** such as test

Python MQTT as follows
```
def on_connect(client, userdata, flags, rc):
logger.info("Connected with result code " + str(rc))
if rc == 5:
logger.critical("auth failed")
client.subscribe(f"device1/#",2)
client = mqtt.Client(client_id = client_id)
client.on_connect = on_connect
client.username_pw_set(test,test)
client.connect(ip, port, 60)
client.loop_forever()
```

When I execute my `python code`, I keep output like this
```
INFO:main:Connected with result code 0
INFO:main:Connected with result code 0
INFO:main:Connected with result code 0
....
```

I subscribed to the system topic `$SYS/brokers/+/clients/#` and found that the python client had been connecting and then disconnected
```
{'clean_start': True, 'clientid': 'client_id', 'connack': 0, 'ipaddress': 'xxxx', 'keepalive': 60, 'proto_name': 'MQTT', 'proto_ver': 4, 'ts': 1587053466406, 'username': 'test'}
{'clientid': 'agent_eVEoS49gxJtspEKE2vkJtW', 'username': 'test', 'reason': 'badmatch', 'ts': 1587053466407}
.....
```
Where did I misconfigure this badmatch disconnect problem?

> I used an `emqx:v3.2.4` docker image

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.