commit c6bec0f: [Conf] Add new plugin default configuration

Vsevolod Stakhov vsevolod at rspamd.com
Mon Sep 25 14:49:06 UTC 2023


Author: Vsevolod Stakhov
Date: 2023-09-24 13:19:42 +0100
URL: https://github.com/rspamd/rspamd/commit/c6bec0f8dfa6790b8a3f919aeb09440b4d367a42

[Conf] Add new plugin default configuration

---
 conf/modules.d/know_senders.conf  | 31 +++++++++++++++++++++++++++++++
 src/plugins/lua/known_senders.lua | 13 +++++++++++--
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/conf/modules.d/know_senders.conf b/conf/modules.d/know_senders.conf
new file mode 100644
index 000000000..80b923908
--- /dev/null
+++ b/conf/modules.d/know_senders.conf
@@ -0,0 +1,31 @@
+# Please don't modify this file as your changes might be overwritten with
+# the next update.
+#
+# You can modify 'local.d/known_senders.conf' to add and merge
+# parameters defined inside this section
+#
+# You can modify 'override.d/known_senders.conf' to strictly override all
+# parameters defined inside this section
+#
+# See https://rspamd.com/doc/faq.html#what-are-the-locald-and-overrided-directories
+# for details
+#
+# Module documentation can be found at  https://rspamd.com/doc/modules/known_senders.html
+
+known_senders {
+  # This module is default-disabled
+  enabled = false;
+
+  # Domains to track senders
+  domains = "https://maps.rspamd.com/freemail/free.txt.zst";
+  # Maximum number of elements
+  max_senders = 100000;
+  # Maximum time to live (when not using bloom filters)
+  max_ttl = 30d;
+  # Use bloom filters (must be enabled in Redis as a plugin)
+  use_bloom = false;
+
+  .include(try=true,priority=5) "${DBDIR}/dynamic/known_senders.conf"
+  .include(try=true,priority=1,duplicate=merge) "$LOCAL_CONFDIR/local.d/known_senders.conf"
+  .include(try=true,priority=10) "$LOCAL_CONFDIR/override.d/known_senders.conf"
+}
\ No newline at end of file
diff --git a/src/plugins/lua/known_senders.lua b/src/plugins/lua/known_senders.lua
index 99ca194ae..274821904 100644
--- a/src/plugins/lua/known_senders.lua
+++ b/src/plugins/lua/known_senders.lua
@@ -157,10 +157,18 @@ local function known_senders_callback(task)
   local smtp_from = (task:get_from('smtp') or {})[1]
   local mime_key, smtp_key
   if mime_from and mime_from.addr then
-    mime_key = make_key(mime_from)
+    if settings.domains.get_key(mime_from.domain) then
+      mime_key = make_key(mime_from)
+    else
+      lua_util.debugm(N, task, 'skip mime from domain %s', mime_from.domain)
+    end
   end
   if smtp_from and smtp_from.addr then
-    smtp_key = make_key(smtp_from)
+    if settings.domains.get_key(smtp_from.domain) then
+      smtp_key = make_key(smtp_from)
+    else
+      lua_util.debugm(N, task, 'skip smtp from domain %s', smtp_from.domain)
+    end
   end
 
   if mime_key and smtp_key and mime_key ~= smtp_key then
@@ -197,6 +205,7 @@ if opts then
       type = 'normal',
       callback = known_senders_callback,
       one_shot = true,
+      score = -1.0,
       augmentations = { string.format("timeout=%f", redis_params.timeout or 0.0) }
     })
   else


More information about the Commits mailing list