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"; |
Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame^] | 19 | formatter = "json"; |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 20 | meta_headers = true; |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | custom_select { |
| 25 | mailcow_rcpt = <<EOD |
| 26 | return function(task) |
| 27 | local action = task:get_metric_action('default') |
Matthias Andreas Benkard | 12a5735 | 2021-12-28 18:02:04 +0100 | [diff] [blame] | 28 | 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] | 29 | return false |
| 30 | else |
| 31 | if task:get_symbol("RCPT_MAILCOW_DOMAIN") then |
| 32 | return true |
| 33 | end |
| 34 | return false |
| 35 | end |
| 36 | end |
| 37 | EOD; |
| 38 | ratelimited = <<EOD |
| 39 | return function(task) |
| 40 | local ratelimited = task:get_symbol("RATELIMITED") |
| 41 | if ratelimited then |
| 42 | return true |
| 43 | end |
| 44 | return false |
| 45 | end |
| 46 | EOD; |
| 47 | reject_no_global_bl = <<EOD |
| 48 | return function(task) |
| 49 | if not task:has_symbol('GLOBAL_SMTP_FROM_BL') |
| 50 | and not task:has_symbol('GLOBAL_MIME_FROM_BL') |
| 51 | and not task:has_symbol('LOCAL_BL_ASN') |
| 52 | and not task:has_symbol('GLOBAL_RCPT_BL') |
Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame] | 53 | and not task:has_symbol('BAD_SUBJECT_00') |
Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 54 | and not task:has_symbol('MAILCOW_BLACK') then |
| 55 | local action = task:get_metric_action('default') |
| 56 | if action == 'reject' or action == 'add header' or action == 'rewrite subject' then |
| 57 | return true |
| 58 | end |
| 59 | end |
| 60 | return false |
| 61 | end |
| 62 | EOD; |
| 63 | } |
| 64 | |
| 65 | custom_format { |
| 66 | msgid = <<EOD |
| 67 | return function(task) |
| 68 | return task:get_message_id() |
| 69 | end |
| 70 | EOD; |
| 71 | } |
| 72 | |