From: Dmitriy Alekseev <1865999+dragoangel@users.noreply.github.com> Date: Tue, 25 Mar 2025 02:03:15 +0000 (+0100) Subject: Add Sieve and cPanel forwarding symbols X-Git-Tag: 3.12.0~43^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70d28c8b6194e46c51e3f82dd2833aea5770f041;p=thirdparty%2Frspamd.git Add Sieve and cPanel forwarding symbols --- diff --git a/rules/forwarding.lua b/rules/forwarding.lua index a008c587d5..8feb631459 100644 --- a/rules/forwarding.lua +++ b/rules/forwarding.lua @@ -107,6 +107,53 @@ rspamd_config.FWD_SRS = { group = "forwarding" } +rspamd_config.FWD_SIEVE = { + callback = function(task) + if not (task:has_from(1) and task:has_recipients(1)) then + return false + end + local envfrom = task:get_from(1) + local envrcpts = task:get_recipients(1) + -- Forwarding is only to a single recipient + if #envrcpts > 1 then + return false + end + if envfrom[1].user:lower():find('^srs[01]=') then + return task:has_header('X-Sieve-Redirected-From') + end + return false + end, + score = 0.0, + description = "Message was forwarded using Sieve", + group = "forwarding" +} + +rspamd_config.FWD_CPANEL = { + callback = function(task) + if not (task:has_from(1) and task:has_recipients(1)) then + return false + end + local envfrom = task:get_from(1) + local envrcpts = task:get_recipients(1) + -- Forwarding is only to a single recipient + if #envrcpts > 1 then + return false + end + if envfrom[1].user:lower():find('^srs[01]=') then + local rewrite_hdr = task:get_header('From-Rewrite') + if rewrite_hdr then + return rewrite_hdr:find('forwarded message') + else + return false + end + end + return false + end, + score = 0.0, + description = "Message was forwarded using cPanel", + group = "forwarding" +} + rspamd_config.FORWARDED = { callback = function(task) local function normalize_addr(addr)