2018-01-16 18:57:27 +01:00
|
|
|
rules {
|
2018-12-15 21:23:42 +01:00
|
|
|
QUARANTINE {
|
|
|
|
backend = "http";
|
|
|
|
url = "http://nginx:9081/pipe.php";
|
2019-10-10 12:38:24 +02:00
|
|
|
selector = "reject_no_global_bl";
|
2018-12-15 21:23:42 +01:00
|
|
|
formatter = "default";
|
|
|
|
meta_headers = true;
|
|
|
|
}
|
|
|
|
RLINFO {
|
|
|
|
backend = "http";
|
|
|
|
url = "http://nginx:9081/pipe_rl.php";
|
|
|
|
selector = "ratelimited";
|
|
|
|
formatter = "json";
|
|
|
|
}
|
2020-04-16 15:42:10 +02:00
|
|
|
PUSHOVERMAIL {
|
2020-04-10 20:55:49 +02:00
|
|
|
backend = "http";
|
|
|
|
url = "http://nginx:9081/pushover.php";
|
2020-04-16 15:42:10 +02:00
|
|
|
selector = "mailcow_rcpt";
|
2020-04-10 20:55:49 +02:00
|
|
|
# Only return msgid, do not parse the full message
|
|
|
|
formatter = "msgid";
|
|
|
|
meta_headers = true;
|
|
|
|
}
|
2018-12-15 21:23:42 +01:00
|
|
|
}
|
2020-04-10 20:55:49 +02:00
|
|
|
|
2018-12-15 21:23:42 +01:00
|
|
|
custom_select {
|
2020-04-16 15:42:10 +02:00
|
|
|
mailcow_rcpt = <<EOD
|
2020-04-10 20:55:49 +02:00
|
|
|
return function(task)
|
|
|
|
local action = task:get_metric_action('default')
|
2021-09-07 19:39:03 +02:00
|
|
|
if task:has_symbol('NO_LOG_STAT') or (action == 'soft reject' or action == 'reject' or action == 'add header' or action == 'rewrite subject') then
|
2020-04-10 20:55:49 +02:00
|
|
|
return false
|
|
|
|
else
|
2020-04-16 15:42:10 +02:00
|
|
|
if task:get_symbol("RCPT_MAILCOW_DOMAIN") then
|
2020-04-10 20:55:49 +02:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
EOD;
|
2018-12-15 21:23:42 +01:00
|
|
|
ratelimited = <<EOD
|
|
|
|
return function(task)
|
|
|
|
local ratelimited = task:get_symbol("RATELIMITED")
|
|
|
|
if ratelimited then
|
|
|
|
return true
|
|
|
|
end
|
2019-05-01 22:50:38 +02:00
|
|
|
return false
|
2018-12-15 21:23:42 +01:00
|
|
|
end
|
2019-10-10 12:38:24 +02:00
|
|
|
EOD;
|
|
|
|
reject_no_global_bl = <<EOD
|
|
|
|
return function(task)
|
2020-10-23 20:23:26 +02:00
|
|
|
if not task:has_symbol('GLOBAL_SMTP_FROM_BL')
|
|
|
|
and not task:has_symbol('GLOBAL_MIME_FROM_BL')
|
|
|
|
and not task:has_symbol('LOCAL_BL_ASN')
|
|
|
|
and not task:has_symbol('GLOBAL_RCPT_BL')
|
2021-09-02 14:09:25 +02:00
|
|
|
and not task:has_symbol('BAD_SUBJECT_00')
|
2020-10-23 20:23:26 +02:00
|
|
|
and not task:has_symbol('MAILCOW_BLACK') then
|
|
|
|
local action = task:get_metric_action('default')
|
2020-11-13 21:26:42 +01:00
|
|
|
if action == 'reject' or action == 'add header' or action == 'rewrite subject' then
|
2020-11-06 12:26:01 +01:00
|
|
|
return true
|
|
|
|
end
|
2019-10-10 12:38:24 +02:00
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
2018-12-15 21:23:42 +01:00
|
|
|
EOD;
|
2018-01-16 18:57:27 +01:00
|
|
|
}
|
2020-04-10 20:55:49 +02:00
|
|
|
|
|
|
|
custom_format {
|
|
|
|
msgid = <<EOD
|
|
|
|
return function(task)
|
|
|
|
return task:get_message_id()
|
|
|
|
end
|
|
|
|
EOD;
|
|
|
|
}
|
|
|
|
|