fix: remove password from info logs

Information log messages for several connectors contained sensitive
password information. This commit fixes this by hiding the sensitive
information from the log messages.

Fixes: https://emqx.atlassian.net/browse/EMQX-8718
This commit is contained in:
Kjell Winblad 2023-01-12 09:01:11 +01:00
parent 13fdbd695e
commit 82e80e5610
9 changed files with 9 additions and 7 deletions

View File

@ -209,7 +209,7 @@ on_start(
?SLOG(info, #{ ?SLOG(info, #{
msg => "starting_http_connector", msg => "starting_http_connector",
connector => InstId, connector => InstId,
config => Config config => emqx_misc:redact(Config)
}), }),
{Transport, TransportOpts} = {Transport, TransportOpts} =
case Scheme of case Scheme of

View File

@ -65,7 +65,7 @@ on_start(
?SLOG(info, #{ ?SLOG(info, #{
msg => "starting_ldap_connector", msg => "starting_ldap_connector",
connector => InstId, connector => InstId,
config => Config config => emqx_misc:redact(Config)
}), }),
Servers = emqx_schema:parse_servers(Servers0, ?LDAP_HOST_OPTIONS), Servers = emqx_schema:parse_servers(Servers0, ?LDAP_HOST_OPTIONS),
SslOpts = SslOpts =

View File

@ -155,7 +155,7 @@ on_start(
rs -> "starting_mongodb_replica_set_connector"; rs -> "starting_mongodb_replica_set_connector";
sharded -> "starting_mongodb_sharded_connector" sharded -> "starting_mongodb_sharded_connector"
end, end,
?SLOG(info, #{msg => Msg, connector => InstId, config => Config}), ?SLOG(info, #{msg => Msg, connector => InstId, config => emqx_misc:redact(Config)}),
NConfig = #{hosts := Hosts} = maybe_resolve_srv_and_txt_records(Config), NConfig = #{hosts := Hosts} = maybe_resolve_srv_and_txt_records(Config),
SslOpts = SslOpts =
case maps:get(enable, SSL) of case maps:get(enable, SSL) of

View File

@ -149,7 +149,7 @@ on_start(InstId, Conf) ->
?SLOG(info, #{ ?SLOG(info, #{
msg => "starting_mqtt_connector", msg => "starting_mqtt_connector",
connector => InstanceId, connector => InstanceId,
config => Conf config => emqx_misc:redact(Conf)
}), }),
BasicConf = basic_config(Conf), BasicConf = basic_config(Conf),
BridgeConf = BasicConf#{ BridgeConf = BasicConf#{

View File

@ -91,7 +91,7 @@ on_start(
?SLOG(info, #{ ?SLOG(info, #{
msg => "starting_mysql_connector", msg => "starting_mysql_connector",
connector => InstId, connector => InstId,
config => Config config => emqx_misc:redact(Config)
}), }),
SslOpts = SslOpts =
case maps:get(enable, SSL) of case maps:get(enable, SSL) of

View File

@ -94,7 +94,7 @@ on_start(
?SLOG(info, #{ ?SLOG(info, #{
msg => "starting_postgresql_connector", msg => "starting_postgresql_connector",
connector => InstId, connector => InstId,
config => Config config => emqx_misc:redact(Config)
}), }),
SslOpts = SslOpts =
case maps:get(enable, SSL) of case maps:get(enable, SSL) of

View File

@ -123,7 +123,7 @@ on_start(
?SLOG(info, #{ ?SLOG(info, #{
msg => "starting_redis_connector", msg => "starting_redis_connector",
connector => InstId, connector => InstId,
config => Config config => emqx_misc:redact(Config)
}), }),
ConfKey = ConfKey =
case Type of case Type of

View File

@ -0,0 +1 @@
Password information has been removed from information log messages for http, ldap, mongo, mqtt, mysql, pgsql and redis.

View File

@ -0,0 +1 @@
密码信息已从http、ldap、mongo、mqtt、mysql、pgsql和redis的信息日志消息中删除。