blob: 47373d99514e5b5cad5f1b12f5f86d2ed0cd728c [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";
19 # Only return msgid, do not parse the full message
20 formatter = "msgid";
21 meta_headers = true;
22 }
23}
24
25custom_select {
26 mailcow_rcpt = <<EOD
27return function(task)
28 local action = task:get_metric_action('default')
Matthias Andreas Benkard12a57352021-12-28 18:02:04 +010029 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 +010030 return false
31 else
32 if task:get_symbol("RCPT_MAILCOW_DOMAIN") then
33 return true
34 end
35 return false
36 end
37end
38EOD;
39 ratelimited = <<EOD
40return function(task)
41 local ratelimited = task:get_symbol("RATELIMITED")
42 if ratelimited then
43 return true
44 end
45 return false
46end
47EOD;
48 reject_no_global_bl = <<EOD
49return 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 Benkard7b2a3a12021-08-16 10:57:25 +020054 and not task:has_symbol('BAD_SUBJECT_00')
Matthias Andreas Benkardb382b102021-01-02 15:32:21 +010055 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
62end
63EOD;
64}
65
66custom_format {
67 msgid = <<EOD
68return function(task)
69 return task:get_message_id()
70end
71EOD;
72}
73