From: Mauro Faccenda on
Hi again,

I'm using a setup integrated with Active Directory with Maildir and I
need to do some filtering in messages (basically manipulating some
headers).

Using procmail as a transport like:
---
procmail unix - n n - - pipe
flags=Ru user=vmail argv=/usr/bin/procmail -t -m USER=${user}
DOMAIN=${domain} EXTENSION=${extension} /etc/procmailrc
---

This setup doesn't work well for me because it doesn't update the
maildirsize (I'm using the VDA patches in Postfix) file in the user's
Maildir and it doesn't automatically create the Maildir when needed.
Without using procmail as a transport it does it very well.

I am wondering if I can use procmail (or some other filtering
software) in another way so it does it's filtering and then send the
message back to Postfix, like my DSPAM setup, that uses the LMTP
socket, filters the message and send it to the LMTP in the
localhost:10026 port.

---
smtp inet n - - - - smtpd
-o content_filter=lmtp:unix:/var/run/dspam.sock

127.0.0.1:10026 inet n - - - - smtpd
-o content_filter=
-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
-o smtpd_helo_restrictions=
-o smtpd_client_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks=127.0.0.0/8
-o smtpd_authorized_xforward_hosts=127.0.0.0/8
---

Also, this setup works for both outgoing and incoming messages and I'd
like to do it only for incoming messages.

From: mouss on
Mauro Faccenda a écrit :
> Hi again,
>
> I'm using a setup integrated with Active Directory with Maildir and I
> need to do some filtering in messages (basically manipulating some
> headers).
>
> Using procmail as a transport like:
> ---
> procmail unix - n n - - pipe
> flags=Ru user=vmail argv=/usr/bin/procmail -t -m USER=${user}
> DOMAIN=${domain} EXTENSION=${extension} /etc/procmailrc
> ---
>
> This setup doesn't work well for me because it doesn't update the
> maildirsize (I'm using the VDA patches in Postfix) file in the user's
> Maildir and it doesn't automatically create the Maildir when needed.
> Without using procmail as a transport it does it very well.
>
> I am wondering if I can use procmail (or some other filtering
> software) in another way so it does it's filtering and then send the
> message back to Postfix, like my DSPAM setup, that uses the LMTP
> socket, filters the message and send it to the LMTP in the
> localhost:10026 port.

you mean SMTP, not LMTP...

with procmail or maildrop, your best bet is to resubmit mail via the
sendmail command (postfix sendmail, not Sendmail sendmail). for this,
you must make sure that you don't have a content_filter for pickup:

pickup fifo n - n 60 1 pickup
-o content_filter=
...

(the reason is to avoid an infinite loop: you filter mail, you pass it
to sendmail, it passes it to the filter...).

All that said, the VDA patch isn't supported here. so you're on your own.

An latenrative based on a policy service has been proposed on the list
(I'm really sorry, but I forgot who posted this. If the developer sees
this message, he'll reply. otherwise, google...). In any case, this is a
better approach than a patch.

> [snip]

From: Mauro Faccenda on
Hi Mouss,

Thanks for you answer.

Bellow some observations/questions.

On Fri, Mar 19, 2010 at 6:08 PM, mouss <mouss(a)ml.netoyen.net> wrote:
[...]
>> This setup doesn't work well for me because it doesn't update the
>> maildirsize (I'm using the VDA patches in Postfix) file in the user's
>> Maildir and it doesn't automatically create the Maildir when needed.
>> Without using procmail as a transport it does it very well.
>>
>> I am wondering if I can use procmail (or some other filtering
>> software) in another way so it does it's filtering and then send the
>> message back to Postfix, like my DSPAM setup, that uses the LMTP
>> socket, filters the message and send it to the LMTP in the
>> localhost:10026 port.
>
> you mean SMTP, not LMTP...

Well, SMTP or LMTP, it's a instance to only receive local mails. But,
I don't think it makes any difference here, right? ;)

>
> with procmail or maildrop, your best bet is to resubmit mail via the
> sendmail command (postfix sendmail, not Sendmail sendmail). for this,
> you must make sure that you don't have a content_filter for pickup:
>
> pickup    fifo  n       -       n       60      1       pickup
>  -o content_filter=
>  ...
>
> (the reason is to avoid an infinite loop: you filter mail, you pass it
> to sendmail, it passes it to the filter...).

Sure. That's why I had to use another SMTP to pick the DSPAM result.

But I don't know yet how to do it with procmail (or similar), and
that's what I'm asking.

>
> All that said, the VDA patch isn't supported here. so you're on your own.

I know that, but I think it's unrelated to the real question. Let's
just suppose I want to do it without those patches.

>
> An latenrative based on a policy service has been proposed on the list
> (I'm really sorry, but I forgot who posted this. If the developer sees
> this message, he'll reply. otherwise, google...). In any case, this is a
> better approach than a patch.

Alternative to that patch? I did some searches and as far as I could
see, none of the alternatives (that I've found) could reject the
message in SMTP. I think it's nice to not generate bouncing
messages/backscatter. But if someone have an alternative besides that,
it's always welcome.

Once more, thanks for your suggestions. ;)

Mauro

From: Reinaldo de Carvalho on
On Fri, Mar 19, 2010 at 6:40 PM, Mauro Faccenda <faccenda(a)gmail.com> wrote:
>
> Alternative to that patch? I did some searches and as far as I could
> see, none of the alternatives (that I've found) could reject the
> message in SMTP. I think it's nice to not generate bouncing
> messages/backscatter. But if someone have an alternative besides that,
> it's always welcome.
>
>

1. http://postfixquotareject.ramattack.net/

2. Write a policyd to check the quota and reject the message.

--
Reinaldo de Carvalho
http://korreio.sf.net
http://python-cyrus.sf.net

"Don't try to adapt the software to the way you work, but rather
yourself to the way the software works" (myself)

From: mouss on
Mauro Faccenda a écrit :
>[snip]
>> you mean SMTP, not LMTP...
>
> Well, SMTP or LMTP, it's a instance to only receive local mails. But,
> I don't think it makes any difference here, right? ;)
>

postfix doesn't have an "LMTP server" (an lmtpd).

>[snip]
>
> But I don't know yet how to do it with procmail (or similar), and
> that's what I'm asking.
>

for procmail, see:

- "Step 2" in
http://www.technoids.org/procmailfilter.html

- The procmailex(5) manual page



>[snip]
> Alternative to that patch? I did some searches and as far as I could
> see, none of the alternatives (that I've found) could reject the
> message in SMTP. I think it's nice to not generate bouncing
> messages/backscatter. But if someone have an alternative besides that,
> it's always welcome.
>

I see Reinaldo has answered this.



> Once more, thanks for your suggestions. ;)
>
> Mauro