Hi this is what I intent to do, is there a function the gateway to do this?collect spam mails and feed them to spamassassin manually
I ran the same old system (scrollout f1) an that had an IMAP account to put whitelist / blacklist / training emails to. It was actually a very convenient way to train the system.
Hi Folks,
Sorry to drag up an oldish thread.
We have just moved over from Barracuda to PMG, as a result we are quite rightly due to a lack of learning seeing a lot of SPAM messages getting through.
Whilst I appreciate the 'auto learn' feature and all its benefits when the calls, no screams, to turn back on the Barracuda reach the level I now have to defend there has to be something that can be done to expedite the 'learning'.
We have had the PMG in place now for 2 months and the honesty the catchment rate isn't really improving.
Being able to setup a 'SPAM' / 'HAM' set of mailboxes and using these to teach SA is a must.
Has anyone used the manual SA-LEARN util with PMG, what method of feeding the mail into the system do you use given PMG isn't a full mailserver and hence there are no mbox/mbx/maildir folders to scan?
Cheers
Hi Folks,
Sorry to drag up an oldish thread.
We have just moved over from Barracuda to PMG, as a result we are quite rightly due to a lack of learning seeing a lot of SPAM messages getting through.
...
#!/bin/bash
MAILFILTER=10.1.1.94
for i in /vmail/*/.Spam/cur/* /vmail/*/.Spam/new/*; do
if [ -f "$i" ]; then
STATUS=`file "$i"`
if [[ $STATUS == *"gzip"* ]]; then
gunzip -d -c "$i" > /tmp/tempmail.$$
fi
if [[ $STATUS == *"bzip2"* ]]; then
bzip2 -d -c "$i" > /tmp/tempmail.$$
fi
if [[ $STATUS == *"SMTP mail"* ]]; then
cp "$i" /tmp/tempmail.$$
fi
cat /tmp/tempmail.$$ | ssh root@$MAILFILTER report
if [ $? != 0 ]; then
echo "Error running sa-learn. Aborting."
exit 1
fi
rm -f "$i"
rm -f /tmp/tempmail.$$
fi
done
#!/bin/sh
case "$SSH_ORIGINAL_COMMAND" in
report)
sa-learn --spam
;;
revoke)
sa-learn --ham
;;
*)
echo "Wwwwhat?"
;;
esac
So I got a bit sick of having no real solution to this - so I hacked something together....
My path structure is /vmail/$user/ for email. I use a Spam folder which ends up at /vmail/$user/.Spam/cur and /vmail/$user/.Spam/new
Set up an SSH public / private key to allow you to log into your PMG from your mail server. I won't cover this here - the instructions are a google search away if required.
On your mail server end, add the following script to your cron:
Bash:#!/bin/bash MAILFILTER=10.1.1.94 for i in /vmail/*/.Spam/cur/* /vmail/*/.Spam/new/*; do if [ -f "$i" ]; then STATUS=`file "$i"` if [[ $STATUS == *"gzip"* ]]; then gunzip -d -c "$i" > /tmp/tempmail.$$ fi if [[ $STATUS == *"bzip2"* ]]; then bzip2 -d -c "$i" > /tmp/tempmail.$$ fi if [[ $STATUS == *"SMTP mail"* ]]; then cp "$i" /tmp/tempmail.$$ fi cat /tmp/tempmail.$$ | ssh root@$MAILFILTER report if [ $? != 0 ]; then echo "Error running sa-learn. Aborting." exit 1 fi rm -f "$i" rm -f /tmp/tempmail.$$ fi done
On the PMG end, add `command="/root/bin/spam-reporter"` to your public key in /root/.ssh/authorized_keys.
Put this on your PMG as /root/bin/spam-reporter:
Bash:#!/bin/sh case "$SSH_ORIGINAL_COMMAND" in report) sa-learn --spam ;; revoke) sa-learn --ham ;; *) echo "Wwwwhat?" ;; esac
What will happen is that your mail server will end up reporting each spam message via sa-learn on the PMG system - which should allow your bayes filter to learn your spam a little better...
The annoying part is when spam gets quarantined - as the only way to feed it back as spam is to deliver the spam to the user, who then places it in their spam folder.
so lets me get this, this script is for emails that go though the PMG filter so the users can put in the spam folder and the PMG will learn. But what i dont get is this part
but isnt that a good thing?
I still use the quarantine globally, simply because to give PMG a workout, I ended up putting it in front of my mailing list servers that I operate for community projects. The quarantine lets me look at stuff that might be posted to the list if it wasn't for the spam filter.
Some of these are postable by anyone as they serve a special purpose (ie the committee mailing list) and need to be open to non-subscribers.
As I don't think you can control the quarantine for each individual user, it means I have to have it turns on for myself as well...