Skip to content
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

amqtt server not relaying traffic #60

Open
sjlongland opened this issue Apr 25, 2021 · 5 comments
Open

amqtt server not relaying traffic #60

sjlongland opened this issue Apr 25, 2021 · 5 comments

Comments

@sjlongland
Copy link
Contributor

Platform: Debian GNU/Linux 10 (Buster) on AMD64, also reproduced on Gentoo/AMD64
amqtt installed either from pypi or via git using pip.

A simple test without a configuration file… if I open up three terminal windows:

  1. I run amqtt (no arguments)… the server starts successfully, binds to port 1883, listens for traffic. So far so good.
  2. Second terminal I run amqtt_sub --url mqtt://localhost -t \# (note the backslash: needed on most shells to escape the #), it starts, connects and waits for traffic. amqtt on terminal (1) reports a client has connected.
  3. Third terminal, I run amqtt_pub --url mqtt://localhost -t /testing -m 'test message'… it exits without error.

After running that test, no traffic is observed on terminal (2). If I kill amqtt and amqtt_sub, start up another MQTT server such as Mosquitto in place of amqtt, then repeat steps 2 & 3, I see the traffic relayed.

I have also tried setting up a configuration file with a password list and using authenticated users, it still fails to pass through traffic.

The idea of an embeddable and extensible MQTT server is fantastic, so I'm really hoping I can get this working but I'm starting simple first before I try hacking things.

@volkerjaenisch
Copy link

I can confirm the findings of @sjlongland .
Going into the code.
Volker

@FlorianLudwig
Copy link
Member

@sjlongland thanks for reporting this issue!

The issue is the TopicAccessControlListPlugin - It should be possible to use amqtt without having any ACLs defined but currently it is not. As there a merge request refactoring that plugin (see #42) - we will deal with that first and ensure to add a test reproducing this issue.

I will see if I can help there this week and take on this one afterwards.

@sjlongland
Copy link
Contributor Author

So, if I understand the bug correctly, if I configure an access control list (which ultimately will be my aim), it will work… it just doesn't work without an ACL due to a logic error?

@sjlongland
Copy link
Contributor Author

So, others that might want to put the server through its paces… this gets things actually working:

# config.yml
{
    "listeners": {
        "default": {
            "type": "tcp",
            "bind": "0.0.0.0:1883",
        },
    },
    "sys_interval": 10,
    "auth": {
        "allow-anonymous": True,
        "plugins": ["auth_anonymous"],
    },
    "topic-check": {
        "enabled": True,
        "plugins": ["topic_acl"],
        "acl": {
            # username: [list of allowed topics]
            "anonymous": [
                "#"
            ],
        },
    },
}

amqtt -c config.yml -d

@FlorianLudwig
Copy link
Member

I am still a bit hesitant to change defaults to far away from hbmqtt.

To fix this issue we should do two things:

  1. rework the plugin system
  2. improve documenttion how to use amqtt as a stand alone broker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants