[Dovecot] spamc can't seem to call /usr/lib/dovecot/deliver

Bill Shirley Bill at KnoxvilleChristian.org
Wed Oct 24 20:13:42 EEST 2012


On 10/24/2012 12:10 PM, Troy Vitullo wrote:
> On Tue, 23 Oct 2012 21:32:59 -0400
> Bill Shirley <Bill at KnoxvilleChristian.org> wrote:
>
>> On 10/23/2012 9:06 PM, Bill Shirley wrote:
>>>
>>> What is your mailbox_command in main.cf?  I just use:
>>> mailbox_command = /usr/bin/spamc -u "$USER" -e
>>> /usr/lib64/dovecot/deliver -a "$RECIPIENT" -f "$SENDER" -m
>>> "$EXTENSION"
>>>
>>> I don't need anything in master.cf.  But you should be using -u
>>> ${user} for spamc.
>>>
>>> Bill
>>>
>> Forgot to ask, are you using Spamassassin's per-user configs?  If
>> you're not, that probably is your problem.  It's probably trying to
>> update bayes tokens and it doesn't have permission.
>>
>> I use per-user configs which are nice.  One man's spam is another
>> man's ham.  Plus each user can have his/her own whitelist.
>>
>> I use these spamd args: -d -c -m10 --user-config
>> You usually can find the args in /etc/sysconfig.
>>
>> Bill
> Thanks for getting back to me Bill. Actually I'm using per-user prefs and permissions look great all the way down. When I send a test mail with everything turned on the bayes tokens are updated. Things appear to die later in the process.
>
> Regarding the mailbox command I was using:
> mailbox_command = /usr/lib/dovecot/deliver -d "$USER" -m "$EXTENSION"
>
> I tried removing the flags from master.cf and changing my command to:
> mailbox_command = /usr/bin/spamc -u "$USER" -e /usr/lib/dovecot/deliver -d "$USER" -m "$EXTENSION"

What was your setting for mailbox_transport (in main.cf) when you did 
this? mailbox_transport could be overriding mailbox_command.

>
> and then:
> mailbox_command = /usr/bin/spamc -u ${recipient} -e /usr/lib/dovecot/deliver -d ${recipient} -m "$EXTENSION"
>
> and everything in between.
>
> No mail made it through, so I kept this in master.cf:
>
> dovecot   unix  -       n       n       -       -       pipe
>    flags=DRhu user=dovecot:dovecot argv=/usr/lib/dovecot/deliver -d ${recipient}

Where are you calling spamc with this?

>
> and of course it over-rode my mailbox_command. Mail came thrrough but it contained no spamassassin header.
>
> I'm starting to thing that spamc doesn't have the permissions to write its headers to the message. How can I test that theory?
>
> spamd runs witht these flags:
> /usr/sbin/spamd --create-prefs -x --max-children 3 --username spamd --helper-home-dir /var/lib/spamassassin -s /var/lib/spamassassin/spamd.log --virtual-config-dir=/var/lib/spamassassin/users/%d/%l -d --pidfile=/var/run/spamd.pid
>
> It's pretty much the same as yours, I just use the long versions of the args.
>
> the spamd user exists:
> spamd:x:1010:1011::/var/lib/spamassassin:/bin/false

Your permissions on /var/lib/spamassassin are probably right, but check 
them and the subdirectories.

>
> I was missing /etc/dovecot/default.sieve, which had to be a big problem, but I recovered it. Here's are its contents:
>
> require "fileinto";
>    if exists "X-Spam-Flag" {
>            if header :contains "X-Spam-Flag" "NO" {
>            } else {
>            discard;
>            stop;
>            }
>    }
>
> Anything else I could be missing? I even insanely running spamd as the root user:
>
> /usr/sbin/spamd --create-prefs -x --max-children 3 --username root --helper-home-dir /var/lib/spamassassin -s /var/lib/spamassassin/spamd.log --virtual-config-dir=/var/lib/spamassassin/users/%d/%l -d --pidfile=/var/run/spamd.pid
>
> Thanks,
>
> Troy
I have two instances of spamd running.  One for local users and the 
other for virtual users (note the port here and in master.cf):

[root at elmo includes]# ps aux | grep spamd
root      2684  0.1  1.0 173760 88484 ?        SN   03:30   0:34 spamd child
root     23987  0.0  0.7 147524 61900 ?        SNs  Oct23   0:05 
/usr/bin/spamd -d -c -m10 --user-config
root     24004  0.0  0.7 147504 61844 ?        SNs  Oct23   0:05 
/usr/bin/spamd -d -c -m5 -x 
--virtual-config-dir=/home/vmail/domains/%d/%l/.spamassassin -u vmail 
--port=784 -H
vmail    24014  0.0  0.9 161204 75880 ?        SN   Oct23   0:05 spamd child
vmail    24015  0.0  0.7 147504 59700 ?        SN   Oct23   0:00 spamd child
root     25772  0.0  0.8 155020 69188 ?        SN   12:07   0:00 spamd child
root     28981  0.0  0.0  16688   940 pts/4    S+   12:36   0:00 grep 
--color spamd

My vmail user:
[root at elmo includes]# grep vmail /etc/{group,passwd}
/etc/group:vmail:x:399:
/etc/passwd:vmail:x:399:399:Virtual Mail:/home/vmail:/bin/bash

My virtual user .spamassassin permissions:
[root at elmo includes]# ldp /home/vmail/domains/example.com/bill/.spamassassin
drwxr-xr-x 20 root  root   4096 May  8  2011 /home
drwxr-xr-x 10 vmail vmail  4096 Oct 22 10:59 /home/vmail
drwxr-x---  9 vmail vmail 4096 Oct 21 21:24 /home/vmail/domains
drwxr-x---  6 vmail vmail 4096 Jul  4  2007 /home/vmail/domains/example.com
drwxr-x---  4 vmail vmail  4096 Jul  4  2007 
/home/vmail/domains/example.com/bill
drwxr-s---  3 vmail vmail  4096 Jan 30  2012 
/home/vmail/domains/example.com/bill/.spamassassin

My local user:
[root at elmo includes]# ldp /home/bill/.spamassassin
drwxr-xr-x 20 root root 4096 May  8  2011 /home
drwxr-xr-x 32 bill bill 4096 Oct 22 17:42 /home/bill
drwxr-s---  2 bill bill 4096 Oct 24 12:42 /home/bill/.spamassassin

My main.cf:
mailbox_transport =
mailbox_command = /usr/bin/spamc -u "$USER" -e 
/usr/lib64/dovecot/deliver -a "$RECIPIENT" -f "$SENDER" -m "$EXTENSION"
virtual_transport = vdovecot
vdovecot_destination_recipient_limit    = 1

My master.cf:
vdovecot        unix    -       n       n       -       5       pipe
         flags=DRuh user=vmail:vmail argv=/usr/bin/spamc -p 784 -u 
${recipient} -e /usr/lib64/dovecot/deliver -d ${user}@${domain} -a 
{recipient} -f ${sender} -n -m ${extension}

You could try my config substituting your user and directory for mine:
     I'm using user=vmail:vmail and 
--virtual-config-dir=/home/vmail/domains/%d/%l/.spamassassin
     You're using  user=dovecot:secmail and 
--virtual-config-dir=/var/lib/spamassassin/users/%d/%l

Currently, your user=dovecot:secmail should probably be user=spamd:spamd 
in master.cf unless group secmail has write permissions on 
/var/lib/spamassassin and subdirectories.

Hope this helps,
Bill








More information about the dovecot mailing list