blob: daaa79b4e11381828cb9c64d1d93baaae0612b91 [file] [log] [blame]
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +01001rules {
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 Benkard1ba53812022-12-27 17:32:58 +010019 formatter = "json";
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010020 meta_headers = true;
21 }
22}
23
24custom_select {
25 mailcow_rcpt = <<EOD
26return function(task)
27 local action = task:get_metric_action('default')
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010028 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 Benkardb382b102021-01-02 15:32:21 +010029 return false
30 else
31 if task:get_symbol("RCPT_MAILCOW_DOMAIN") then
32 return true
33 end
34 return false
35 end
36end
37EOD;
38 ratelimited = <<EOD
39return function(task)
40 local ratelimited = task:get_symbol("RATELIMITED")
41 if ratelimited then
42 return true
43 end
44 return false
45end
46EOD;
47 reject_no_global_bl = <<EOD
48return 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 Benkard7b2a3a12021-08-16 10:57:25 +020053 and not task:has_symbol('BAD_SUBJECT_00')
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010054 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
61end
62EOD;
63}
64
65custom_format {
66 msgid = <<EOD
67return function(task)
68 return task:get_message_id()
69end
70EOD;
71}
72