metadata_exporter.conf 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. formatter = "json";
  20. meta_headers = true;
  21. }
  22. }
  23. custom_select {
  24. mailcow_rcpt = <<EOD
  25. return function(task)
  26. local action = task:get_metric_action('default')
  27. if task:has_symbol('NO_LOG_STAT') or (action == 'soft reject' or action == 'reject' or action == 'add header' or action == 'rewrite subject') then
  28. return false
  29. else
  30. if task:get_symbol("RCPT_MAILCOW_DOMAIN") then
  31. return true
  32. end
  33. return false
  34. end
  35. end
  36. EOD;
  37. ratelimited = <<EOD
  38. return function(task)
  39. local ratelimited = task:get_symbol("RATELIMITED")
  40. if ratelimited then
  41. return true
  42. end
  43. return false
  44. end
  45. EOD;
  46. reject_no_global_bl = <<EOD
  47. return function(task)
  48. if not task:has_symbol('GLOBAL_SMTP_FROM_BL')
  49. and not task:has_symbol('GLOBAL_MIME_FROM_BL')
  50. and not task:has_symbol('LOCAL_BL_ASN')
  51. and not task:has_symbol('GLOBAL_RCPT_BL')
  52. and not task:has_symbol('BAD_SUBJECT_00')
  53. and not task:has_symbol('MAILCOW_BLACK') then
  54. local action = task:get_metric_action('default')
  55. if action == 'reject' or action == 'add header' or action == 'rewrite subject' then
  56. return true
  57. end
  58. end
  59. return false
  60. end
  61. EOD;
  62. }
  63. custom_format {
  64. msgid = <<EOD
  65. return function(task)
  66. return task:get_message_id()
  67. end
  68. EOD;
  69. }