procmail
[Top] [All Lists]

/etc/procmailrc delivery to other account (was Re: procmail Digest, Vol 55, Issue 13)

2007-08-15 07:59:04
On 8/15/07, Skip Brott <sbrott(_at_)dmp(_dot_)com> wrote:

Yes, this is a global procmailrc file.  My apologies for not being specific.

The mailbox does exist and has the proper ownership.  I suspect the issue is
that I need to forward the message rather than dump it directly into the
mailbox.  (The account set up to pull spam successfully checks its email but
always returns no messages).

Whether delivery to /var/spool/mail/spamaccount is possible from
/etc/procmailrc probably depends on your MTA.  With sendmail, procmail
is invoked first as the superuser, executes the /etc/procmailrc file
as the superuser, and then drops privileges and takes on the identity
of the "ordinary" user to whom the mail is addressed.  In that
scenario, you *should* be able to deliver directly to the file, so I'd
suggest turning on verbose logging to find out what's really happening
at the point of that recipe.

With other MTAs procmail may never have superuser privilege and you'd
have to resort to some other method to deliver to that file.

So rather than use:

/var/spool/mail/spamaccount

Should it be?:

| formail -A "X-Spam-Status: Yes" | spamaccount

Not unless "spamaccount" is the name of an executable program.

I am unclear about how to forward the message without having it rescan the
message.

You have two options.

(1) Write a small program in Perl or C or whatever, which is installed
setuid root but immediately does a setuid system call to change user
ID to the spamaccount user and then opens /var/spool/mail/spamaccount
for appending and copies its standard input there.  This program could
be used in a pipeline like the one with formail above.

(2) Modify /etc/procmailrc to look for a flag header in the message
and skip the spam processing if that flag is already present.
Something like this:

--------
:0
* $ ^X-Spam-Checked-Locally: $HOST
{
 DROPPRIVS
 SWITCHRC
}

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

:0
* ^X-Spam-Status: Yes
{
 :0fwh
 | formail -A"X-Spam-Checked-Locally: $HOST"

 :0
 ! spamaccount
}
--------

Note, though, that no matter which approach works, if the same email
is addressed to several users, /etc/procmailrc will be invoked once
for every addressee, so you'll end up with multiple copies of the
message in the spamaccount mailbox.
____________________________________________________________
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>
  • /etc/procmailrc delivery to other account (was Re: procmail Digest, Vol 55, Issue 13), Bart Schaefer <=