emqx / emqx-auth-mnesia

Authentication, ACL with Erlang Mnesia
Apache License 2.0
2 stars 3 forks source link

Getting "Connection Refused: not authorised" #58

Closed damian154 closed 3 years ago

damian154 commented 3 years ago

I'm running the latest docker image of emqx with the mnesia plugin enabled, and i can't correctly set a default super user. I read the documentation and i can't find where is the error in my config.

This is the docker compose file i'm using:

version: '3'
services:
  broker:
    image: emqx/emqx:latest
    ports:
      - 1883:1883
      - 18083:18083
    environment:
       - EMQX_LOADED_PLUGINS=emqx_recon,emqx_retainer,emqx_management,emqx_dashboard,emqx_auth_mnesia
       - EMQX_ALLOW_ANONYMOUS=false
       - EMQX_ACL_NOMATCH=deny
       - EMQX_AUTH__MNESIA__AS=username
       - EMQX_AUTH__MNESIA__PASSWORD_HASH=plain
       - EMQX_AUTH__MNESIA__1__LOGIN=super
       - EMQX_AUTH__MNESIA__1__PASSWORD=secret
       - EMQX_AUTH__MNESIA__1__IS_SUPERUSER=true

Am i missing something? I was able to correctly configured the mongo plugin, so i don't understand where's the issue here. Any help would be greatly appreciated.

HJianBo commented 3 years ago

There is an ambiguity in emqx/emqx:latest. Can you see the exact version number of emqx on the dashboard?


In my case, it is emqx/emqx:v4.3-rc.4. If you are too, your environment variables should be:

    environment:
       - EMQX_LOADED_PLUGINS=emqx_recon,emqx_retainer,emqx_management,emqx_dashboard,emqx_auth_mnesia
       - EMQX_ALLOW_ANONYMOUS=false
       - EMQX_ACL_NOMATCH=deny
       - EMQX_AUTH__MNESIA__AS=username
       - EMQX_AUTH__MNESIA__PASSWORD_HASH=plain
       - EMQX_AUTH__USER__1__USERNAME=super
       - EMQX_AUTH__USER__1__PASSWORD=secret

And, it does not support to configure a super user

damian154 commented 3 years ago

I tried with the version 4.3-rc.4 with the exact same configuration you posted but still no luck. I leave mi docker-compose file and the acl configuration. Right now i'm getting "Connection Refused: bad user name or password":

HJianBo commented 3 years ago

Sorry @damian154 It is a BUG on v4.3-rc.*, As a result of this bug, we can only store the password using sha256.

I have fixed it in https://github.com/emqx/emqx/pull/4692. It will be released in v4.3-rc.5 or 6.

BTW, the EMQX_AUTH__MNESIA__AS has removed after v4.3.