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

Silas Mariusz

rm -rf /
Help us, GOD!
Apr 5, 2008
10,358
34
2,806
153
40
Nowy Sącz
forum.qnap.net.pl
QNAP
TS-x77
Ethernet
1 GbE
awww.certyficate.it__wp_content_uploads_2014_05_SpamAssassin_logo.png


SpamHellper (c) Silas, Mariusz 2014-2019

1. Zabojca spamu

Bash:
mkdir -p /home/sys-usr.common/spamhelper
cd /home/sys-usr.common/spamhelper
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:
12      *       *       *       *       /home/sys-usr.common/spamhelper/downloader_zabojcaspamu.sh

File: /home/sys-usr.common/spamhelper/downloader_zabojcaspamu.sh
Bash:
#!/bin/sh

files="local.cf.BL.SPAMTRAP local.cf.reguly.ZABOJCASPAMU local.cf.BL.ZABOJCASPAMU"
url="http://zabojcaspamu.pl/"
loc="/home/sys-usr.common/spamhelper/"

cd $loc
for i in $files
do
	wget -N $url$i
done

File: /home/sys-usr.common/spamhelper/downloader_lemat.cron
Code:
12      *       *       *       *       /home/sys-usr.common/spamhelper/downloader_lemat.sh


2. Lemat

File: /home/sys-usr.common/spamhelper/downloader_lemat.sh
Bash:
#!/bin/sh

files="sa_body_test_pl.cf"
url="http://lemat.priv.pl/pliki/"
loc="/home/sys-usr.common/spamhelper/"

cd $loc
for i in $files
do
	wget -N $url$i
done


3. Apply rules script

File: /home/sys-usr.common/spamhelper/spamassassin_add_rules.cron
Code:
*/5     *       *       *       *       /home/sys-usr.common/spamhelper/spamassassin_add_rules.sh

File: /home/sys-usr.common/spamhelper/spamassassin_add_rules.sh
Bash:
#!/bin/sh

touch local.cf.BL.SPAMTRAP local.cf.BL.ZABOJCASPAMU local.cf.reguly.ZABOJCASPAMU sa_body_test_pl.cf
tag="include /home/sys-usr.common/spamhelper/local.cf.BL.SPAMTRAP
include /home/sys-usr.common/spamhelper/local.cf.reguly.ZABOJCASPAMU
include /home/sys-usr.common/spamhelper/local.cf.BL.ZABOJCASPAMU
include /home/sys-usr.common/spamhelper/sa_body_test_pl.cf"

cp -af /etc/spamassassin/local.cf /etc/spamassassin/local.cf.bak

_IFS=$IFS
printf '%s\n' "$tag" | while IFS= read -r line
do
        #echo "$line"
        cat /etc/spamassassin/local.cf | grep "$line" 1>>/dev/null 2>>/dev/null
        [ $? -ne 0 ] && echo "$line" >> /etc/spamassassin/local.cf
done
IFS=$_IFS

# reverts original config ?
/etc/cron.daily/60sa-update

/etc/init.d/spamassassin reload
/etc/init.d/spamassassin force-reload