]> source.dussan.org Git - rspamd.git/commitdiff
strip also port from sender_ip
authorDmitriy Alekseev <1865999+dragoangel@users.noreply.github.com>
Mon, 21 Oct 2024 15:22:28 +0000 (17:22 +0200)
committerDmitriy Alekseev <1865999+dragoangel@users.noreply.github.com>
Mon, 21 Oct 2024 15:22:28 +0000 (17:22 +0200)
src/plugins/lua/elastic.lua

index 373733f11452efe291ff1b261a916a95595d949a..e0e941b60b86efd953243deba9cde2b441fe4884 100644 (file)
@@ -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