From 54aaea910810fb71af1e8faacee2e4267e58e5f0 Mon Sep 17 00:00:00 2001 From: Alexander Moisseev Date: Sun, 16 Sep 2018 16:58:34 +0300 Subject: [PATCH] [Feature] Relax FORGED_RECIPIENTS allow alias expansion and forwarding (Postfix) --- src/plugins/lua/forged_recipients.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/lua/forged_recipients.lua b/src/plugins/lua/forged_recipients.lua index 782a408bd..25d6c8f8c 100644 --- a/src/plugins/lua/forged_recipients.lua +++ b/src/plugins/lua/forged_recipients.lua @@ -28,6 +28,7 @@ local E = {} local function check_forged_headers(task) local auser = task:get_user() + local delivered_to = task:get_header('Delivered-To') local smtp_rcpt = task:get_recipients(1) local smtp_from = task:get_from(1) local res @@ -43,7 +44,7 @@ local function check_forged_headers(task) task:insert_result(symbol_rcpt, score, '', sra) return end - -- Find pair for each smtp recipient recipient in To or Cc headers + -- Find pair for each smtp recipient in To or Cc headers for _,sr in ipairs(smtp_rcpt) do res = false for _,mr in ipairs(mime_rcpt) do @@ -51,6 +52,10 @@ local function check_forged_headers(task) string.lower(mr['addr']) == string.lower(sr['addr']) then res = true break + elseif delivered_to and delivered_to == mr['addr'] then + -- allow alias expansion and forwarding (Postfix) + res = true + break elseif auser and auser == sr['addr'] then -- allow user to BCC themselves res = true -- 2.39.5