I have a number of addreses and even whole domains where i do not ever expect to receive any valid mails, would it be possible to add the ability to nominiate these as 'spam traps' whereby all mail received is fed into SA using 'sa-learn --spam' either before or after the normal scanning takes place?
ie something like what is described in the section titled "SA-Lean script coupled with Spam Trap" on this page:
https://freedif.org/improve-spamassassi ... spam-trap/
Thanks
Spam Trap
- BruceLeeRoy
- Posts: 47
- Joined: 01 May 2015 13:27
Re: Spam Trap
I was searching for a similar feature. there are several email accounts that were closed over 10 years ago on my mail server that are still getting hammered. I have blacklisted them in EFA to cut down on backscatter and excessive traffic to and from the mail server. I occasionally go through the logs and mark them as spam in sa-learn. It would be nice to automate this process or even setup spam traps on domains that I manage. Thinking spammers might realize spam traps exist on my domains might also cut down on spam they send to my domains?
- BruceLeeRoy
- Posts: 47
- Joined: 01 May 2015 13:27
Re: Spam Trap
Actually I just found that you can run a filter for your spam trap then click "Message Operations" where you can flag the whole page of results to learn as spam.
Re: Spam Trap
Hi Guys
i have scripted a small solution that will be started by a cron job.
you need a file with your spamtrap addresses (one per line) and read this in the script.
enjoy it...
i have scripted a small solution that will be started by a cron job.
you need a file with your spamtrap addresses (one per line) and read this in the script.
Code: Select all
#Read a File with some Spamtrap Addresses and extracts information from maillog
while read sender
do
grep $sender /var/log/maillog >>/tmp/autolearn_spam_raw
done < /scripts/spamtrap_addresses #File with your Spamtrap Adresses
#gets the message ID from the last output
grep ': Message' /tmp/autolearn_spam_raw | awk '{print $7 >"/tmp/autolearn_spam"; }'
#set date for spam path
d=`date +%Y%m%d`
#sa-learn the specific mails
while read mail
do
sa-learn --spam /var/spool/MailScanner/quarantine/$d/spam/$mail --progress
done < /tmp/autolearn_spam
rm -rf /tmp/autolearn_spam
rm -rf /tmp/autolearn_spam_raw
always happy for any hints and tipps!
| EFA 3.0.2.6

- shawniverson
- Posts: 3608
- Joined: 13 Jan 2014 23:30
- Location: Indianapolis, Indiana USA
- Contact:
Re: Spam Trap
Awesome 

Re: Spam Trap
Does not work on my system.
The File "/tmp/autolearn_spam" wasn't created.
I use CentOs 8
The File "/tmp/autolearn_spam" wasn't created.
Code: Select all
grep ': Message' /tmp/autolearn_spam_raw | awk '{print $7 >"/tmp/autolearn_spam"; }'
benscha wrote: ↑08 Oct 2019 11:08 Hi Guys
i have scripted a small solution that will be started by a cron job.
you need a file with your spamtrap addresses (one per line) and read this in the script.
enjoy it...Code: Select all
#Read a File with some Spamtrap Addresses and extracts information from maillog while read sender do grep $sender /var/log/maillog >>/tmp/autolearn_spam_raw done < /scripts/spamtrap_addresses #File with your Spamtrap Adresses #gets the message ID from the last output grep ': Message' /tmp/autolearn_spam_raw | awk '{print $7 >"/tmp/autolearn_spam"; }' #set date for spam path d=`date +%Y%m%d` #sa-learn the specific mails while read mail do sa-learn --spam /var/spool/MailScanner/quarantine/$d/spam/$mail --progress done < /tmp/autolearn_spam rm -rf /tmp/autolearn_spam rm -rf /tmp/autolearn_spam_raw