Giter VIP home page Giter VIP logo

emqx-auth-username's Introduction

emqx_auth_username

EMQX Authentication with Username and Password

Build

make && make tests

Configuration

etc/emqx_auth_username.conf:

## Password hash.
##
## Value: plain | md5 | sha | sha256 
auth.user.password_hash = sha256

List all usernames

# Request
GET api/v4/auth_username

# Response
{
    "code": 0,
    "data": ["username1"]
}

Add a username:

# Request
POST api/v4/auth_username
{
    "username": "some_name",
    "password": "password"
}

# Response
{
    "code": 0
}

Update password for a username:

# Request
PUT api/v4/auth_username/$NAME
{
    "password": "password"
}

# Response
{
    "code", 0
}

Lookup a username info:

# Request
GET api/v4/auth_username/$NAME

# Response
{
    "code": 0,
    "data": {
        "username": "some_username",
        "password": "hashed_password"
    }
}

Delete a username:

# Request
DELETE api/v4/auth_username/$NAME

# Response
{
    "code": 0
}

Load the Plugin

./bin/emqx_ctl plugins load emqx_auth_username

License

Apache License Version 2.0

Author

EMQX Team.

emqx-auth-username's People

Contributors

emqplus avatar gilbertwong96 avatar hjianbo avatar huangdan avatar linjunjj avatar rory-z avatar spring2maz avatar terry-xiaoyu avatar tigercl avatar turtledeng avatar wwhai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

emqx-auth-username's Issues

请问 auth-username插件 在 emqx-websocket 协议上是否有效

环境 win2016
emqx 3.2.0 -win

通过 caddy.server 反代 emqx websocket ws 端口

仪表板开启 emqx-auth-username 插件
添加 用户
关闭 emqx 匿名登陆

通过 java 或 c# 客户端 连接服务器 emqx-auth-username 验证都生效 错误的用户密码 都被连接拒绝。
通过 emqx 仪表板 或第三方 mqtt.js websocket 协议连接服务器 输入错误的用户名 和密码 都能 连接上服务器 验证插件感觉 没有在 websocket 这个协议上 生效。

请问 插件是否支持 websocket 协议的验证。

websocket 通过此插件认证失败

按照文档在emqx_auth_username.conf 中配置了账号密码,MQTT客户端通过此账号密码可以连接服务,但是websocket使用此账号密码不能连接,奇怪的是Dashboard控制台可以连接websocket服务,如下图所示,使用的是v3.0.1版本,希望得到你们的帮助,谢谢

QQ截图20190427144734
QQ截图20190427144815
QQ截图20190427150400
QQ截图20190427150231

connect emqx, got 5 error code.

i use ./bin/emqx_ctl users add command add a user name and password. It doesn't work to restart. I also get 5 error code.

EMQ version: 4.0.1

How to use that plugin?

Do i need to compile it first by myself to a linux .so library? So it seems, the plugin is not included by default
-> emqx/emqx#6015

When i try to compile it, i get the well-known "rebar3" compile error...

Steps:

1.) cd /root
2.) git clone https://github.com/emqx/emqx-auth-username.git
3.) cd emqx-auth-username
4.) make

Output:

root@debian11-emqx:/emqx-auth-username/emqx-auth-username# make
rebar3 compile
make: rebar3: Datei oder Verzeichnis nicht gefunden
make: *** [Makefile:10: compile] Fehler 127
root@debian11-emqx:
/emqx-auth-username/emqx-auth-username#

[Plugins] cannot_find_plugins: emqx_auth_username

emqx/emqx-rel#656
emqx/emqx#5352

We checked that with the same exactly configuration in V4.1.1 everything is working fine, but if I change to 4.3.5 We are getting errors the login failed for not autorized

dev-emqx-0 emqx 2021-07-29T20:00:27.023003+00:00 [warning] [email protected]:40412 [Channel] Client camara-08138281234 (Username: 'event-logger') login failed for not_authorized
dev-emqx-0 emqx 2021-07-29T20:00:27.023123+00:00 [debug] [email protected]:40412 [MQTT] SEND CONNACK(Q0, R0, D0, AckFlags=0, ReasonCode=5)
dev-emqx-0 emqx 2021-07-29T20:00:27.023322+00:00 [info] [email protected]:40412 file: emqx_connection.erl, line: 520, mfa: {emqx_connection,terminate,2}, msg: terminate, pid: <0.2570.0>, reason: {shutdown,not_authorized}

We discovered in the log files that in 4.3.5 is happening the following error. The emqx_auth_username was not loaded.

2021-07-30T14:34:32.966151+00:00 [alert] [Plugins] cannot_find_plugins: [emqx_auth_username,emqx_statsd]

emqx_auth_username.conf file with users is passing as parameters in the Helm Chart

     - name: emqx-users
        mountPath: /opt/emqx/etc/plugins/emqx_auth_username.conf
        subPath: emqx_auth_username.conf

Do you know what it is happening in the latest version with emqx_auth_username?

Inside the container

/opt/emqx $ emqx_ctl plugins load emqx_auth_username
Load plugin emqx_auth_username error: not_found.
/opt/emqx $

Thanks!

How to configure emqx-auth-username plugin correctly (RELEASE 3.1)

Hello:
I have upgraded from version 2.3 to release 3.1.
In version 2.3 the plugin worked fine, and now in release 3.1 it doesn't work or I don't know how to configure it.

In version 2.3 I configured the plugin like this:

  1. In emqx.conf:
    allow_anonymous = false

  2. In emqx_auth_username.conf:
    auth.user.1.username = peter
    auth.user.1.password = pass1
    auth.user.2.username = sophie
    auth.user.2.password = pass2

  3. Loaded the plugin, restart and worked well

BUT:

In release 3.1 I configured the plugin like this:

  1. In emqx.conf:
    allow_anonymous = false

  2. In emqx_auth_username.conf:

    ## Password hash.
    ##
    ## Value: plain | md5 | sha | sha256
    auth.user.password_hash = plain
    auth.user.1.username = peter
    auth.user.1.password = pass1
    auth.user.2.username = sophie
    auth.user.2.password = pass2

  3. Loaded the plugin, restart and doesn't work.

The error is:
[error] You've tried to set auth.user.1.username, but there is no setting with that name.
[error] Did you mean one of these?
[error] auth.mysql.username
[error] auth.pgsql.username
[error] mqtt.sn.username
[error] You've tried to set auth.user.1.password, but there is no setting with that name.
[error] Did you mean one of these?
...

Please, how is the plugin configured correctly?
I can't find information on how to do it.

Thanks for your support.

defalut username/password not disabling

Hi, I've install emqx server on aws instance, I've enabled emqx-auth-username plugin and updated with my 'username' and 'password' and removed default user 'admin'/'public123', but it still accepting connections on default username and password.

Mark as deprecated

According to emqx/emqx/#4668 this plugin was replaced by emqx_plugin_mnesia in v4.3. This change dazzled me a bit and maybe should be documented in the README.md.

配置emq_auth_username.conf 没有效果

emq_auth_username.conf 配置如下:
auth.user.1.username = server
auth.user.1.password = 123456

auth.user.2.username = client
auth.user.2.password = 123456

用./bin/emqttd_ctl users add就可以了,这是为什么呢

how does authentication works in a clustered environment

If we have an emqx cluster(A, B, C, D), and if I add username password on one node(A), then the same will be reflected on other nodes? that mean can I connect to other nodes in the cluster using the same username and password?

Not load at startup

Hello,

I've loaded and added some users with "emqx_ctl" and it's works perfectly, the problem is when i restart my server or emqx service this plugin will not start and even mqtt listener not gonna start, I should edit loadded_plugins and remove emqx_auth_username. and start again then load plugin manually.

emqx_ctl users add causes slow down

Hi there,

Every time I run emqx_ctl users add user pass, it slows the broker way down. Is this normal or is this a limitation of this plugin. What auth would you recommend using with around 2,000 users?

emqx_auth_username 问题求解答

steps:

1 etit emqx.conf

  allow_anonymous = false

2 at web config start emqx_auth_username

3 cli run ./bin/emqx stop

4 next ./bin/emqx start
tcp 0 0 0.0.0.0:6369 0.0.0.0:* LISTEN 12229/beam.smp
tcp 0 0 0.0.0.0:18083 0.0.0.0:* LISTEN 12229/beam.smp
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 12229/beam.smp
tcp 0 0 0.0.0.0:5369 0.0.0.0:* LISTEN 12229/beam.smp
Normally there should be many ports
5 I'll use the command again. ./bin/emqx stop

error.log
2018-12-19 14:26:25.670 [error] Plugin emqx_auth_username is not started

I don't know what the situation is.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.