[Rspamd] Add metadata exporter for unauthed mail

This commit is contained in:
andryyy
2020-04-10 20:55:49 +02:00
parent eeea1b393c
commit ccdb7fcd26
3 changed files with 253 additions and 15 deletions

View File

@@ -12,8 +12,31 @@ rules {
selector = "ratelimited";
formatter = "json";
}
UNAUTHMAIL {
backend = "http";
url = "http://nginx:9081/pushover.php";
selector = "unauth_mail";
# Only return msgid, do not parse the full message
formatter = "msgid";
meta_headers = true;
}
}
custom_select {
unauth_mail = <<EOD
return function(task)
local action = task:get_metric_action('default')
if task:has_symbol('NO_LOG_STAT') or (action == 'reject' or action == 'add header' or action == 'rewrite subject') then
return false
else
local uname = task:get_user()
if not uname then
return true
end
return false
end
end
EOD;
ratelimited = <<EOD
return function(task)
local ratelimited = task:get_symbol("RATELIMITED")
@@ -33,3 +56,12 @@ return function(task)
end
EOD;
}
custom_format {
msgid = <<EOD
return function(task)
return task:get_message_id()
end
EOD;
}