From: Dmitriy Alekseev <1865999+dragoangel@users.noreply.github.com> Date: Mon, 21 Oct 2024 15:22:28 +0000 (+0200) Subject: strip also port from sender_ip X-Git-Tag: 3.11.0~33^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=275879825c151abb2b2f65fbe2011f89019dd56e;p=thirdparty%2Frspamd.git strip also port from sender_ip --- diff --git a/src/plugins/lua/elastic.lua b/src/plugins/lua/elastic.lua index 373733f114..e0e941b60b 100644 --- a/src/plugins/lua/elastic.lua +++ b/src/plugins/lua/elastic.lua @@ -491,7 +491,7 @@ local function get_general_metadata(task) r.sender_ip = '::' local origin = task:get_header('X-Originating-IP') if origin then - origin = origin:gsub('%[', ''):gsub('%]', '') + origin = origin:gsub('^%[', ''):gsub('%]:[0-9]+$', ''):gsub('%]$', '') local rspamd_ip = require "rspamd_ip" local origin_ip = rspamd_ip.from_string(origin) if origin_ip and origin_ip:is_valid() then