filter-rules.def.rc 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. ## filter-rules.rc
  2. # The rules used by procmail to filter mails
  3. # --------------------------------------------------------
  4. # Spamassassin headers
  5. # All the mails pass from spamassassin, and then get
  6. # the header, and the level for Junk is already low
  7. # e.g. X-Spam-Status: No, score=0.7 required=3.0
  8. # So for now no other regex on spamassassin rule are added
  9. # --------------------------------------------------------
  10. # -------------------------------------------------------
  11. # Drop duplicated and oversize mail (@amiglietta trick)
  12. # * temp save mail header in a lock file using `formail`
  13. # and if a new mail match the same msg-id stored drop
  14. # otherwise pass to next rule
  15. # * if mail_size > 8MB drop
  16. # -------------------------------------------------------
  17. :0 Wh: msgid.lock
  18. | formail -D 8192 $MAILDIR/.msgid.cache
  19. # ----------------------------------------------------------
  20. # AVOIDING ENLARGE YOUR PENIS, HOT GIRLS ... FILL YOUR INBOX
  21. # ^From address spam filter rule, spam all the mails
  22. # that don't match exception
  23. # ----------------------------------------------------------
  24. :0
  25. * ! ^From:.*@.*(\.)?(lcm|pcteor1)?(\.)?mi\.infn\.it>?.*$
  26. * ! ^From:.*@.*(\.)?(fisica|studenti|msg)?(\.)?unimi\.it>?.*$
  27. * ! ^From:.*@uninsubria\.it>?$
  28. * ! ^From:.*@cern\.ch>?$
  29. * ! ^From:.*@(gmail|outlook)\.com>?$
  30. * ! ^From:.*@cert-manager\.com>?$
  31. * ! ^To:.*@lists\.debian\.org>?$
  32. * ! ^Cc:.*@lists\.debian\.org>?$
  33. * ! ^From:.*@centos\.org>?$
  34. .Junk/new
  35. # ------------------------------------------------------
  36. # Admins, Staff, Working mails, can arrive from everyone
  37. # ------------------------------------------------------
  38. :0
  39. * ^(To|Cc): .*<?admins@(lcm|pcteor1)\.mi\.infn\.it>?.*$
  40. {
  41. :0
  42. * ^From:.*<?gogs@(lcm|pcteor1)\.mi\.infn\.it>?.*$
  43. .Gogs/new
  44. :0
  45. * ! ^From:.*<?gogs@(lcm|pcteor1)\.mi\.infn\.it>?.*$
  46. .Admins/new
  47. }
  48. # ----------------------
  49. # Filter Staff Log mails
  50. # ----------------------
  51. :0
  52. * ^(To|Cc):.*<?working@(lcm|pcteor1)\.mi\.infn\.it>?$
  53. {
  54. :0
  55. * ^Subject:.*Log150.*$
  56. .Log150/new
  57. :0
  58. * ^Subject:.*LogAdmin.*$
  59. .LogAdmin/new
  60. }
  61. # --------------------------------------------------
  62. # Report-Log mails, can arrive only from lcm domains
  63. # --------------------------------------------------
  64. :0
  65. * ^From:.*@.*(\.)?(lcm|pcteor1)\.mi\.infn\.it>?.*$
  66. {
  67. :0
  68. * ^To: <?farm\.backup@(lcm|pcteor1)\.mi\.infn\.it>?$
  69. .Backup\ Born/new
  70. :0
  71. * ^To: <?staff\.newborg@(lcm|pcteor1)\.mi\.infn\.it>?$
  72. .Backup\ Newborg/new
  73. :0
  74. * ^To: <?staff\.condor@(lcm|pcteor1)\.mi\.infn\.it>?$
  75. .Condor/new
  76. :0
  77. * ^To: <?farm.logs@(lcm|pcteor1)\.mi\.infn\.it>?$
  78. .Farm\ Logs/new
  79. :0
  80. * ^To: <?farmlogwatch@(lcm|pcteor1)\.mi\.infn\.it>?$
  81. {
  82. # ------------------------------------------------
  83. # Farm important machine Logwatch (born + galileo)
  84. # ------------------------------------------------
  85. :0
  86. * ^From:.*@(lcm|pcteor1)\.mi\.infn\.it>?.*$
  87. .Farm\ Logwatch\ I/new
  88. # -----------------------------------------
  89. # Farm Queue (General + Softload) Logwatch,
  90. # separated cause ^From
  91. # root@galileo.pcteor1.mi.infn.it
  92. # -----------------------------------------
  93. :0
  94. * ^From:.*@galileo\.(lcm|pcteor1)\.mi\.infn\.it>?.*$
  95. .Farm\ Logwatch\ II/new
  96. }
  97. :0
  98. * ^To: <?nagioslist@(lcm|pcteor1)\.mi\.infn\.it>?$
  99. .Nagios\ Cluster\ Newborg/new
  100. :0
  101. * ^(To|Cc):.*<?lcm\.accounts@(lcm|pcteor1)\.mi\.infn\.it>?$
  102. .LCM\ Accounts/new
  103. :0
  104. * ^To: <?nagiosfarm@(lcm|pcteor1)\.mi\.infn\.it>?$
  105. .Nagios\ Farm\ Born/new
  106. :0
  107. * ^To: <?logs@(lcm|pcteor1)\.mi\.infn\.it>?$
  108. {
  109. :0
  110. * ^From:.*@(lcm|pcteor1)\.mi\.infn.it>?.*$
  111. {
  112. # --------------------------------------
  113. # Cluster LCM important machine Logwatch
  114. # (videof, vcf, nanos8)
  115. # --------------------------------------
  116. :0
  117. * ^Subject:.*Logwatch.*$
  118. .Cluster\ Logwatch\ I/new
  119. # -----------------------------------------
  120. # Cluster LCM important machine SMART alert
  121. # (tuc, videof, vcf)
  122. # -----------------------------------------
  123. :0
  124. * ^Subject:.*SMART.*$
  125. .Cluster\ Logs/new
  126. # ---------------------------------------
  127. # Cron motion start night-day Logs filter
  128. # ---------------------------------------
  129. :0
  130. * ^Subject:.*/etc/init.d/motion.*$
  131. .Motion/new
  132. # --------------------
  133. # Fail2ban Logs filter
  134. # --------------------
  135. :0
  136. * ^Subject:.*Log Fail2Ban.*$
  137. .Fail2Ban\ Logs/new
  138. }
  139. # -------------------------------------------------
  140. # Special machine LCM Cluster Logwatch, SMART alert
  141. # (e.g. sheldon) separated cause ^From
  142. # root@special_name.pcteor1.mi.infn.it
  143. # -------------------------------------------------
  144. :0
  145. * ^From:.*@.*\.(lcm|pcteor1)\.mi\.infn\.it>?.*$
  146. {
  147. # -----------------------------------------
  148. # Cluster LCM semimportant machine Logwatch
  149. # -----------------------------------------
  150. :0
  151. * ^Subject:.*Logwatch.*$
  152. .Cluster\ Logwatch\ II/new
  153. # --------------------------------------------
  154. # Cluster LCM semimportant machine SMART alert
  155. # --------------------------------------------
  156. :0
  157. * ^Subject:.*SMART.*$
  158. .Cluster\ Logs/new
  159. }
  160. }
  161. :0
  162. * ^To: <?motion@(lcm|pcteor1)\.mi\.infn\.it>?$
  163. .Motion/new
  164. :0
  165. * ^Subject:.*WARNING HOME GALILEO.*$
  166. .Quota\ Farm/new
  167. # --------------------------------------------------------
  168. # Mail that should preferably be moved as a recipient
  169. # but no one has ever felt like it, so now they come here,
  170. # a semi INBOX (e.g. newborg pcteor1 logwatch)
  171. # --------------------------------------------------------
  172. :0
  173. * ^To: <?root@(lcm|pcteor1)\.mi\.infn\.it>?$
  174. .Root\ pcteor1/new
  175. }
  176. # ------------------------------
  177. # Important Debian mailing lists
  178. # ------------------------------
  179. :0
  180. * ^(To|Cc): <?debian-(announce|lts-announce|news|security-announce|stable-announce|changes-digest|release).*@lists\.debian\.org>?$
  181. .Debian\ I/new
  182. # -------------------------------------
  183. # Not so important Debian mailing lists
  184. # -------------------------------------
  185. :0
  186. * ^(To|Cc): <?debian-.+@lists\.debian\.org>?$
  187. .Debian\ II/new
  188. # -------------------
  189. # Centos mailing list
  190. # -------------------
  191. :0
  192. * ^From: <?centos-announce.*@centos\.org>?$
  193. .Centos/new
  194. # ---------------------
  195. # Yeee finally my INBOX
  196. # ---------------------
  197. :0
  198. $DEFAULT