procmail
[Top] [All Lists]

Re: Beginner - please help

2007-04-13 11:49:43
At 12:22 2007-04-13 -0500, Skip Brott wrote:

I'd like to be able to dump invalid hosts outright

This is something you should do at the MTA.

and fix my issue with vacation.

I saw nothing to do with vacation in what you posted.  FTR, procmail itself 
has been used as a vacation mechanism.

My rules need to be for my corporate server, not per user account - so I 
am making my changes to /etc/procmailrc

My current configuration looks like this - and it probably looks terrible 
so no making fun of me&I am a newbie after all!:


DROPPRIVS=yes

Don't do this until after you've filed junk mail to your corporate account.

:0fw
* < 256000
* !^X-Spam-Flag: YES
* !^X-Loop: spam
| /usr/bin/spamc -f -u mail

:0
* ^X-Spam-Level: \*\*\*\*\*\*\*\*\*\*
/dev/null

:0c
* !^FROM_DAEMON
* ^X-Spam-Flag: YES
* !^X-Loop: spam
| echo "`formail -x X-Spam-Status: | awk -F 'score=' '{print $2}' | cut 
--delimiter=' ' -f1`" >> /var/log/spam

I'm not familiar with the headers you've got, but surely there's a more 
efficient way to get this data?  Further, this recipe should have locking 
on it to prevent simultanious writes to /var/log/spam (which, per the above 
dropprivs, would have to be world writeable, yet another reason to move 
dropprivs to after your spam filtering).


:0c:
* !^FROM_DAEMON
* ^X-Spam-Flag: YES
* !^X-Loop: spam
* ^X-SPam-Status:.*Score=\/[0-9.]*
|echo $MATCH >> /var/log/spam

I THINK this accomplishes what you're trying to do, but involves much less 
processing.  I didn't put much thought to it, or analyse your other 
conditions though.  Is there a reason you need the separate spam log 
instead of say, referring to the procmail log?

:0
* !^FROM_DAEMON
* ^X-Spam-Flag: YES
* !^X-Loop: spam
| formail -A "X-Loop: spam" | /usr/sbin/sendmail -oi 
spamaccount(_at_)mydomain(_dot_)com

if you did this before dropping privledges, and assuming the spam account 
is also local to this host, you could just file it away, no need to send it 
back into the mail system.  FYI - quite a bit of spam and malware claims to 
be from the mailer daemon.

So, for example:

:0:
* ^X-Spam-Flag: YES
/var/spool/mail/spamaccount

Then, because you're not redelivering the spam to yourself, you can 
eliminated the checks for X-Loop: spam in the other recipes.

THEN have:

DROPPRIVS=YES

Presuming nothing above there is capable of being influenced by 
non-privledged users.

---
  Sean B. Straw / Professional Software Engineering

  Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
  Please DO NOT carbon me on list replies.  I'll get my copy from the list.


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail