diff options
| author | dcorbacho <dparracorbacho@piotal.io> | 2020-09-18 16:11:13 +0100 |
|---|---|---|
| committer | Michael Klishin <michael@clojurewerkz.org> | 2020-10-14 05:18:17 +0300 |
| commit | 1f8aa6994af0931336d57090c7da1057723b751a (patch) | |
| tree | 2b494c366f920315a5819ef15e365acb0515ac8f | |
| parent | 6f98f84ae2ab67a0d799e7a1e6d22bebdfa703e5 (diff) | |
| download | rabbitmq-server-git-1f8aa6994af0931336d57090c7da1057723b751a.tar.gz | |
Add protocol to auth attempt metrics
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | src/rabbit_reader.erl | 12 |
2 files changed, 7 insertions, 7 deletions
@@ -119,7 +119,7 @@ define PROJECT_ENV %% interval at which connection/channel tracking executes post operations {tracking_execution_timeout, 15000}, {stream_messages_soft_limit, 256}, - {return_per_user_auth_attempt_metrics, false} + {track_auth_attempt_source, false} ] endef diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl index c4b4b1fd36..c91dbbc105 100644 --- a/src/rabbit_reader.erl +++ b/src/rabbit_reader.erl @@ -1413,19 +1413,19 @@ auth_phase(Response, auth_mechanism = {Name, AuthMechanism}, auth_state = AuthState}, sock = Sock}) -> - Ip = list_to_binary(inet:ntoa(Connection#connection.host)), + RemoteAddress = list_to_binary(inet:ntoa(Connection#connection.host)), case AuthMechanism:handle_response(Response, AuthState) of {refused, Username, Msg, Args} -> - rabbit_core_metrics:auth_attempt_failed(Ip, Username), + rabbit_core_metrics:auth_attempt_failed(RemoteAddress, Username, amqp091), auth_fail(Username, Msg, Args, Name, State); {protocol_error, Msg, Args} -> - rabbit_core_metrics:auth_attempt_failed(Ip, ""), + rabbit_core_metrics:auth_attempt_failed(RemoteAddress, <<>>, amqp091), notify_auth_result(none, user_authentication_failure, [{error, rabbit_misc:format(Msg, Args)}], State), rabbit_misc:protocol_error(syntax_error, Msg, Args); {challenge, Challenge, AuthState1} -> - rabbit_core_metrics:auth_attempt_succeeded(Ip, ""), + rabbit_core_metrics:auth_attempt_succeeded(RemoteAddress, <<>>, amqp091), Secure = #'connection.secure'{challenge = Challenge}, ok = send_on_channel0(Sock, Secure, Protocol), State#v1{connection = Connection#connection{ @@ -1433,11 +1433,11 @@ auth_phase(Response, {ok, User = #user{username = Username}} -> case rabbit_access_control:check_user_loopback(Username, Sock) of ok -> - rabbit_core_metrics:auth_attempt_succeeded(Ip, Username), + rabbit_core_metrics:auth_attempt_succeeded(RemoteAddress, Username, amqp091), notify_auth_result(Username, user_authentication_success, [], State); not_allowed -> - rabbit_core_metrics:auth_attempt_failed(Ip, Username), + rabbit_core_metrics:auth_attempt_failed(RemoteAddress, Username, amqp091), auth_fail(Username, "user '~s' can only connect via " "localhost", [Username], Name, State) end, |
