From 7bd1fd3489321679e8bddbea6aeb7bb9630e6dae Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Fri, 7 Jan 2022 09:07:32 +0100 Subject: [PATCH] fix 2145 --- core/admin/mailu/internal/views/auth.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/admin/mailu/internal/views/auth.py b/core/admin/mailu/internal/views/auth.py index 3626bad5..a9c1261a 100644 --- a/core/admin/mailu/internal/views/auth.py +++ b/core/admin/mailu/internal/views/auth.py @@ -18,7 +18,8 @@ def nginx_authentication(): response.headers['Auth-Error-Code'] = '502 5.5.1' utils.limiter.rate_limit_ip(client_ip) return response - if utils.limiter.should_rate_limit_ip(client_ip): + is_from_webmail = headers['Auth-Port'] in ['10143', '10025'] + if not is_from_webmail and utils.limiter.should_rate_limit_ip(client_ip): status, code = nginx.get_status(flask.request.headers['Auth-Protocol'], 'ratelimit') response = flask.Response() response.headers['Auth-Status'] = status @@ -31,7 +32,6 @@ def nginx_authentication(): for key, value in headers.items(): response.headers[key] = str(value) is_valid_user = False - is_from_webmail = headers['Auth-Port'] in ['10143', '10025'] if response.headers.get("Auth-User-Exists"): username = response.headers["Auth-User"] if utils.limiter.should_rate_limit_user(username, client_ip):