'mailbox_command' (main.cf) not executed

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

'mailbox_command' (main.cf) not executed

Bruno Costacurta
Hello,

I setup Postfix with spamassassin and procmail.
spamassassin is configured in master.cf, and procmail in main.cf

spamassassin is executed but not procmail.

* in master.cf
...
smtp      inet  n       -       -       -       -       smtpd
   -o content_filter=spamfilter:dummy
spamfilter unix - n n - - pipe
    flags=Rq user=spamfilter argv=/usr/local/bin/spamfilter.sh -f  
${sender} -- ${recipient}
...

* in main.cf:
...
mailbox_command = /usr/bin/procmail -f- -a "$USER"
...
(note : /usr/bin/procmail is fine and seems ok)

* in mail.info log file :
...
setuid to spamfilter succeeded
spamd: processing message ... for spamfilter:5001
spamd: clean message (-0.5/2.0) for spamfilter:5001 in 2.2 seconds,  
1875 bytes.
...
spamd[32416]: prefork: child states: II
...
postfix/cleanup[27681]: ... status=sent (delivered via spamfilter service)
postfix/qmgr[18310]: ... removed
...

So spamassassin is correctly setup.
But after spamd I expected some trace of some mailbox_command  
execution, but (apparently) nothing, and so procmail is not executed.

Why procmail is not executed ? Is there some priority or dependencies  
for mailbox_command execution ?
Thanks for any help.

Bye,
Bruno

--
Linux Counter #353844
http://counter.li.org/


----------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: 'mailbox_command' (main.cf) not executed

Jeroen Geilman
On 11/07/2010 08:17 PM, Bruno Costacurta wrote:
>
> Why procmail is not executed ? Is there some priority or dependencies
> for mailbox_command execution ?

Yes: the mail has to be delivered to a mailbox.
You are delivering mail to spamassassin.

> Thanks for any help.
>
> Bye,
> Bruno
>


--
J.

Reply | Threaded
Open this post in threaded view
|

Re: 'mailbox_command' (main.cf) not executed

mouss-4
In reply to this post by Bruno Costacurta
Le 07/11/2010 20:17, Bruno Costacurta a écrit :

> Hello,
>
> I setup Postfix with spamassassin and procmail.
> spamassassin is configured in master.cf, and procmail in main.cf
>
> spamassassin is executed but not procmail.
>
> * in master.cf
> ...
> smtp inet n - - - - smtpd
> -o content_filter=spamfilter:dummy
> spamfilter unix - n n - - pipe
> flags=Rq user=spamfilter argv=/usr/local/bin/spamfilter.sh -f ${sender}
> -- ${recipient}
> ...
>
> * in main.cf:
> ...
> mailbox_command = /usr/bin/procmail -f- -a "$USER"
> ...
> (note : /usr/bin/procmail is fine and seems ok)
>
> * in mail.info log file :
> ...
> setuid to spamfilter succeeded
> spamd: processing message ... for spamfilter:5001
> spamd: clean message (-0.5/2.0) for spamfilter:5001 in 2.2 seconds, 1875
> bytes.
> ...
> spamd[32416]: prefork: child states: II
> ...
> postfix/cleanup[27681]: ... status=sent (delivered via spamfilter service)
> postfix/qmgr[18310]: ... removed
> ...
>
> So spamassassin is correctly setup.
> But after spamd I expected some trace of some mailbox_command execution,
> but (apparently) nothing, and so procmail is not executed.
>
> Why procmail is not executed ? Is there some priority or dependencies
> for mailbox_command execution ?

mailbox_command works for "local" domains: domains listed under
mydestination.

for more help,
- show output of 'postconf -n'
- relevant logs
if you rename domains, do so coherently (replace with the same name in
logs and 'postconf -n', and do not replace two diffrent domains with a
single one...)
Reply | Threaded
Open this post in threaded view
|

Re: 'mailbox_command' (main.cf) not executed

Bruno Costacurta
In reply to this post by Bruno Costacurta
>>
>> Why procmail is not executed ? Is there some priority or dependencies
>> for mailbox_command execution ?
>
> Yes: the mail has to be delivered to a mailbox.
> You are delivering mail to spamassassin.

You confused me : spamassassin leaves the messages for local delivery  
via /usr/local/sbin/sendmail -i "$@"

And indeed everything works fine except the missing filtering via Procmail.
(note : I'm using virtual users).

More generally, is mailbox_command mandatory ?
Can I replace it using in master.cf a syntax like following :

smtp   inet  n - n  -  -  smtpd -o content_filter=procmail:filter

where procmail service will call, via shell script, spamassassing  
before doing its filtering, and do I can avoid the need of  
mailbox_command.
Correct ?

Bye,
Bruno

--
Linux Counter #353844
http://counter.li.org/





----------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: 'mailbox_command' (main.cf) not executed

Jeroen Geilman
On 11/08/2010 06:43 PM, Bruno Costacurta wrote:
>>>
>>> Why procmail is not executed ? Is there some priority or dependencies
>>> for mailbox_command execution ?
>>
>> Yes: the mail has to be delivered to a mailbox.
>> You are delivering mail to spamassassin.
>
> You confused me : spamassassin leaves the messages for local delivery
> via /usr/local/sbin/sendmail -i "$@"

Yes, I did.
However, you did not provide your entire flow setup, so it was not
completely transparent to me that you were using spamassassin as a
content_filter.
You did show logs that show spamassassin is processing the mail, but I
never saw the config for re-injection, so there was no reason to suppose
that procmail was ever getting hit.

> And indeed everything works fine except the missing filtering via
> Procmail.
> (note : I'm using virtual users).

I know, that's why it doesn't work.
Virtual mailboxes can not run commands, as I already indicated.

>
> More generally, is mailbox_command mandatory ?

No, it's not mandatory.
It is empty by default.

> Can I replace it using in master.cf a syntax like following :
>
> smtp   inet  n - n  -  -  smtpd -o content_filter=procmail:filter
>
> where procmail service will call, via shell script, spamassassing
> before doing its filtering, and do I can avoid the need of
> mailbox_command.

No, procmail is not a "service".
You have to create one and then deliver to it:

myprocmail unix  - n n - - - pipe user=your.virtual.user argv=procmail
-a $RECIPIENT -a $EXTENSION [-a $MORE_VARS...]

And then either set the virtual_transport to myprocmail or use
transport_maps for more granular control.

NOTE that procmail MUST deliver the message in this case!
If the message "falls out the bottom" of your recipe, it's GORN.

--
J.