content_filter and transport_map on outgoing mail interaction

2015-09-10 Thread Mark Clarke

Hi there,

We have a transport map setup so that mail destined for the local domain 
or from some subdomain email servers is not routed to our relay gateway. 
These entries have a null gateway set. Mail destined for all other 
domains is routed via our relay.


e.g

serve...@server01.abc.co.za :
ad...@dms.abc.co.za :
abc.co.za :
* smtp:relay.xyz.co.za


We need to apply a content_filter to all outgoing mail. To do this we 
have set up two smtp processes in master.cf


192.168.10.73:smtp  inet  n   -   -   - -   smtpd
192.168.10.72:smtp  inet  n   -   -   - -   smtpd
   -o content_filter=dfilt:
dfilt unix-   n   n   -   -   pipe
flags=Rq user=filter argv=/etc/postfix/postfix_filter.sh -f 
${sender} -- ${recipient}



this is for the altermime script. In main.cf we have set up

smtp_bind_address = 192.168.10.72

The problem is it appears the transport map simply by passes the 
outgoing smtp server settings as defined in main.cf and with 
smtp_bind_address. I have tried editing the transport map to force it to 
use the 192.168.10.72:smtp service but this doesn't work. How can I get 
this to work? i.e route outgoing mail to a specific gateway via 
transport maps but still apply a content filter to outgoing mail?



thanks


Re: content_filter and transport_map on outgoing mail interaction

2015-09-10 Thread Viktor Dukhovni
On Thu, Sep 10, 2015 at 06:12:44PM +0200, Mark Clarke wrote:

> We need to apply a content_filter to all outgoing mail. To do this we have
> set up two smtp processes in master.cf
> 
> 192.168.10.73:smtp  inet  n   -   -   - -   smtpd
> 192.168.10.72:smtp  inet  n   -   -   - -   smtpd
>-o content_filter=dfilt:

These are Postfix SMTP servers (accept incoming mail).

> dfilt unix-   n   n   -   -   pipe
> flags=Rq user=filter argv=/etc/postfix/postfix_filter.sh -f ${sender} --
> ${recipient}
> 
> 
> this is for the altermime script. In main.cf we have set up
> 
> smtp_bind_address = 192.168.10.72

This is a configuration parameter of the SMTP client (sends outgoing
mail).  It has nothing to do with which SMTP service mail will be
sent to.

> The problem is it appears the transport map simply by passes the outgoing
> smtp server settings as defined in main.cf and with smtp_bind_address.

There's no bypass, you're simply confused.

> I have tried editing the transport map to force it to use the
> 192.168.10.72:smtp service but this doesn't work.

To send to that service, you'd make the transport:

smtp:[192.168.10.72]

but that will almost certainly create a mai loop.

> How can I get this to
> work? i.e route outgoing mail to a specific gateway via transport maps but
> still apply a content filter to outgoing mail?

That's what Postfix does.  It first applies content filters, and
then once the mail is re-injected into queue (by a mechanism that
does set a content_filter) uses the transport table.

You're just confused.

-- 
Viktor.


Re: content_filter and transport_map on outgoing mail interaction

2015-09-10 Thread Mark Clarke
Ok, figured it out. Read up more on the postfix architecture and
confirmed that it should work as the content_filter will run on the mail
once it has been received and before it is delivered via smtp to its
destination. The issue was that I am submitting on the submission port
587 and needed to add the content_filter there. In fact I don't need two
IP addresses for the smtp delivered mail :)



On 09/10/2015 06:12 PM, Mark Clarke wrote:
> Hi there,
>
> We have a transport map setup so that mail destined for the local
> domain or from some subdomain email servers is not routed to our relay
> gateway. These entries have a null gateway set. Mail destined for all
> other domains is routed via our relay.
>
> e.g
>
> serve...@server01.abc.co.za :
> ad...@dms.abc.co.za :
> abc.co.za :
> * smtp:relay.xyz.co.za
>
>
> We need to apply a content_filter to all outgoing mail. To do this we
> have set up two smtp processes in master.cf
>
> 192.168.10.73:smtp  inet  n   -   -   - -   smtpd
> 192.168.10.72:smtp  inet  n   -   -   - -   smtpd
>-o content_filter=dfilt:
> dfilt unix-   n   n   -   -   pipe
> flags=Rq user=filter argv=/etc/postfix/postfix_filter.sh -f
> ${sender} -- ${recipient}
>
>
> this is for the altermime script. In main.cf we have set up
>
> smtp_bind_address = 192.168.10.72
>
> The problem is it appears the transport map simply by passes the
> outgoing smtp server settings as defined in main.cf and with
> smtp_bind_address. I have tried editing the transport map to force it
> to use the 192.168.10.72:smtp service but this doesn't work. How can I
> get this to work? i.e route outgoing mail to a specific gateway via
> transport maps but still apply a content filter to outgoing mail?
>
>
> thanks


--
This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed. 
If you have received this email in error please notify the system manager. This 
message contains confidential information and is intended only for the 
individual named. If you are not the named addressee you should not 
disseminate, distribute or copy this e-mail. Please notify the sender 
immediately 
by e-mail if you have received this e-mail by mistake and delete this e-mail 
from your system. If you are not the intended recipient you are notified 
that disclosing, copying, distributing or taking any action in reliance on the 
contents of this information is strictly prohibited.