环境
- EMQX 版本:docker emqx:5.0.21
- 操作系统版本:CentOS Linux release 7.9.2009 (Core)
重现此问题的步骤
- 临时启动一个emqx
docker run -d --name emqx -p 1883:1883 -p 8083:8083 -p 8084:8084 -p 8883:8883 -p 18083:18083 emqx:5.0.21
-
mkdir -p /home/data/gn_emqx/{bin,etc,lib,data,log}
docker cp emqx:/opt/emqx/bin /home/data/gn_emqx
docker cp emqx:/opt/emqx/etc /home/data/gn_emqx
docker cp emqx:/opt/emqx/lib /home/data/gn_emqx
docker cp emqx:/opt/emqx/data /home/data/gn_emqx
docker cp emqx:/opt/emqx/log /home/data/gn_emqx -
增加权限
chown -R 1000:1000 gn_emqx
chmod -R 755 gn_emqx
-
docker stop gn_emqx
docker rm gn_emqx
修改配置文件,主要增加了http认证的配置
dashboard {
listeners.http {
bind = 18083
}
default_username = “admin”
default_password = “123123”
}
authorization {
deny_action = ignore
no_match = allow
cache = { enable = true }
sources = [
{
type = file
enable = true
# This file is immutable to EMQX.
# Once new rules are created from dashboard UI or HTTP API,
# the file ‘data/authz/acl.conf’ is used instead of this one
path = “etc/acl.conf”
}
]
}
authentication = [
{
backend = http
method = post
mechanism = password_based
enable = true
url = “http://127.0.0.1/mqtt-auth”
body {
password = “${password}”
username = “${username}”
}
headers {
Content-Type = “application/json”
X-Request-Source = “EMQX”
accept = “application/json”
cache-control = “no-cache”
connection = “keep-alive”
keep-alive = “timeout=30, max=1000”
}
ssl {
enable = true
}
}
]
docker run -d --name gn_emqx -p 1883:1883 -p 8083:8083 -p 8084:8084 -p 8883:8883 -p 18083:18083 -v /home/data/gn_emqx/bin:/opt/emqx/bin -v /home/data/gn_emqx/etc:/opt/emqx/etc -v /home/data/gn_emqx/lib:/opt/emqx/lib -v /home/data/gn_emqx/data:/opt/emqx/data -v /home/data/gn_emqx/log:/opt/emqx/log emqx:5.0.21
预期行为
1、登录密码是123123
2、认证配置生效,并且在看板中可以看到,登录时会调用认证接口并认证
实际行为
1、登录密码是启动的临时docker,在后来登录后修改完的密码
2、认证配置未生效
WARNING: Default (insecure) Erlang cookie is in use.
WARNING: Configure node.cookie in /opt/emqx/etc/emqx.conf or override from environment variable EMQX_NODE__COOKIE
WARNING: NOTE: Use the same cookie for all nodes in the cluster.
EMQX_RPC__PORT_DISCOVERY [rpc.port_discovery]: manual
EMQX_LOG__FILE_HANDLERS__DEFAULT__ENABLE [log.file_handlers.default.enable]: false
EMQX_LOG__CONSOLE_HANDLER__ENABLE [log.console_handler.enable]: true
EMQX_NODE__NAME [node.name]: emqx@172.17.0.2
2023-08-21T02:01:37.122609+00:00 [warning] msg: alarm_is_activated, mfa: emqx_alarm:do_actions/3, line: 416, message: <<“79.63% mem usage”>>, name: high_system_memory_usage
Listener ssl:default on 0.0.0.0:8883 started.
Listener tcp:default on 0.0.0.0:1883 started.
Listener ws:default on 0.0.0.0:8083 started.
Listener wss:default on 0.0.0.0:8084 started.
Listener http:dashboard on :18083 started.
EMQX 5.0.21 is running now!
备注: 我在docker容器中看到了我挂载的 emqx.conf 文件,是正确的,但是不知道为什么没有生效