Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 1 | rules { |
| 2 | QUARANTINE { |
| 3 | backend = "http"; |
| 4 | url = "http://nginx:9081/pipe.php"; |
| 5 | selector = "reject_no_global_bl"; |
| 6 | formatter = "default"; |
| 7 | meta_headers = true; |
| 8 | } |
| 9 | RLINFO { |
| 10 | backend = "http"; |
| 11 | url = "http://nginx:9081/pipe_rl.php"; |
| 12 | selector = "ratelimited"; |
| 13 | formatter = "json"; |
| 14 | } |
| 15 | PUSHOVERMAIL { |
| 16 | backend = "http"; |
| 17 | url = "http://nginx:9081/pushover.php"; |
| 18 | selector = "mailcow_rcpt"; |
| 19 | # Only return msgid, do not parse the full message |
| 20 | formatter = "msgid"; |
| 21 | meta_headers = true; |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | custom_select { |
| 26 | mailcow_rcpt = <<EOD |
| 27 | return function(task) |
| 28 | local action = task:get_metric_action('default') |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame^] | 29 | if task:has_symbol('NO_LOG_STAT') or (action == 'soft reject' or action == 'reject' or action == 'add header' or action == 'rewrite subject') then |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 30 | return false |
| 31 | else |
| 32 | if task:get_symbol("RCPT_MAILCOW_DOMAIN") then |
| 33 | return true |
| 34 | end |
| 35 | return false |
| 36 | end |
| 37 | end |
| 38 | EOD; |
| 39 | ratelimited = <<EOD |
| 40 | return function(task) |
| 41 | local ratelimited = task:get_symbol("RATELIMITED") |
| 42 | if ratelimited then |
| 43 | return true |
| 44 | end |
| 45 | return false |
| 46 | end |
| 47 | EOD; |
| 48 | reject_no_global_bl = <<EOD |
| 49 | return function(task) |
| 50 | if not task:has_symbol('GLOBAL_SMTP_FROM_BL') |
| 51 | and not task:has_symbol('GLOBAL_MIME_FROM_BL') |
| 52 | and not task:has_symbol('LOCAL_BL_ASN') |
| 53 | and not task:has_symbol('GLOBAL_RCPT_BL') |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 54 | and not task:has_symbol('BAD_SUBJECT_00') |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 55 | and not task:has_symbol('MAILCOW_BLACK') then |
| 56 | local action = task:get_metric_action('default') |
| 57 | if action == 'reject' or action == 'add header' or action == 'rewrite subject' then |
| 58 | return true |
| 59 | end |
| 60 | end |
| 61 | return false |
| 62 | end |
| 63 | EOD; |
| 64 | } |
| 65 | |
| 66 | custom_format { |
| 67 | msgid = <<EOD |
| 68 | return function(task) |
| 69 | return task:get_message_id() |
| 70 | end |
| 71 | EOD; |
| 72 | } |
| 73 | |