mailcow/data/conf/rspamd/local.d/metadata_exporter.conf

68 lines
1.4 KiB
Plaintext
Raw Normal View History

2018-01-17 01:57:27 +08:00
rules {
QUARANTINE {
backend = "http";
url = "http://nginx:9081/pipe.php";
selector = "reject_no_global_bl";
formatter = "default";
meta_headers = true;
}
RLINFO {
backend = "http";
url = "http://nginx:9081/pipe_rl.php";
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")
if ratelimited then
return true
end
return false
end
EOD;
reject_no_global_bl = <<EOD
return function(task)
if not task:has_symbol('GLOBAL_SMTP_FROM_BL') and not task:has_symbol('GLOBAL_MIME_FROM_BL') then
local action = task:get_metric_action('default')
return (action == 'reject')
end
return false
end
EOD;
2018-01-17 01:57:27 +08:00
}
custom_format {
msgid = <<EOD
return function(task)
return task:get_message_id()
end
EOD;
}