]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Allow signing incoming mails with recipient domain-key for ARC
authorJoel Stein <js@funkturm.net>
Tue, 13 Feb 2018 18:54:31 +0000 (19:54 +0100)
committerJoel Stein <js@funkturm.net>
Tue, 13 Feb 2018 18:54:31 +0000 (19:54 +0100)
lualib/dkim_sign_tools.lua

index 442b4a52bdff890130ef7e21402124fb0eb2f8ea..99915bc9167ded048105e6a06feb5265b07c841f 100644 (file)
@@ -37,6 +37,8 @@ local function prepare_dkim_signing(N, task, settings)
     rspamd_logger.debugm(N, task, 'mail is from address in sign_networks')
   elseif settings.sign_local and is_local then
     rspamd_logger.debugm(N, task, 'mail is from local address')
+  elseif settings.sign_received and not is_local and not auser then
+    rspamd_logger.debugm(N, task, 'mail was sent to us')
   else
     rspamd_logger.debugm(N, task, 'ignoring unauthenticated mail')
     return false,{}
@@ -55,9 +57,12 @@ local function prepare_dkim_signing(N, task, settings)
     return false,{}
   end
 
+  local eto = task:get_recipients(0)
+
   local dkim_domain
   local hdom = ((hfrom or E)[1] or E).domain
   local edom = ((efrom or E)[1] or E).domain
+  local tdom = ((eto or E)[1] or E).domain
   local udom = string.match(auser or '', '.*@(.*)')
 
   local function get_dkim_domain(dtype)
@@ -67,6 +72,8 @@ local function prepare_dkim_signing(N, task, settings)
       return edom
     elseif settings[dtype] == 'auth' then
       return udom
+    elseif settings[dtype] == 'recipient' then
+      return tdom
     end
   end
 
@@ -79,6 +86,9 @@ local function prepare_dkim_signing(N, task, settings)
   if udom then
     udom = udom:lower()
   end
+  if tdom then
+    tdom = tdom:lower()
+  end
 
   if settings.use_domain_sign_networks and is_sign_networks then
     dkim_domain = get_dkim_domain('use_domain_sign_networks')