How to run 2 content filters in parrallel?

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

How to run 2 content filters in parrallel?

helices-2
CentOS Linux release 7.5.1804 (Core)
mail_version = 2.10.1

Several years funning one content filter:
127.0.0.1:10025  inet  n  -     n       -       -       smtpd
  -o content_filter=filter:dummy
 ...

Now, we need an autoresponder for one incoming address. Trying to use this:
https://www.howtoforge.com/how-to-set-up-a-postfix-autoresponder-with-autoresponse

Tried adding second line to above:
127.0.0.1:10025  inet  n  -     n       -       -       smtpd
  -o content_filter=filter:dummy
  -o content_filter=autoresponder:dummy
 ...

Which always results in this:
 ... status=bounced (User unknown in virtual alias table)


We need _both_ content filters to run on original, unfiltered messages. There is no dependency one filter to the other.

What am I missing?

Please, advise. thank you.

~ Mike



Reply | Threaded
Open this post in threaded view
|

Re: How to run 2 content filters in parrallel?

Wietse Venema
Mike Schleif:

> CentOS Linux release 7.5.1804 (Core)
> mail_version = 2.10.1
>
> Several years funning one content filter:
> 127.0.0.1:10025  inet  n  -     n       -       -       smtpd
>   -o content_filter=filter:dummy
>  ...
>
> Now, we need an autoresponder for one incoming address. Trying to use this:
> https://www.howtoforge.com/how-to-set-up-a-postfix-autoresponder-with-autoresponse
>
> Tried adding second line to above:
> 127.0.0.1:10025  inet  n  -     n       -       -       smtpd
>   -o content_filter=filter:dummy
>   -o content_filter=autoresponder:dummy

This will set content_filter to the last specified value. Postfix
parameters are scalars, not lists (list are specified with tables,
and there is no list-based variant of the content_filter variabe).

What do you mean with parallel? There is only one mail flow, so
it can flow through only one filter at a time.

Therefore, the answer depends on what you want: apply one of the
two filters or both filters (in series).

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: How to run 2 content filters in parrallel?

helices-2
content_filter=filter:dummy
This filter has been running for years, massaging all messages as we require, and must continue to run on all messages. Microsoft Exchange users require this, and must receive all messages.

content_filter=autoresponder
One virtual email address must generate an autoresponder message on off hours - in addition to delivering to Exchange users.

~ Mike


On Mon, Oct 15, 2018 at 1:47 PM Wietse Venema <[hidden email]> wrote:
Mike Schleif:
> CentOS Linux release 7.5.1804 (Core)
> mail_version = 2.10.1
>
> Several years funning one content filter:
> 127.0.0.1:10025  inet  n  -     n       -       -       smtpd
>   -o content_filter=filter:dummy
>  ...
>
> Now, we need an autoresponder for one incoming address. Trying to use this:
> https://www.howtoforge.com/how-to-set-up-a-postfix-autoresponder-with-autoresponse
>
> Tried adding second line to above:
> 127.0.0.1:10025  inet  n  -     n       -       -       smtpd
>   -o content_filter=filter:dummy
>   -o content_filter=autoresponder:dummy

This will set content_filter to the last specified value. Postfix
parameters are scalars, not lists (list are specified with tables,
and there is no list-based variant of the content_filter variabe).

What do you mean with parallel? There is only one mail flow, so
it can flow through only one filter at a time.

Therefore, the answer depends on what you want: apply one of the
two filters or both filters (in series).

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: How to run 2 content filters in parrallel?

Wietse Venema
Mike Schleif:
> content_filter=filter:dummy
> This filter has been running for years, massaging all messages as we
> require, and must continue to run on all messages. Microsoft Exchange users
> require this, and must receive all messages.

All addresses INCLUDING the special address?

> content_filter=autoresponder
> One virtual email address must generate an autoresponder message on off
> hours - in addition to delivering to Exchange users.

The special address is subject to ONLY this filter or BOTH filters?

` Wietse
Reply | Threaded
Open this post in threaded view
|

Re: How to run 2 content filters in parrallel?

helices-2
All addresses INCLUDING the special address?  - yes

The special address is subject to ONLY this filter or BOTH filters? - BOTH filters

Perhaps, there is another solution? All I'm trying to add is an out-of-office message to one incoming address. However, this OOO message must run 5pm-8am weekdays, and all day weekends. Apparently, Exchange cannot do this ...

~ Mike


On Mon, Oct 15, 2018 at 2:46 PM Wietse Venema <[hidden email]> wrote:
Mike Schleif:
> content_filter=filter:dummy
> This filter has been running for years, massaging all messages as we
> require, and must continue to run on all messages. Microsoft Exchange users
> require this, and must receive all messages.

All addresses INCLUDING the special address?

> content_filter=autoresponder
> One virtual email address must generate an autoresponder message on off
> hours - in addition to delivering to Exchange users.

The special address is subject to ONLY this filter or BOTH filters?

`       Wietse

Reply | Threaded
Open this post in threaded view
|

Re: How to run 2 content filters in parrallel?

Wietse Venema
Mike Schleif:
>  All addresses INCLUDING the special address?  - yes
>
> The special address is subject to ONLY this filter or BOTH filters? - BOTH
> filters
>
> Perhaps, there is another solution? All I'm trying to add is an
> out-of-office message to one incoming address. However, this OOO message
> must run 5pm-8am weekdays, and all day weekends. Apparently, Exchange
> cannot do this ...

Are your content filters pllugged into Postfix with SMTP? Filters
can be put in series (Postfix->filter1->filter2->Postfix) but the
details depend on whether the plumbing is done with SMTP or with
pipes.

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: How to run 2 content filters in parrallel?

helices-2
In reply to this post by Wietse Venema
No parallel content_filter processing?

http://www.postfix.org/FILTER_README.html

Advanced content filter: sending unfiltered mail to the content filter

RE: "scan"
This runs up to 10 content filters in parallel.

What am I missing?

~ Mike


On Mon, Oct 15, 2018 at 1:47 PM Wietse Venema <[hidden email]> wrote:
Mike Schleif:
> CentOS Linux release 7.5.1804 (Core)
> mail_version = 2.10.1
>
> Several years funning one content filter:
> 127.0.0.1:10025  inet  n  -     n       -       -       smtpd
>   -o content_filter=filter:dummy
>  ...
>
> Now, we need an autoresponder for one incoming address. Trying to use this:
> https://www.howtoforge.com/how-to-set-up-a-postfix-autoresponder-with-autoresponse
>
> Tried adding second line to above:
> 127.0.0.1:10025  inet  n  -     n       -       -       smtpd
>   -o content_filter=filter:dummy
>   -o content_filter=autoresponder:dummy

This will set content_filter to the last specified value. Postfix
parameters are scalars, not lists (list are specified with tables,
and there is no list-based variant of the content_filter variabe).

What do you mean with parallel? There is only one mail flow, so
it can flow through only one filter at a time.

Therefore, the answer depends on what you want: apply one of the
two filters or both filters (in series).

        Wietse

Reply | Threaded
Open this post in threaded view
|

Re: How to run 2 content filters in parrallel?

helices-2
In reply to this post by Wietse Venema

On Mon, Oct 15, 2018 at 3:09 PM Wietse Venema <[hidden email]> wrote:
Mike Schleif:
>  All addresses INCLUDING the special address?  - yes
>
> The special address is subject to ONLY this filter or BOTH filters? - BOTH
> filters
>
> Perhaps, there is another solution? All I'm trying to add is an
> out-of-office message to one incoming address. However, this OOO message
> must run 5pm-8am weekdays, and all day weekends. Apparently, Exchange
> cannot do this ...

Are your content filters pllugged into Postfix with SMTP? Filters
can be put in series (Postfix->filter1->filter2->Postfix) but the
details depend on whether the plumbing is done with SMTP or with
pipes.

        Wietse


Is this what you're looking for?

filter    unix  -       n       n       -       10      pipe
  flags=Rq user=filter null_sender=
  argv=/var/spool/filter/bin/filter.sh -f ${sender} -- ${recipient}

autoresponder unix - n n - - pipe
  flags=Fq user=autoresponse argv=/usr/local/sbin/autoresponse -s ${sender} -r ${recipient} -S ${sasl_username} -C ${client_address}

 ~ Mike

Reply | Threaded
Open this post in threaded view
|

Re: How to run 2 content filters in parrallel?

Noel Jones-2
In reply to this post by helices-2
The readme is referring to running 10 instances of the same content
filter in parallel to increase performance.

You appear to be using the "simple" content filter method, where
each filter reinjects mail to postfix by using the sendmail command.
The normal method of chaining multiple filters by cycling through
postfix won't work with "simple" filters (unless you set up a
separate postfix instance for each filter).

Since your OoO filter only applies to a single user, here's what I
recommend...

- modify your OOO script to pipe mail to your default content
filter, rather than to sendmail.

- use a check_recipient_access map that looks for the specific OOO
recipient and calls the filter for them.  Something like
[hidden email]   FILTER autoreply:dummy




  -- Noel Jones


On 10/15/2018 3:13 PM, Mike Schleif wrote:

> No parallel content_filter processing?
>
> http://www.postfix.org/FILTER_README.html
>
> Advanced content filter: sending unfiltered mail to the content filter
>
> RE: "scan"
> This runs up to 10 content filters in parallel.
>
> What am I missing?
>
> ~ Mike
>
>
> On Mon, Oct 15, 2018 at 1:47 PM Wietse Venema <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Mike Schleif:
>     > CentOS Linux release 7.5.1804 (Core)
>     > mail_version = 2.10.1
>     >
>     > Several years funning one content filter:
>     > 127.0.0.1:10025 <http://127.0.0.1:10025>  inet  n  -     n   
>        -       -       smtpd
>     >   -o content_filter=filter:dummy
>     >  ...
>     >
>     > Now, we need an autoresponder for one incoming address. Trying
>     to use this:
>     >
>     https://www.howtoforge.com/how-to-set-up-a-postfix-autoresponder-with-autoresponse
>     >
>     > Tried adding second line to above:
>     > 127.0.0.1:10025 <http://127.0.0.1:10025>  inet  n  -     n   
>        -       -       smtpd
>     >   -o content_filter=filter:dummy
>     >   -o content_filter=autoresponder:dummy
>
>     This will set content_filter to the last specified value. Postfix
>     parameters are scalars, not lists (list are specified with tables,
>     and there is no list-based variant of the content_filter variabe).
>
>     What do you mean with parallel? There is only one mail flow, so
>     it can flow through only one filter at a time.
>
>     Therefore, the answer depends on what you want: apply one of the
>     two filters or both filters (in series).
>
>             Wietse
>
>

Reply | Threaded
Open this post in threaded view
|

Re: How to run 2 content filters in parrallel?

Bill Cole-3
In reply to this post by helices-2
On 15 Oct 2018, at 15:51, Mike Schleif wrote:

>  All addresses INCLUDING the special address?  - yes
>
> The special address is subject to ONLY this filter or BOTH filters? -
> BOTH
> filters
>
> Perhaps, there is another solution? All I'm trying to add is an
> out-of-office message to one incoming address. However, this OOO
> message
> must run 5pm-8am weekdays, and all day weekends. Apparently, Exchange
> cannot do this ...

Using the Postfix "content_filter" functionality to do autoresponse is a
poor architectural choice for one address, especially if you want to
also pass the message through another filter. A better choice would be a
milter such as MIMEDefang, which can perform actions selectively
triggered by a message with or without modifying or consuming the
message. MD may seem a bit of overkill, but it is easy to pare down its
config to do only what you need.

--
Bill Cole
[hidden email] or [hidden email]
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Currently Seeking Steadier Work: https://linkedin.com/in/billcole
Reply | Threaded
Open this post in threaded view
|

Re: How to run 2 content filters in parrallel?

Wietse Venema
In reply to this post by helices-2
Mike Schleif:

> No parallel content_filter processing?
>
> http://www.postfix.org/FILTER_README.html
>
> Advanced content filter: sending unfiltered mail to the content filter
>
> RE: "scan"
> This runs up to 10 content filters in parallel.
>
> What am I missing?

I need to know how your filter is plugged into Postfix.

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: How to run 2 content filters in parrallel?

Wietse Venema
In reply to this post by helices-2
Mike Schleif:
> Is this what you're looking for?
>
> filter    unix  -       n       n       -       10      pipe
>   flags=Rq user=filter null_sender=
>   argv=/var/spool/filter/bin/filter.sh -f ${sender} -- ${recipient}

That is the 'simple' filter, which uses pipes, not SMTP.

> autoresponder unix - n n - - pipe

I was going to propose a solution of the form:

special user:
    Postfix SMTP client -> autoreply -> existing filter -> Postfix SMTP server

Everyone else:
    Postfix SMTP client -> existing filter -> Postfix SMTP server

But your filters are not SMTP based.

Next, I was going to propose

special user:
    Postfix pipe daemon -> autoreply -> existing filter -> Postfix sendmail
 
Everyone else:
    Postfix pipe daemon -> existing filter -> Postfix sendmail

That would not work because autoresponder wants to send its output
directly into the Postfix sendmail command; it would need to be
hacked up to make it invoke the existing filter instead.

        Wietse