emqx.5.0.11 版本添加http方式认证报错

错误报告

环境

  • EMQX 版本:
  • 操作系统版本:

重现此问题的步骤

  1. 添加http接口认证,报错


预期行为

实际行为


功能请求

描述你需要的功能

为什么你需要这个功能


其他

你好,我这边没有复现出这个问题,建议你把 log 目录下 emqx.log.N 文件中的错误日志完整贴上来。

2022-12-27T02:44:51.116760+00:00 [warning] config: #{backend => <<“http”>>,body => #{password => <<“${password}”>>,username => <<“${username}”>>},connect_timeout => <<“5s”>>,enable_pipelining => 100,headers => #{‘content-type’ => <<“application/json”>>},mechanism => <<“password_based”>>,method => <<“post”>>,pool_size => 8,request_timeout => <<“5s”>>,ssl => #{enable => false,verify => <<“verify_peer”>>},url => <<“https://xx/mqtt/auth/${clientid}”>>}, exception: throw, line: 224, mfa: emqx_authentication_config:do_check_config/3, msg: failed_to_check_config, reason: {emqx_authn_http,[#{kind => validation_error,reason => integrity_validation_failure,result => false,validation_name => check_ssl_opts}]}, stacktrace: [{hocon_tconf,assert_no_error,2,[{file,“hocon_tconf.erl”},{line,1142}]},{hocon_tconf,map,4,[{file,“hocon_tconf.erl”},{line,296}]},{hocon_tconf,do_check,4,[{file,“hocon_tconf.erl”},{line,253}]},{emqx_authentication_config,‘-do_check_config/3-fun-0-’,2,[{file,“emqx_authentication_config.erl”},{line,205}]},{emqx_authentication_config,do_check_config,3,[{file,“emqx_authentication_config.erl”},{line,214}]},{lists,map,2,[{file,“lists.erl”},{line,1243}]},{emqx_authentication_config,post_config_update,5,[{file,“emqx_authentication_config.erl”},{line,139}]},{emqx_config_handler,call_post_config_update,7,[{file,“emqx_config_handler.erl”},{line,407}]},{emqx_config_handler,do_post_config_update,8,[{file,“emqx_config_handler.erl”},{line,345}]},{emqx_config_handler,check_and_save_configs,7,[{file,“emqx_config_handler.erl”},{line,290}]},{emqx_config_handler,handle_update_request,4,[{file,“emqx_config_handler.erl”},{line,195}]},{emqx_config_handler,handle_call,3,[{file,“emqx_config_handler.erl”},{line,124}]},{gen_server,try_handle_call,4,[{file,“gen_server.erl”},{line,721}]},{gen_server,handle_msg,6,[{file,“gen_server.erl”},{line,750}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,226}]}], type: {password_based,http}
2022-12-27T02:44:51.117166+00:00 [warning] entrypoint: <<“emqx:update_config/3”>>, kind: initiate, line: 500, mfa: emqx_cluster_rpc:log_and_alarm/3, msg: cluster_rpc_apply_result, result: {error,{bad_authenticator_config,#{reason => {emqx_authn_http,[#{kind => validation_error,reason => integrity_validation_failure,result => false,validation_name => check_ssl_opts}]},type => {password_based,http}}}}, tnx_id: 1

你是 https,需要配置 TLS 选项才行

这个配置勾选TLS,需要上传我们的域名证书才行吗

指定 CA 证书就可以了

谢谢,另外问一下,路径:mqtt/auth/${clientid} 可以带${clientid}吗

环境变量怎么设置URL:- "EMQX_AUTHORIZATION__SOURCES__$INDEX_url=https:/xxmqtt/auth/${clientid} " ,官方没找到文档

可以的。认证应该是 AUTHENTICATION,环境变量的设置方法你可以参考下这个:Docker