Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 6th November 2007, 16:46
AlArenal AlArenal is offline
Senior Member
 
Join Date: Feb 2007
Location: Germany
Posts: 104
Thanks: 1
Thanked 5 Times in 5 Posts
Default Redirecting spam with procmail

Hi!

I'm trying to get this setup to work:

I use a standard ISPConfig installation and so I use postfix, spamassassin over procmail, etc. I created an email account spam@mydomain.tld and added the following code to my spamassassin.rc.master file. Afterwards I changed my accounts so the config got regenerated and reflected my changes in the user's local .spamassassin.rc . Here's my code snippet:

Code:
:0:
* ^TO_.*@mydomain.tld
* !^X-Loop: spam@mydomain.tld
* ^X-Spam-Status: Yes
| formail -A "X-Loop: spam@mydomain.tld" | \
  /usr/sbin/sendmail -oi spam@mydomain.tld
This code works, meaning all mail that gets marked as spam by spamassassin also gets redirected to spam@mydomain.tld. However there is one drawback:
The mails in my spam account contain the original mail (as returned by spamassassin) several times attached to itself (maybe some 50 times or so). It looks pretty strange and I don't see why this happens.

Can anyone please turn on the light for me?

P.S.:
It seems the mails get checked by spamassassin over and over again until finally they're to big (>256k) to be handled.

Last edited by AlArenal; 6th November 2007 at 16:50.
Reply With Quote
Sponsored Links
  #2  
Old 6th November 2007, 17:16
AlArenal AlArenal is offline
Senior Member
 
Join Date: Feb 2007
Location: Germany
Posts: 104
Thanks: 1
Thanked 5 Times in 5 Posts
Default

I should have thought about a minute later

It's now clear that with the standard procmail recipe every mail gets scanned by spamassassin first before further evaluation is done. So there's my loop. I'm just curious whether or not it's sufficient to change this...

Code:
* < 256000
| /home/admispconfig/ispconfig/tools/spamassassin/usr/bin/spamassassin --prefs-file=/var/www/myweb/user/myuser_spam/.user_prefs
into that:

Code:
* < 256000
* !^X-Spam-Status: Yes
| /home/admispconfig/ispconfig/tools/spamassassin/usr/bin/spamassassin --prefs-file=/var/www/myweb/user/myuser_spam/.user_prefs
Reply With Quote
  #3  
Old 15th January 2009, 12:09
matiasCU matiasCU is offline
Member
 
Join Date: Apr 2007
Posts: 57
Thanks: 5
Thanked 2 Times in 2 Posts
Default Domain variable

Hi AlArenal:
Could you tell me how to include the domain name in the file spamassassin.rc.master?
Its posible to use some variable in the spamassassin.rc.master to return the value of the domain to which the user? Eg spam@VARIABLE
I was trying with {DOMAIN}, but apparently not under the environment of users.

Thanks in advance.
Reply With Quote
  #4  
Old 15th January 2009, 12:21
AlArenal AlArenal is offline
Senior Member
 
Join Date: Feb 2007
Location: Germany
Posts: 104
Thanks: 1
Thanked 5 Times in 5 Posts
Default

Hi matiasCU,

I just hardcoded some passages in customized_templates/spamassassin.rc.master because I didn't want to redirect spam for each and every domains' mail account.

To redirect spam for every account of a domain:

Code:
#:0:
* ^TO_.*@domain.tld
* !^X-Loop: spam@webseiter.de
* ^X-Spam-Status: Yes
| formail -A "X-Loop: spam@webseiter.de" | \
  /usr/sbin/sendmail -oi spam@webseiter.de
Because you can use regular expressions you have at least some flexibility defining addresses and domains, ...
Reply With Quote
  #5  
Old 16th January 2009, 22:54
matiasCU matiasCU is offline
Member
 
Join Date: Apr 2007
Posts: 57
Thanks: 5
Thanked 2 Times in 2 Posts
Default Solution

First of all thanks to Al.
My Requirement:
I needed to redirect spam to an account spam@domain.tld, but also needed to make one copy of the user spam folder, so I did the following:

In /root/ispconfig/isp/conf/spamassassin.rc.master:
Change this lines:
:0fw
* < 256000
| {SPAMASSASSIN_PATH} --prefs-file={PREFS_FILE}

To this:
:0fw
* < 256000
* !^X-Spam-Status: Yes
| {SPAMASSASSIN_PATH} --prefs-file={PREFS_FILE}

And add this lines:
# For copy spam message in user Spam folder
:0 c
* ^X-Spam-Status: Yes
$MAILDIR/.Spam/

# And to forward spam message to spam@domain.tld
:0:
* !^X-Loop: spam@domain.tld
* ^X-Spam-Status: Yes
| formail -A "X-Loop: spam@domain.tld" | \

...and that's all old!
Reply With Quote
The Following User Says Thank You to matiasCU For This Useful Post:
falko (17th January 2009)
  #6  
Old 17th October 2009, 17:54
mehulved mehulved is offline
Junior Member
 
Join Date: May 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default

Thank you MatiasCU and AlArenal. I was looking for the solution too. Works nicely
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
In ISPconfig whitelist but still seen as spam edge Installation/Configuration 12 5th September 2007 01:30
Sending SPAM via Procmail to special Recipient JohnSmith Installation/Configuration 3 12th April 2007 17:43
Howto let procmail move spam to folder? oversight HOWTO-Related Questions 9 1st May 2006 16:39
plenty of procmail/trashscan processes ZyanKLee Installation/Configuration 10 27th December 2005 21:09
procmail <defunct> ZyanKLee Installation/Configuration 1 19th December 2005 01:58


All times are GMT +2. The time now is 09:50.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.