Advertisement
Guest User

Untitled

a guest
Dec 17th, 2015
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.12 KB | None | 0 0
  1. ok_locales all
  2. skip_rbl_checks 0
  3.  
  4. required_score 5
  5. report_safe 1
  6. rewrite_header Subject ***SPAM***
  7.  
  8. use_pyzor 1
  9. use_razor2 1
  10.  
  11. use_auto_whitelist 0
  12.  
  13.  
  14. use_bayes 1
  15. use_bayes_rules 1
  16. bayes_auto_learn 1
  17. blacklist_from *@kupiizaradi.cjb.net
  18. blacklist_from *@hallmark.com
  19. whitelist_from *@*hrgworldwide.com
  20. whitelist_from *@bluehost.com
  21. #blacklist_from *@greekajob.com
  22.  
  23. header CONTAINS_VIG Subject =~ /viagra, Cialix Pills, sex, xxx, penis, pussy, greekajob, greekajobs, pera
  24. zdera/
  25. body CONTAINS_PEN /viagra, sex, xxx, penis, puss, greekajob, greekajobs, perazdera/
  26. score CONTAINS_VIG 1.5
  27. score CONTAINS_PEN 1.5
  28. describe CONTAINS_VIG Bad Word
  29. describe CONTAINS_PEN Bad Word
  30.  
  31. SHELL="/bin/sh"
  32. import EXT
  33. import HOST
  34. VHOME=`pwd`
  35. TIMESTAMP=`date "+%b %d %H:%M:%S"`
  36. #VERBOSE=9
  37.  
  38. logfile "/var/log/maildrop/maildrop.log"
  39. log "$TIMESTAMP - BEGIN maildrop processing for $EXT@$HOST ==="
  40.  
  41. `test -r $VHOME/.mailfilter`
  42. if($RETURNCODE == 0)
  43. {
  44. log "including $VHOME/.mailfilter"
  45. exception {
  46. include $VHOME/.mailfilter
  47. }
  48. }
  49.  
  50.  
  51. # does maildirsize exist?
  52. `test -e $VHOME/Maildir/maildirsize`
  53.  
  54. # if maildirsize doesn't exist
  55. if($RETURNCODE == 1)
  56. {
  57.  
  58. # does vuserinfo exist?
  59. `test -x /home/vpopmail/bin/vuserinfo`
  60.  
  61. # if vuserinfo exists
  62. if($RETURNCODE == 0)
  63. {
  64. # does the user exist?
  65. `/home/vpopmail/bin/vuserinfo $EXT@$HOST`
  66. if($RETURNCODE == 0)
  67. {
  68.  
  69. # find out what the user's quota is
  70. $QUOTA=`/home/vpopmail/bin/vuserinfo -Q $EXT@$HOST`
  71. log "QUOTA = $QUOTA"
  72.  
  73. # does maildirmake exists?
  74. `test -x /usr/bin/maildirmake`
  75.  
  76. # if maildirmake exists
  77. if($RETURNCODE == 0)
  78. {
  79.  
  80. # does Maildir exist?
  81. `test -d $VHOME/Maildir`
  82.  
  83. # if Maildir exists
  84. if($RETURNCODE == 0)
  85. {
  86.  
  87. # make the maildirsize file
  88. `/usr/bin/maildirmake -q $QUOTA $VHOME/Maildir`
  89. `test -s "$VHOME/Maildir/maildirsize"`
  90.  
  91. # if maildirsize exists
  92. if($RETURNCODE == 0)
  93. {
  94. `/bin/chown vpopmail:vchkpw $VHOME/Maildir/maildirsize`
  95. `/bin/chmod 640 $VHOME/Maildir/maildirsize`
  96.  
  97. # else
  98. }
  99. else
  100. {
  101. log "Problem making 'maildirsize' for $VHOME"
  102. }
  103.  
  104. # end if maildirsize exists
  105. }
  106. else
  107. {
  108. log "Maildir does not exist for $VHOME"
  109. }
  110.  
  111. # end if Maildir exists
  112. }
  113. else
  114. {
  115. log "maildirmake does not exist"
  116.  
  117. # end if maildirmake exists
  118. }
  119. }
  120. else
  121. {
  122. log "user $EXT@HOST does not exist"
  123.  
  124. # end if user exists
  125. }
  126. }
  127. else
  128. {
  129. log "vuserinfo does not exist"
  130.  
  131. # end if vuserinfo exists
  132. }
  133. }
  134. # does maildirsize exist?
  135. `test -e $VHOME/Maildir/maildirsize`
  136. if($RETURNCODE == 0)
  137. {
  138. MAILDIRQUOTA=`/usr/bin/head -n1 $VHOME/Maildir/maildirsize`
  139. log "MAILDIRQUOTA = $MAILDIRQUOTA"
  140. }
  141.  
  142.  
  143. #--------------------------------------------------------
  144. # Filter spam - scores >= SPAMLIMIT is not delivered
  145. #
  146. # If you DO NOT want to send mail that is over the spam limit
  147. # to spamassassin autolearn, comment: 'cc "|sa-learn -spam"'
  148. #--------------------------------------------------------
  149.  
  150. ##########################################################################
  151. # Below is where I found some of the main problem, i.e apparently the
  152. # regex logic changed, do a diff against this one and the old one,
  153. # the old one was delimited with the '!' (bang) and grouped as a whole.
  154. # it failed the match always. By using standard regex grouping, I was able
  155. # to get the filter working. By grouping the score accordingly, it
  156. # breaks it into a number and precision, e.g. MATCH1 and MATCH2
  157. ##########################################################################
  158.  
  159. if(/^X-Spam-Status: Yes, score=([0-9]+).([0-9]+)/:h)
  160. {
  161. if($MATCH1 >= 5)
  162. {
  163. cc "|sa-learn --spam"
  164. }
  165.  
  166. # if the user doesnt' have a Spam folder
  167. `test -d $VHOME/Maildir/.Spam`
  168. if($RETURNCODE == 1)
  169. {
  170. `test -x /usr/bin/maildirmake`
  171. if($RETURNCODE == 0)
  172. {
  173. `/usr/bin/maildirmake -f Spam $VHOME/Maildir`
  174. `test -x /usr/bin/subscribeIMAP.sh`
  175. if($RETURNCODE == 0)
  176. {
  177. `/usr/bin/subscribeIMAP.sh Spam $VHOME`
  178. }
  179. }
  180. }
  181.  
  182. # make sure the deliverquota binary exists and is executable
  183. `test -x /usr/bin/deliverquota`
  184. if($RETURNCODE == 1)
  185. {
  186. exception {
  187. to "$VHOME/Maildir/.Spam"
  188. }
  189. }
  190. else
  191. {
  192. cc "|/usr/bin/deliverquota -w 90 $VHOME/Maildir/.Spam"
  193. if($RETURNCODE == 0)
  194. {
  195. log "=== END === $EXT@$HOST success (quota)"
  196. EXITCODE=0
  197. exit
  198. }
  199. else
  200. {
  201. if($RETURNCODE == 77)
  202. {
  203. log "$TIMESTAMP - $EXT@$HOST bounced (quota)"
  204. to "|/var/qmail/bin/bouncesaying '$EXT@$HOST is over quota'"
  205. }
  206. else
  207. {
  208. log
  209. "$TIMESTAMP - $EXT@$HOST failure (unknown deliverquota error)"
  210. to "$VHOME/Maildir/.Spam"
  211. }
  212. }
  213. }
  214. }
  215.  
  216. ##########################################################################
  217. # Same as above
  218. ##########################################################################
  219. if(/^X-Spam-Status: No, score=([-]*[0-9]+).([0-9]+) /:h)
  220. {
  221. log " message is clean ($MATCH1.$MATCH2)"
  222. }
  223.  
  224.  
  225. #--------------------------------------------------------
  226. # Include any user rules
  227. #--------------------------------------------------------
  228.  
  229. `test -r $VHOME/Maildir/.mailfilter`
  230. if($RETURNCODE == 0)
  231. {
  232. log " including $VHOME/Maildir/.mailfilter"
  233. exception {
  234. include $VHOME/Maildir/.mailfilter
  235. }
  236. }
  237.  
  238. `test -x /usr/bin/deliverquota`
  239. if ($RETURNCODE == 1)
  240. {
  241. log "$TIMESTAMP - $EXT@$HOST WARNING: no deliverquota!"
  242. log "=== END === $EXT@$HOST success"
  243. exception {
  244. to "$VHOME/Maildir"
  245. }
  246. }
  247. else
  248. {
  249. exception {
  250. log "RETCODE = $RETURNCODE delivering to $VHOME/Maildir"
  251. xfilter "/usr/bin/deliverquota -w 90 $VHOME/Maildir"
  252. }
  253. #--------------------------------------------------------
  254. # check to make sure the message was delivered
  255. # returncode 77 means that out maildir was overquota - bounce mail
  256. #--------------------------------------------------------
  257. if($RETURNCODE == 77)
  258. {
  259. log "$TIMESTAMP - BOUNCED: bouncesaying '$EXT@$HOST is over quota'"
  260. log "$TIMESTAMP - $EXT@$HOST bounced"
  261. to "|/var/qmail/bin/bouncesaying '$EXT@$HOST is over quota'"
  262. }
  263. else
  264. {
  265. log "=== END === $EXT@$HOST success (quota)"
  266. EXITCODE=0
  267. exit
  268. }
  269. }
  270.  
  271. log "$TIMESTAMP - $EXT@$HOST - WARNING: This message should never be printed!"
  272. [root@um-1027 /etc/mail]#
  273.  
  274. |/var/qmail/bin/preline /usr/bin/maildrop /etc/mail/mailfilter
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement