[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Procmail | Maildrop ownership


I am trying to set up a custom behaviour for a spam blocking mail server,
where the mail get redirected to a custom Spam folder in the user's
Maildir folder.

Everything is working fine, except that, when procmail delivers the
message, the ownership is wrongly set to "root":

# cat /etc/procmailrc

:0fw: spamassassin.lock
* < 256000
| spamc -f -u $LOGNAME

* ^X-Spam-Status: Yes


 # ls -la ~user/Maildir/.Spam/new/

drwx------    2 user  user      4096 Mar 12 09:56 .
drwx------    5 user  user     4096 Mar 12 09:56 ..
-rw-------    1 root     mail         4460 Mar 12 09:37
-rw-------    1 root     mail         8619 Mar 12 09:56

I suppose this ownership setting is ok for a mbox store, not for a Maildir
format, since the user isnt able to read or modify that message.

So, how can I make procmail deliver that message correctly?  I could make
a script to do that, instead of using the redirection to .Spam/, but is
there a nicer way to do that?

I also had problems making an alternative maildrop sollution. The issue is
that maildrop's xfilter command wont work if the recipient user doesnt
have a valid shell:

# cat /etc/maildroprc
# exception commented so I could see the error log
#exception {
xfilter "/usr/bin/spamc -f -u $RECIPIENT"
if (/^X-Spam-Flag: YES/)
        to "Maildir/.Spam"


It would work fine, except that when the recipient user does not have a
valid shell account, it exists with the following error (when I am not
using the 'exception' block):

BAF555886: to=<user@goiano.com.br>, relay=local, delay=0, status=deferred
(temporary failure. Command output: maildrop: error writing to filter.
/usr/bin/maildrop: Unable to filter message. )

I suppose xfilter calls the user's shell. Is there any other way to filter
messages without this requirement?

Is using an 'smtp' content filter in the MTA (postfix) a better option?
The sollutions I've seen use 'spamassassin' instead of 'spamc', that is
the method I prefer...

Thanks in advance,



Reply to: