From 275879825c151abb2b2f65fbe2011f89019dd56e Mon Sep 17 00:00:00 2001 From: Dmitriy Alekseev <1865999+dragoangel@users.noreply.github.com> Date: Mon, 21 Oct 2024 17:22:28 +0200 Subject: [PATCH] strip also port from sender_ip --- src/plugins/lua/elastic.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/lua/elastic.lua b/src/plugins/lua/elastic.lua index 373733f11..e0e941b60 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 -- 2.39.5