Quellcode durchsuchen

[Minor] Added check_authed and check_local for spamtrap

tags/1.7.0
Christian Roessner vor 6 Jahren
Ursprung
Commit
3ae6262209
2 geänderte Dateien mit 15 neuen und 1 gelöschten Zeilen
  1. 4
    0
      conf/modules.d/spamtrap.conf
  2. 11
    1
      src/plugins/lua/spamtrap.lua

+ 4
- 0
conf/modules.d/spamtrap.conf Datei anzeigen

@@ -40,6 +40,10 @@ spamtrap {
#fuzy_weight = 10;
# Redis key prefix
#key_prefix = 'sptr_';
# Skip spamtrap checks for authorized users
#check_authed = false;
# Skip spamtrap checks for local networks
#check_local = false;

# !!! Disabled by default !!!
enabled = false;

+ 11
- 1
src/plugins/lua/spamtrap.lua Datei anzeigen

@@ -29,14 +29,24 @@ local settings = {
learn_spam = false,
fuzzy_flag = 1,
fuzzy_weight = 10.0,
key_prefix = 'sptr_'
key_prefix = 'sptr_',
check_authed = true,
check_local = true
}

local function spamtrap_cb(task)
local rcpts = task:get_recipients('smtp')
local authed_user = task:get_user()
local ip_addr = task:get_ip()
local called_for_domain = false
local target

if ((not settings['check_authed'] and authed_user) or
(not settings['check_local'] and ip_addr and ip_addr:is_local())) then
rspamd_logger.infox(task, "skip spamtrap checks for local networks or authenticated user");
return
end

local function do_action(rcpt)
if settings['learn_fuzzy'] then
rspamd_plugins.fuzzy_check.learn(task,

Laden…
Abbrechen
Speichern