Merge pull request #9242 from lafirest/fix/log_sensitive_acl
Use LOG_SENSITIVE to replace the risky LOG in ACL
This commit is contained in:
commit
86329075cb
|
@ -53,7 +53,7 @@ check(ClientInfo, AuthResult, #{auth := AuthParms = #{path := Path},
|
||||||
{stop, AuthResult#{auth_result => http_to_connack_error(Code),
|
{stop, AuthResult#{auth_result => http_to_connack_error(Code),
|
||||||
anonymous => false}};
|
anonymous => false}};
|
||||||
{error, Error} ->
|
{error, Error} ->
|
||||||
?LOG(error, "Deny connection from path: ~s, username: ~ts, due to "
|
?LOG_SENSITIVE(error, "Deny connection from path: ~s, username: ~ts, due to "
|
||||||
"request http-server failed: ~0p",
|
"request http-server failed: ~0p",
|
||||||
[Path, Username, Error]),
|
[Path, Username, Error]),
|
||||||
%%FIXME later: server_unavailable is not right.
|
%%FIXME later: server_unavailable is not right.
|
||||||
|
@ -91,7 +91,7 @@ is_superuser(SuperParams =
|
||||||
case request(PoolName, Method, Path, Headers, feedvar(Params, ClientInfo), Timeout, Retry) of
|
case request(PoolName, Method, Path, Headers, feedvar(Params, ClientInfo), Timeout, Retry) of
|
||||||
{ok, 200, _Body} -> true;
|
{ok, 200, _Body} -> true;
|
||||||
{ok, _Code, _Body} -> false;
|
{ok, _Code, _Body} -> false;
|
||||||
{error, Error} -> ?LOG(error, "Request superuser path ~s, error: ~p", [Path, Error]),
|
{error, Error} -> ?LOG_SENSITIVE(error, "Request superuser path ~s, error: ~p", [Path, Error]),
|
||||||
false
|
false
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
%% -*- mode: erlang -*-
|
%% -*- mode: erlang -*-
|
||||||
%% Unless you know what you are doing, DO NOT edit manually!!
|
%% Unless you know what you are doing, DO NOT edit manually!!
|
||||||
{VSN,
|
{VSN,
|
||||||
[{"4.3.7",[{load_module,emqx_auth_jwt,brutal_purge,soft_purge,[]}]},
|
[{"4.3.7",
|
||||||
|
[{load_module,emqx_auth_jwt_svr,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_jwt,brutal_purge,soft_purge,[]}]},
|
||||||
{<<"4\\.3\\.[3-6]">>,
|
{<<"4\\.3\\.[3-6]">>,
|
||||||
[{load_module,emqx_auth_jwt,brutal_purge,soft_purge,[]},
|
[{load_module,emqx_auth_jwt,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_auth_jwt_svr,brutal_purge,soft_purge,[]}]},
|
{load_module,emqx_auth_jwt_svr,brutal_purge,soft_purge,[]}]},
|
||||||
{<<"4\\.3\\.[0-2]">>,[{restart_application,emqx_auth_jwt}]},
|
{<<"4\\.3\\.[0-2]">>,[{restart_application,emqx_auth_jwt}]},
|
||||||
{<<".*">>,[]}],
|
{<<".*">>,[]}],
|
||||||
[{"4.3.7",[{load_module,emqx_auth_jwt,brutal_purge,soft_purge,[]}]},
|
[{"4.3.7",
|
||||||
|
[{load_module,emqx_auth_jwt_svr,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_jwt,brutal_purge,soft_purge,[]}]},
|
||||||
{<<"4\\.3\\.[3-6]">>,
|
{<<"4\\.3\\.[3-6]">>,
|
||||||
[{load_module,emqx_auth_jwt,brutal_purge,soft_purge,[]},
|
[{load_module,emqx_auth_jwt,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_auth_jwt_svr,brutal_purge,soft_purge,[]}]},
|
{load_module,emqx_auth_jwt_svr,brutal_purge,soft_purge,[]}]},
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
%% APIs
|
%% APIs
|
||||||
-export([start_link/1]).
|
-export([start_link/1]).
|
||||||
|
|
||||||
-export([verify/1]).
|
-export([verify/1, trace/2]).
|
||||||
|
|
||||||
%% gen_server callbacks
|
%% gen_server callbacks
|
||||||
-export([ init/1
|
-export([ init/1
|
||||||
|
@ -143,7 +143,8 @@ request_jwks(Addr) ->
|
||||||
?tp(debug, emqx_auth_jwt_svr_jwks_updated, #{jwks => Jwks, pid => self()}),
|
?tp(debug, emqx_auth_jwt_svr_jwks_updated, #{jwks => Jwks, pid => self()}),
|
||||||
Jwks
|
Jwks
|
||||||
catch _:_ ->
|
catch _:_ ->
|
||||||
?LOG(error, "Invalid jwks server response: ~p~n", [Body]),
|
?MODULE:trace(jwks_server_reesponse, Body),
|
||||||
|
?LOG(error, "Invalid jwks server response, body is not logged for security reasons, trace it if inspection is required", []),
|
||||||
error(badarg)
|
error(badarg)
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
@ -174,7 +175,7 @@ do_verify(JwsCompacted) ->
|
||||||
end
|
end
|
||||||
catch
|
catch
|
||||||
Class : Reason : Stk ->
|
Class : Reason : Stk ->
|
||||||
?LOG(error, "verify JWK crashed: ~p, ~p, stacktrace: ~p~n",
|
?LOG_SENSITIVE(error, "verify JWK crashed: ~p, ~p, stacktrace: ~p~n",
|
||||||
[Class, Reason, Stk]),
|
[Class, Reason, Stk]),
|
||||||
{error, invalid_signature}
|
{error, invalid_signature}
|
||||||
end.
|
end.
|
||||||
|
@ -249,13 +250,15 @@ key2jwt_value(Key, Func, Options) ->
|
||||||
V ->
|
V ->
|
||||||
try Func(V) of
|
try Func(V) of
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
?LOG(warning, "Build ~p JWK ~p failed: {error, ~p}~n",
|
?LOG_SENSITIVE(warning, "Build ~p JWK ~p failed: {error, ~p}~n",
|
||||||
[Key, V, Reason]),
|
[Key, V, Reason]),
|
||||||
undefined;
|
undefined;
|
||||||
J -> J
|
J -> J
|
||||||
catch T:R ->
|
catch T:R ->
|
||||||
?LOG(warning, "Build ~p JWK ~p failed: {~p, ~p}~n",
|
?LOG_SENSITIVE(warning, "Build ~p JWK ~p failed: {~p, ~p}~n",
|
||||||
[Key, V, T, R]),
|
[Key, V, T, R]),
|
||||||
undefined
|
undefined
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
trace(_Tag, _Data) -> ok.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{application, emqx_auth_ldap,
|
{application, emqx_auth_ldap,
|
||||||
[{description, "EMQ X Authentication/ACL with LDAP"},
|
[{description, "EMQ X Authentication/ACL with LDAP"},
|
||||||
{vsn, "4.3.5"}, % strict semver, bump manually!
|
{vsn, "4.3.6"}, % strict semver, bump manually!
|
||||||
{modules, []},
|
{modules, []},
|
||||||
{registered, [emqx_auth_ldap_sup]},
|
{registered, [emqx_auth_ldap_sup]},
|
||||||
{applications, [kernel,stdlib,eldap2,ecpool]},
|
{applications, [kernel,stdlib,eldap2,ecpool]},
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
%% -*- mode: erlang -*-
|
%% -*- mode: erlang -*-
|
||||||
%% Unless you know what you are doing, DO NOT edit manually!!
|
%% Unless you know what you are doing, DO NOT edit manually!!
|
||||||
{VSN,
|
{VSN,
|
||||||
[{<<"4\\.3\\.[3-4]">>,
|
[{"4.3.5",
|
||||||
[{load_module,emqx_auth_ldap_app,brutal_purge,soft_purge,[]},
|
[{load_module,emqx_auth_ldap,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_ldap_cli,brutal_purge,soft_purge,[]}]},
|
||||||
|
{<<"4\\.3\\.[3-4]">>,
|
||||||
|
[{load_module,emqx_auth_ldap_cli,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_ldap_app,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_auth_ldap,brutal_purge,soft_purge,[]}]},
|
{load_module,emqx_auth_ldap,brutal_purge,soft_purge,[]}]},
|
||||||
{"4.3.2",
|
{"4.3.2",
|
||||||
[{load_module,emqx_auth_ldap_app,brutal_purge,soft_purge,[]},
|
[{load_module,emqx_auth_ldap_cli,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_ldap_app,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_auth_ldap,brutal_purge,soft_purge,[]},
|
{load_module,emqx_auth_ldap,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_acl_ldap,brutal_purge,soft_purge,[]}]},
|
{load_module,emqx_acl_ldap,brutal_purge,soft_purge,[]}]},
|
||||||
{<<"4\\.3\\.[0-1]">>,
|
{<<"4\\.3\\.[0-1]">>,
|
||||||
|
@ -14,11 +19,16 @@
|
||||||
{load_module,emqx_acl_ldap,brutal_purge,soft_purge,[]},
|
{load_module,emqx_acl_ldap,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_auth_ldap_cli,brutal_purge,soft_purge,[]}]},
|
{load_module,emqx_auth_ldap_cli,brutal_purge,soft_purge,[]}]},
|
||||||
{<<".*">>,[]}],
|
{<<".*">>,[]}],
|
||||||
[{<<"4\\.3\\.[3-4]">>,
|
[{"4.3.5",
|
||||||
[{load_module,emqx_auth_ldap_app,brutal_purge,soft_purge,[]},
|
[{load_module,emqx_auth_ldap,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_ldap_cli,brutal_purge,soft_purge,[]}]},
|
||||||
|
{<<"4\\.3\\.[3-4]">>,
|
||||||
|
[{load_module,emqx_auth_ldap_cli,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_ldap_app,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_auth_ldap,brutal_purge,soft_purge,[]}]},
|
{load_module,emqx_auth_ldap,brutal_purge,soft_purge,[]}]},
|
||||||
{"4.3.2",
|
{"4.3.2",
|
||||||
[{load_module,emqx_auth_ldap_app,brutal_purge,soft_purge,[]},
|
[{load_module,emqx_auth_ldap_cli,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_ldap_app,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_auth_ldap,brutal_purge,soft_purge,[]},
|
{load_module,emqx_auth_ldap,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_acl_ldap,brutal_purge,soft_purge,[]}]},
|
{load_module,emqx_acl_ldap,brutal_purge,soft_purge,[]}]},
|
||||||
{<<"4\\.3\\.[0-1]">>,
|
{<<"4\\.3\\.[0-1]">>,
|
||||||
|
|
|
@ -62,7 +62,7 @@ check(ClientInfo = #{username := Username, password := Password}, AuthResult,
|
||||||
{error, not_found} ->
|
{error, not_found} ->
|
||||||
ok;
|
ok;
|
||||||
{error, ResultCode} ->
|
{error, ResultCode} ->
|
||||||
?LOG(error, "[LDAP] Auth from ldap failed: ~p", [ResultCode]),
|
?LOG_SENSITIVE(error, "[LDAP] Auth from ldap failed: ~p", [ResultCode]),
|
||||||
{stop, AuthResult#{auth_result => ResultCode, anonymous => false}}
|
{stop, AuthResult#{auth_result => ResultCode, anonymous => false}}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
|
@ -54,22 +54,22 @@ connect(Opts) ->
|
||||||
false ->
|
false ->
|
||||||
[{port, Port}, {timeout, Timeout}]
|
[{port, Port}, {timeout, Timeout}]
|
||||||
end,
|
end,
|
||||||
?LOG(debug, "[LDAP] Connecting to OpenLDAP server: ~p, Opts:~p ...", [Servers, LdapOpts]),
|
?LOG_SENSITIVE(debug, "[LDAP] Connecting to OpenLDAP server: ~p, Opts:~p ...", [Servers, LdapOpts]),
|
||||||
|
|
||||||
case eldap2:open(Servers, LdapOpts) of
|
case eldap2:open(Servers, LdapOpts) of
|
||||||
{ok, LDAP} ->
|
{ok, LDAP} ->
|
||||||
try eldap2:simple_bind(LDAP, BindDn, BindPassword) of
|
try eldap2:simple_bind(LDAP, BindDn, BindPassword) of
|
||||||
ok -> {ok, LDAP};
|
ok -> {ok, LDAP};
|
||||||
{error, Error} ->
|
{error, Error} ->
|
||||||
?LOG(error, "[LDAP] Can't authenticated to OpenLDAP server: ~p", [Error]),
|
?LOG_SENSITIVE(error, "[LDAP] Can't authenticated to OpenLDAP server: ~p", [Error]),
|
||||||
{error, Error}
|
{error, Error}
|
||||||
catch
|
catch
|
||||||
error:Reason ->
|
error:Reason ->
|
||||||
?LOG(error, "[LDAP] Can't authenticated to OpenLDAP server: ~p", [Reason]),
|
?LOG_SENSITIVE(error, "[LDAP] Can't authenticated to OpenLDAP server: ~p", [Reason]),
|
||||||
{error, Reason}
|
{error, Reason}
|
||||||
end;
|
end;
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
?LOG(error, "[LDAP] Can't connect to OpenLDAP server: ~p", [Reason]),
|
?LOG_SENSITIVE(error, "[LDAP] Can't connect to OpenLDAP server: ~p", [Reason]),
|
||||||
{error, Reason}
|
{error, Reason}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -147,4 +147,3 @@ init_args(ENVS) ->
|
||||||
match_objectclass => ObjectClass,
|
match_objectclass => ObjectClass,
|
||||||
username_attr => UidAttr,
|
username_attr => UidAttr,
|
||||||
password_attr => PasswdAttr}}.
|
password_attr => PasswdAttr}}.
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ check(ClientInfo = #{password := Password}, AuthResult,
|
||||||
undefined -> ok;
|
undefined -> ok;
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
?tp(emqx_auth_mongo_check_authn_error, #{error => Reason}),
|
?tp(emqx_auth_mongo_check_authn_error, #{error => Reason}),
|
||||||
?LOG(error, "[MongoDB] Can't connect to MongoDB server: ~0p", [Reason]),
|
?LOG_SENSITIVE(error, "[MongoDB] Can't connect to MongoDB server: ~0p", [Reason]),
|
||||||
{stop, AuthResult#{auth_result => not_authorized, anonymous => false}};
|
{stop, AuthResult#{auth_result => not_authorized, anonymous => false}};
|
||||||
UserMap ->
|
UserMap ->
|
||||||
Result = case [maps:get(Field, UserMap, undefined) || Field <- Fields] of
|
Result = case [maps:get(Field, UserMap, undefined) || Field <- Fields] of
|
||||||
|
@ -72,7 +72,7 @@ check(ClientInfo = #{password := Password}, AuthResult,
|
||||||
anonymous => false,
|
anonymous => false,
|
||||||
auth_result => success}};
|
auth_result => success}};
|
||||||
{error, Error} ->
|
{error, Error} ->
|
||||||
?LOG(error, "[MongoDB] check auth fail: ~p", [Error]),
|
?LOG_SENSITIVE(error, "[MongoDB] check auth fail: ~p", [Error]),
|
||||||
{stop, AuthResult#{auth_result => Error, anonymous => false}}
|
{stop, AuthResult#{auth_result => Error, anonymous => false}}
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
@ -99,7 +99,7 @@ is_superuser(Pool, #superquery{collection = Coll, field = Field, selector = Sele
|
||||||
false;
|
false;
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
?tp(emqx_auth_mongo_superuser_query_error, #{error => Reason}),
|
?tp(emqx_auth_mongo_superuser_query_error, #{error => Reason}),
|
||||||
?LOG(error, "[MongoDB] Can't connect to MongoDB server: ~0p", [Reason]),
|
?LOG_SENSITIVE(error, "[MongoDB] Can't connect to MongoDB server: ~0p", [Reason]),
|
||||||
false;
|
false;
|
||||||
Row ->
|
Row ->
|
||||||
case maps:get(Field, Row, false) of
|
case maps:get(Field, Row, false) of
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{application, emqx_auth_mysql,
|
{application, emqx_auth_mysql,
|
||||||
[{description, "EMQ X Authentication/ACL with MySQL"},
|
[{description, "EMQ X Authentication/ACL with MySQL"},
|
||||||
{vsn, "4.3.3"}, % strict semver, bump manually!
|
{vsn, "4.3.4"}, % strict semver, bump manually!
|
||||||
{modules, []},
|
{modules, []},
|
||||||
{registered, [emqx_auth_mysql_sup]},
|
{registered, [emqx_auth_mysql_sup]},
|
||||||
{applications, [kernel,stdlib,mysql,ecpool]},
|
{applications, [kernel,stdlib,mysql,ecpool]},
|
||||||
|
|
|
@ -1,18 +1,28 @@
|
||||||
%% -*- mode: erlang -*-
|
%% -*- mode: erlang -*-
|
||||||
{VSN,
|
{VSN,
|
||||||
[{<<"4\\.3\\.[1-2]">>,
|
[{"4.3.3",
|
||||||
[{load_module,emqx_auth_mysql_app,brutal_purge,soft_purge,[]},
|
[{load_module,emqx_auth_mysql,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_mysql_cli,brutal_purge,soft_purge,[]}]},
|
||||||
|
{<<"4\\.3\\.[1-2]">>,
|
||||||
|
[{load_module,emqx_auth_mysql_cli,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_mysql_app,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_auth_mysql,brutal_purge,soft_purge,[]}]},
|
{load_module,emqx_auth_mysql,brutal_purge,soft_purge,[]}]},
|
||||||
{"4.3.0",
|
{"4.3.0",
|
||||||
[{load_module,emqx_auth_mysql_app,brutal_purge,soft_purge,[]},
|
[{load_module,emqx_auth_mysql_cli,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_mysql_app,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_auth_mysql,brutal_purge,soft_purge,[]},
|
{load_module,emqx_auth_mysql,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_acl_mysql,brutal_purge,soft_purge,[]}]},
|
{load_module,emqx_acl_mysql,brutal_purge,soft_purge,[]}]},
|
||||||
{<<".*">>,[]}],
|
{<<".*">>,[]}],
|
||||||
[{<<"4\\.3\\.[1-2]">>,
|
[{"4.3.3",
|
||||||
[{load_module,emqx_auth_mysql_app,brutal_purge,soft_purge,[]},
|
[{load_module,emqx_auth_mysql,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_mysql_cli,brutal_purge,soft_purge,[]}]},
|
||||||
|
{<<"4\\.3\\.[1-2]">>,
|
||||||
|
[{load_module,emqx_auth_mysql_cli,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_mysql_app,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_auth_mysql,brutal_purge,soft_purge,[]}]},
|
{load_module,emqx_auth_mysql,brutal_purge,soft_purge,[]}]},
|
||||||
{"4.3.0",
|
{"4.3.0",
|
||||||
[{load_module,emqx_auth_mysql_app,brutal_purge,soft_purge,[]},
|
[{load_module,emqx_auth_mysql_cli,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_mysql_app,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_auth_mysql,brutal_purge,soft_purge,[]},
|
{load_module,emqx_auth_mysql,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_acl_mysql,brutal_purge,soft_purge,[]}]},
|
{load_module,emqx_acl_mysql,brutal_purge,soft_purge,[]}]},
|
||||||
{<<".*">>,[]}]
|
{<<".*">>,[]}]
|
||||||
|
|
|
@ -41,7 +41,7 @@ check(ClientInfo = #{password := Password}, AuthResult,
|
||||||
{ok, _Columns, []} ->
|
{ok, _Columns, []} ->
|
||||||
{error, not_found};
|
{error, not_found};
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
?LOG(error, "[MySQL] query '~p' failed: ~p", [AuthSql, Reason]),
|
?LOG_SENSITIVE(error, "[MySQL] query '~p' failed: ~p", [AuthSql, Reason]),
|
||||||
{error, Reason}
|
{error, Reason}
|
||||||
end,
|
end,
|
||||||
case CheckPass of
|
case CheckPass of
|
||||||
|
@ -52,7 +52,7 @@ check(ClientInfo = #{password := Password}, AuthResult,
|
||||||
{error, not_found} ->
|
{error, not_found} ->
|
||||||
ok;
|
ok;
|
||||||
{error, ResultCode} ->
|
{error, ResultCode} ->
|
||||||
?LOG(error, "[MySQL] Auth from mysql failed: ~p", [ResultCode]),
|
?LOG_SENSITIVE(error, "[MySQL] Auth from mysql failed: ~p", [ResultCode]),
|
||||||
{stop, AuthResult#{auth_result => ResultCode, anonymous => false}}
|
{stop, AuthResult#{auth_result => ResultCode, anonymous => false}}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
|
@ -54,10 +54,10 @@ connect(Options) ->
|
||||||
?LOG(error, "[MySQL] Can't connect to MySQL server: Connection refused."),
|
?LOG(error, "[MySQL] Can't connect to MySQL server: Connection refused."),
|
||||||
{error, Reason};
|
{error, Reason};
|
||||||
{error, Reason = {ErrorCode, _, Error}} ->
|
{error, Reason = {ErrorCode, _, Error}} ->
|
||||||
?LOG(error, "[MySQL] Can't connect to MySQL server: ~p - ~p", [ErrorCode, Error]),
|
?LOG_SENSITIVE(error, "[MySQL] Can't connect to MySQL server: ~p - ~p", [ErrorCode, Error]),
|
||||||
{error, Reason};
|
{error, Reason};
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
?LOG(error, "[MySQL] Can't connect to MySQL server: ~p", [Reason]),
|
?LOG_SENSITIVE(error, "[MySQL] Can't connect to MySQL server: ~p", [Reason]),
|
||||||
{error, Reason}
|
{error, Reason}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{application, emqx_auth_pgsql,
|
{application, emqx_auth_pgsql,
|
||||||
[{description, "EMQ X Authentication/ACL with PostgreSQL"},
|
[{description, "EMQ X Authentication/ACL with PostgreSQL"},
|
||||||
{vsn, "4.3.3"}, % strict semver, bump manually!
|
{vsn, "4.3.4"}, % strict semver, bump manually!
|
||||||
{modules, []},
|
{modules, []},
|
||||||
{registered, [emqx_auth_pgsql_sup]},
|
{registered, [emqx_auth_pgsql_sup]},
|
||||||
{applications, [kernel,stdlib,epgsql,ecpool]},
|
{applications, [kernel,stdlib,epgsql,ecpool]},
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
%% -*- mode: erlang -*-
|
%% -*- mode: erlang -*-
|
||||||
%% Unless you know what you are doing, DO NOT edit manually!!
|
%% Unless you know what you are doing, DO NOT edit manually!!
|
||||||
{VSN,
|
{VSN,
|
||||||
[{<<"4\\.3\\.[0-2]">>,
|
[{"4.3.3",
|
||||||
|
[{load_module,emqx_auth_pgsql,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_pgsql_cli,brutal_purge,soft_purge,[]}]},
|
||||||
|
{<<"4\\.3\\.[0-2]">>,
|
||||||
%% restart it due to epgsql upgraded from 4.4.0 to 4.6.0
|
%% restart it due to epgsql upgraded from 4.4.0 to 4.6.0
|
||||||
%% in emqx_auth_pgsql:v4.3.3
|
%% in emqx_auth_pgsql:v4.3.3
|
||||||
[{restart_application,emqx_auth_pgsql}]},
|
[{restart_application,emqx_auth_pgsql}]},
|
||||||
{<<".*">>,[]}],
|
{<<".*">>,[]}],
|
||||||
[{<<"4\\.3\\.[0-2]">>,
|
[{"4.3.3",
|
||||||
|
[{load_module,emqx_auth_pgsql,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_pgsql_cli,brutal_purge,soft_purge,[]}]},
|
||||||
|
{<<"4\\.3\\.[0-2]">>,
|
||||||
[{restart_application,emqx_auth_pgsql}]},
|
[{restart_application,emqx_auth_pgsql}]},
|
||||||
{<<".*">>,[]}]}.
|
{<<".*">>,[]}]}.
|
||||||
|
|
|
@ -40,7 +40,7 @@ check(ClientInfo = #{password := Password}, AuthResult,
|
||||||
{ok, _, []} ->
|
{ok, _, []} ->
|
||||||
{error, not_found};
|
{error, not_found};
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
?LOG(error, "[Postgres] query '~p' failed: ~p", [AuthSql, Reason]),
|
?LOG_SENSITIVE(error, "[Postgres] query '~p' failed: ~p", [AuthSql, Reason]),
|
||||||
{error, not_found}
|
{error, not_found}
|
||||||
end,
|
end,
|
||||||
case CheckPass of
|
case CheckPass of
|
||||||
|
@ -51,7 +51,7 @@ check(ClientInfo = #{password := Password}, AuthResult,
|
||||||
{error, not_found} ->
|
{error, not_found} ->
|
||||||
ok;
|
ok;
|
||||||
{error, ResultCode} ->
|
{error, ResultCode} ->
|
||||||
?LOG(error, "[Postgres] Auth from pgsql failed: ~p", [ResultCode]),
|
?LOG_SENSITIVE(error, "[Postgres] Auth from pgsql failed: ~p", [ResultCode]),
|
||||||
{stop, AuthResult#{auth_result => ResultCode, anonymous => false}}
|
{stop, AuthResult#{auth_result => ResultCode, anonymous => false}}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ connect(Opts) ->
|
||||||
?LOG(error, "[Postgres] Can't connect to Postgres server: Invalid password."),
|
?LOG(error, "[Postgres] Can't connect to Postgres server: Invalid password."),
|
||||||
{error, Reason};
|
{error, Reason};
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
?LOG(error, "[Postgres] Can't connect to Postgres server: ~p", [Reason]),
|
?LOG_SENSITIVE(error, "[Postgres] Can't connect to Postgres server: ~p", [Reason]),
|
||||||
{error, Reason}
|
{error, Reason}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{application, emqx_auth_redis,
|
{application, emqx_auth_redis,
|
||||||
[{description, "EMQ X Authentication/ACL with Redis"},
|
[{description, "EMQ X Authentication/ACL with Redis"},
|
||||||
{vsn, "4.3.3"}, % strict semver, bump manually!
|
{vsn, "4.3.4"}, % strict semver, bump manually!
|
||||||
{modules, []},
|
{modules, []},
|
||||||
{registered, [emqx_auth_redis_sup]},
|
{registered, [emqx_auth_redis_sup]},
|
||||||
{applications, [kernel,stdlib,eredis,eredis_cluster,ecpool]},
|
{applications, [kernel,stdlib,eredis,eredis_cluster,ecpool]},
|
||||||
|
|
|
@ -1,19 +1,29 @@
|
||||||
%% -*- mode: erlang -*-
|
%% -*- mode: erlang -*-
|
||||||
|
%% Unless you know what you are doing, DO NOT edit manually!!
|
||||||
{VSN,
|
{VSN,
|
||||||
[{<<"4\\.3\\.[1-2]">>,
|
[{"4.3.3",
|
||||||
[{load_module,emqx_auth_redis_app,brutal_purge,soft_purge,[]},
|
[{load_module,emqx_auth_redis,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_redis_cli,brutal_purge,soft_purge,[]}]},
|
||||||
|
{<<"4\\.3\\.[1-2]">>,
|
||||||
|
[{load_module,emqx_auth_redis_cli,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_redis_app,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_auth_redis,brutal_purge,soft_purge,[]}]},
|
{load_module,emqx_auth_redis,brutal_purge,soft_purge,[]}]},
|
||||||
{"4.3.0",
|
{"4.3.0",
|
||||||
[{load_module,emqx_auth_redis_app,brutal_purge,soft_purge,[]},
|
[{load_module,emqx_auth_redis_cli,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_redis_app,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_auth_redis,brutal_purge,soft_purge,[]},
|
{load_module,emqx_auth_redis,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_acl_redis,brutal_purge,soft_purge,[]}]},
|
{load_module,emqx_acl_redis,brutal_purge,soft_purge,[]}]},
|
||||||
{<<".*">>,[]}],
|
{<<".*">>,[]}],
|
||||||
[{<<"4\\.3\\.[1-2]">>,
|
[{"4.3.3",
|
||||||
[{load_module,emqx_auth_redis_app,brutal_purge,soft_purge,[]},
|
[{load_module,emqx_auth_redis,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_redis_cli,brutal_purge,soft_purge,[]}]},
|
||||||
|
{<<"4\\.3\\.[1-2]">>,
|
||||||
|
[{load_module,emqx_auth_redis_cli,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_redis_app,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_auth_redis,brutal_purge,soft_purge,[]}]},
|
{load_module,emqx_auth_redis,brutal_purge,soft_purge,[]}]},
|
||||||
{"4.3.0",
|
{"4.3.0",
|
||||||
[{load_module,emqx_auth_redis_app,brutal_purge,soft_purge,[]},
|
[{load_module,emqx_auth_redis_cli,brutal_purge,soft_purge,[]},
|
||||||
|
{load_module,emqx_auth_redis_app,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_auth_redis,brutal_purge,soft_purge,[]},
|
{load_module,emqx_auth_redis,brutal_purge,soft_purge,[]},
|
||||||
{load_module,emqx_acl_redis,brutal_purge,soft_purge,[]}]},
|
{load_module,emqx_acl_redis,brutal_purge,soft_purge,[]}]},
|
||||||
{<<".*">>,[]}]
|
{<<".*">>,[]}]}.
|
||||||
}.
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ check(ClientInfo = #{password := Password}, AuthResult,
|
||||||
{ok, [PassHash, Salt|_]} ->
|
{ok, [PassHash, Salt|_]} ->
|
||||||
check_pass({PassHash, Salt, Password}, HashType);
|
check_pass({PassHash, Salt, Password}, HashType);
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
?LOG(error, "[Redis] Command: ~p failed: ~p", [AuthCmd, Reason]),
|
?LOG_SENSITIVE(error, "[Redis] Command: ~p failed: ~p", [AuthCmd, Reason]),
|
||||||
{error, not_found}
|
{error, not_found}
|
||||||
end,
|
end,
|
||||||
case CheckPass of
|
case CheckPass of
|
||||||
|
@ -54,7 +54,7 @@ check(ClientInfo = #{password := Password}, AuthResult,
|
||||||
{error, not_found} ->
|
{error, not_found} ->
|
||||||
ok;
|
ok;
|
||||||
{error, ResultCode} ->
|
{error, ResultCode} ->
|
||||||
?LOG(error, "[Redis] Auth from redis failed: ~p", [ResultCode]),
|
?LOG_SENSITIVE(error, "[Redis] Auth from redis failed: ~p", [ResultCode]),
|
||||||
{stop, AuthResult#{auth_result => ResultCode, anonymous => false}}
|
{stop, AuthResult#{auth_result => ResultCode, anonymous => false}}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ connect(Opts) ->
|
||||||
?LOG(error, "[Redis] Can't connect to Redis server: Authentication failed."),
|
?LOG(error, "[Redis] Can't connect to Redis server: Authentication failed."),
|
||||||
{error, Reason};
|
{error, Reason};
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
?LOG(error, "[Redis] Can't connect to Redis server: ~p", [Reason]),
|
?LOG_SENSITIVE(error, "[Redis] Can't connect to Redis server: ~p", [Reason]),
|
||||||
{error, Reason}
|
{error, Reason}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -86,4 +86,3 @@ repl(S, _Var, undefined) ->
|
||||||
repl(S, Var, Val) ->
|
repl(S, Var, Val) ->
|
||||||
NVal = re:replace(Val, "&", "\\\\&", [global, {return, list}]),
|
NVal = re:replace(Val, "&", "\\\\&", [global, {return, list}]),
|
||||||
re:replace(S, Var, NVal, [{return, list}]).
|
re:replace(S, Var, NVal, [{return, list}]).
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
- Added a log censor to avoid logging sensitive data [#9189](https://github.com/emqx/emqx/pull/9189).
|
- Added a log censor to avoid logging sensitive data [#9189](https://github.com/emqx/emqx/pull/9189).
|
||||||
If the data to be logged is a map or key-value list which contains sensitive key words such as `password`, the value is obfuscated as `******`.
|
If the data to be logged is a map or key-value list which contains sensitive key words such as `password`, the value is obfuscated as `******`.
|
||||||
|
|
||||||
|
- Enhanced log security in ACL modules, sensitive data will be obscured. [#9242](https://github.com/emqx/emqx/pull/9242).
|
||||||
|
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
|
|
||||||
- Fix that after uploading a backup file with an UTF8 filename, HTTP API `GET /data/export` fails with status code 500 [#9224](https://github.com/emqx/emqx/pull/9224).
|
- Fix that after uploading a backup file with an UTF8 filename, HTTP API `GET /data/export` fails with status code 500 [#9224](https://github.com/emqx/emqx/pull/9224).
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
- 增强包含敏感数据的日志的安全性 [#9189](https://github.com/emqx/emqx/pull/9189)。
|
- 增强包含敏感数据的日志的安全性 [#9189](https://github.com/emqx/emqx/pull/9189)。
|
||||||
如果日志中包含敏感关键词,例如 `password`,那么关联的数据回被模糊化处理,替换成 `******`。
|
如果日志中包含敏感关键词,例如 `password`,那么关联的数据回被模糊化处理,替换成 `******`。
|
||||||
|
|
||||||
|
- 增强 ACL 模块中的日志安全性,敏感数据将被模糊化。[#9242](https://github.com/emqx/emqx/pull/9242)。
|
||||||
|
|
||||||
## 修复
|
## 修复
|
||||||
|
|
||||||
- 修复若上传的备份文件名中包含 UTF8 字符,`GET /data/export` HTTP 接口返回 500 错误 [#9224](https://github.com/emqx/emqx/pull/9224)。
|
- 修复若上传的备份文件名中包含 UTF8 字符,`GET /data/export` HTTP 接口返回 500 错误 [#9224](https://github.com/emqx/emqx/pull/9224)。
|
||||||
|
|
Loading…
Reference in New Issue