Răsfoiți Sursa

[Rspamd] Add symbol HAM_TRAP or SPAM_TRAP for trap aliases

andryyy 4 ani în urmă
părinte
comite
d94b5e43ea

+ 21 - 4
data/conf/rspamd/dynmaps/settings.php

@@ -394,21 +394,38 @@ while ($row = array_shift($rows)) {
 */
 
 ?>
-  traps {
+  ham_trap {
 <?php
-  foreach (ucl_rcpts('spam@localhost', 'mailbox') as $rcpt) {
+  foreach (ucl_rcpts('ham@localhost', 'mailbox') as $rcpt) {
 ?>
     rcpt = <?=json_encode($rcpt, JSON_UNESCAPED_SLASHES);?>;
 <?php
   }
-  foreach (ucl_rcpts('ham@localhost', 'mailbox') as $rcpt) {
+?>
+    priority = 9;
+    apply "default" {
+      symbols_enabled = ["HISTORY_SAVE"];
+    }
+    symbols [
+      "HAM_TRAP"
+    ]
+  }
+
+  spam_trap {
+<?php
+  foreach (ucl_rcpts('spam@localhost', 'mailbox') as $rcpt) {
 ?>
     rcpt = <?=json_encode($rcpt, JSON_UNESCAPED_SLASHES);?>;
 <?php
   }
 ?>
     priority = 9;
-    want_spam = yes;
+    apply "default" {
+      symbols_enabled = ["HISTORY_SAVE"];
+    }
+    symbols [
+      "SPAM_TRAP"
+    ]
   }
 <?php
 // Start additional content

+ 2 - 2
data/conf/rspamd/lua/rspamd.local.lua

@@ -113,9 +113,9 @@ rspamd_config:register_symbol({
     for _,fr in ipairs(from) do
       local fr_split = rspamd_str_split(fr['addr'], '@')
       if #fr_split == 2 then
-        if fr_split[1] == 'postmaster' then
+        if fr_split[1] == 'postmaster' and task:get_user() then
           -- no whitelist, keep signatures
-          task:insert_result(true, 'POSTMASTER_FROM', -2500.0, from_ip_string)
+          task:insert_result(true, 'POSTMASTER_FROM', -2500.0)
           return
         end
       end