procmail
[Top] [All Lists]

Re: Using a Spam Account

2007-08-14 10:45:41
At 10:41 2007-08-14 -0500, Skip Brott wrote:
My procmail rules are pretty basic at this point:

This is an /etc/procmailrc file, or a user procmailrc in ~/.procmailrc 
?  I'm guessing the global procmailrc, but you really need to indicate as 
much, because the assumptions can often be the source of the problems 
people experience.

--------------START--------------

:0fwhb
| /usr/bin/spamc -u mail

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


:0H
* ^X-Spam-Status: Yes
/var/spool/mail/spam

This would be a mailbox intended to be owned by whom?  Your POP agent is 
going to open a mailbox based on the username provided when logging into 
the POP3 service.  Note that you don't need the H flag (it's default, and 
there are some buggy versions on procmail that trip up with it when not 
needed), and you should have a locking flag on the recipe, so that 
concurrent message processing doesn't jumble the output file.

IF this is in an /etc/procmailrc file, try ensuring that the spam mailbox 
EXISTS and is OWNED by the "spam" user and appropriate group before writing 
to it.  From the global procmailrc, while permissions are still elevated, 
this is possible.  Otherwise, perhaps what you should be doing is simply 
FORWARDING the message to the local spam user (which would take care of all 
this - but you'd want to file mail for the spam user, not rescan and forward!).


:0H
* ^X-Spam-Status: Yes
{
         # if mailbox file doesn't exist, create it and set ownership.
         # substitute appropriate username and group as appropriate.
         DUMMY=`test -e /var/spool/mail/spam || touch /var/spool/mail/spam 
; chown spam:mail /var/spool/mail/spam`

         :0:
         /var/spool/mail/spam
}


Of course, this may be fine when delivering for yourself as the sole user, 
but there's no consideration for where EACH user's misfiled spam gets 
stored - you're putting it all in one mailbox.  You should rethink the 
strategy.  Perhaps a webmail interface that can selectively forward 
individual messages to the user and list the From: or some other header in 
a whitelist file?  Why download all the spam to your mail client just to 
shuffle through it?


FTR, you should preface your /etc/procmailrc with something like:

# in global procmailrc, define a shell WE USE HERE, esp so that users without
# shells don't have problems
ORGSHELL=$SHELL
SHELL=/usr/bin/sh


And at the bottom , add:

# Put things back for ~/.procmailrc
SHELL=$ORGSHELL
ORGSHELL


I could be missing a few settings, but my issue at the moment is how I am
dumping email into my spam account.  Using this method, I am unable to
connect a client (like Outlook, for example) to pull mail.

ANY mail, or just the stuff which has been filed to the spam mailbox?

What is the ownership of the spam mailbox?  I'm guessing it isn't user 
spam.  Look at all the mailboxes and between owner and filename, ask 
yourself, "what is the POP3 username likely to be for this mailbox".  Then 
look at your spam mailbox and note the likely differential between the 
owner and the filename, and the probable non-existance of that user to boot.

---
  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

<Prev in Thread] Current Thread [Next in Thread>