Projekt SpamAssassin - reguły antyspam - Zabójca spamu

Discussion in 'Research Tuts/Notes' started by Silas Mariusz, Mar 1, 2019.

Loading...
Tags:
  1. Silas Mariusz
    Online

    Silas Mariusz SysOp Administrator

    Joined:
    Apr 5, 2008
    Messages:
    8,752
    Local Time:
    5:42 PM
    Ratings:
    +1,826 / 39 / -9
    Followers:
    37
    QNAP:
    TS-x77
    Ethernet:
    1 GbE
    TS-x77 1 GbE
    awww.certyficate.it__wp_content_uploads_2014_05_SpamAssassin_logo.

    SpamHellper (c) Silas, Mariusz 2014-2019

    1. Zabojca spamu

    Code (Bash):
    1. mkdir -p /home/sys-usr.common/spamhelper
    2. cd /home/sys-usr.common/spamhelper
    3. touch local.cf.BL.SPAMTRAP local.cf.BL.ZABOJCASPAMU local.cf.reguly.ZABOJCASPAMU sa_body_test_pl.cf
    File: /home/sys-usr.common/spamhelper/downloader_zabojcaspamu.cron
    Code (Text):
    1. 12      *       *       *       *       /home/sys-usr.common/spamhelper/downloader_zabojcaspamu.sh
    File: /home/sys-usr.common/spamhelper/downloader_zabojcaspamu.sh
    Code (Bash):
    1. #!/bin/sh
    2.  
    3. files="local.cf.BL.SPAMTRAP local.cf.reguly.ZABOJCASPAMU local.cf.BL.ZABOJCASPAMU"
    4. url="http://zabojcaspamu.pl/"
    5. loc="/home/sys-usr.common/spamhelper/"
    6.  
    7. cd $loc
    8. for i in $files
    9. do
    10.     wget -N $url$i
    11. done
    File: /home/sys-usr.common/spamhelper/downloader_lemat.cron
    Code (Text):
    1. 12      *       *       *       *       /home/sys-usr.common/spamhelper/downloader_lemat.sh

    2. Lemat

    File: /home/sys-usr.common/spamhelper/downloader_lemat.sh
    Code (Bash):
    1. #!/bin/sh
    2.  
    3. files="sa_body_test_pl.cf"
    4. url="http://lemat.priv.pl/pliki/"
    5. loc="/home/sys-usr.common/spamhelper/"
    6.  
    7. cd $loc
    8. for i in $files
    9. do
    10.     wget -N $url$i
    11. done

    3. Apply rules script

    File: /home/sys-usr.common/spamhelper/spamassassin_add_rules.cron
    Code (Text):
    1. */5     *       *       *       *       /home/sys-usr.common/spamhelper/spamassassin_add_rules.sh
    File: /home/sys-usr.common/spamhelper/spamassassin_add_rules.sh
    Code (Bash):
    1. #!/bin/sh
    2.  
    3. touch local.cf.BL.SPAMTRAP local.cf.BL.ZABOJCASPAMU local.cf.reguly.ZABOJCASPAMU sa_body_test_pl.cf
    4. tag="include /home/sys-usr.common/spamhelper/local.cf.BL.SPAMTRAP
    5. include /home/sys-usr.common/spamhelper/local.cf.reguly.ZABOJCASPAMU
    6. include /home/sys-usr.common/spamhelper/local.cf.BL.ZABOJCASPAMU
    7. include /home/sys-usr.common/spamhelper/sa_body_test_pl.cf"
    8.  
    9. cp -af /etc/spamassassin/local.cf /etc/spamassassin/local.cf.bak
    10.  
    11. _IFS=$IFS
    12. printf '%s\n' "$tag" | while IFS= read -r line
    13. do
    14.         #echo "$line"
    15.         cat /etc/spamassassin/local.cf | grep "$line" 1>>/dev/null 2>>/dev/null
    16.         [ $? -ne 0 ] && echo "$line" >> /etc/spamassassin/local.cf
    17. done
    18. IFS=$_IFS
    19.  
    20. # reverts original config ?
    21. /etc/cron.daily/60sa-update
    22.  
    23. /etc/init.d/spamassassin reload
    24. /etc/init.d/spamassassin force-reload