Re: How to rewrite incoming & outgoing headers?

2015-10-23 Thread Wietse Venema
helices:
[ Charset windows-1252 converted... ]
> I've been through this before. Yes, I know MTA isn't preferred for such. 
> This isn't happening elsewhere.
> 
> We have 100s of domains. For example, To:i...@domain1.com will get 
> delivered to s...@2domain.net. When Suzy replies, it will be 
> From:i...@domain1.com
> 
> I can do this by rewriting both From: and To: headers, both incoming and 
> outgoing.
> 
> What is the simplest way to do this with postfix?

Use a Milter or SMTP-based content filter. Postfix is an MTA,
it is not a content-management system.

Wietse


Re: How to rewrite incoming & outgoing headers?

2015-10-23 Thread Mauricio Tavares
On Fri, Oct 23, 2015 at 6:02 AM, Wietse Venema  wrote:
> helices:
> [ Charset windows-1252 converted... ]
>> I've been through this before. Yes, I know MTA isn't preferred for such.
>> This isn't happening elsewhere.
>>
>> We have 100s of domains. For example, To:i...@domain1.com will get
>> delivered to s...@2domain.net. When Suzy replies, it will be
>> From:i...@domain1.com
>>
>> I can do this by rewriting both From: and To: headers, both incoming and
>> outgoing.
>>
>> What is the simplest way to do this with postfix?
>
> Use a Milter or SMTP-based content filter. Postfix is an MTA,
> it is not a content-management system.
>
> Wietse

Here are two examples of doing what you want:

1) Ticketing system. In my old job, emails sent to supp...@oldjob.com
would be forwarded to those who handled the support. They would reply
directly to the ticket, which then would go (email) to the ticketing
system which then would send it back to customer, showing only the
supp...@oldjob.com as return address. All this email address changing
dance was taken care by ticketing system.

2) A mailing list just like this one. If you noticed, the default
reply address to this list is postfix-users@postfix.org instead of the
user who sent the email. So, it behaves like the ticketing system I
mentioned, being the only difference that you can find the email
address of the last person who sent a reply to a thread and email
directly, bypassing the list or not. Once again, that is taken care by
the mailing list software, which probably can also do spam filtering
and some other neat features postfix would not do.


Re: How to rewrite incoming & outgoing headers?

2015-10-23 Thread Wietse Venema
Wietse Venema:
> helices:
> > I've been through this before. Yes, I know MTA isn't preferred for such. 
> > This isn't happening elsewhere.
> > 
> > We have 100s of domains. For example, To:i...@domain1.com will get 
> > delivered to s...@2domain.net.

This can be done with virtual_alias_maps (i...@domain1.com->s...@2domain.net).

Important: this replaces the envelope address but not the header address.

> >  When Suzy replies, it will be 
> > From:i...@domain1.com
> > 
> > I can do this by rewriting both From: and To: headers, both incoming and 
> > outgoing.

Use canonical maps:

canonical_classes = header_sender, header_recipient
canonical_maps = some-map-type:some-map-name

Where the canonical_maps does

i...@domain1.com -> s...@2domain.net (or some other).

So that the mail will appear to come from s...@2domain.net (otr whatever).

Important: this replaces header addresses only.

Wietse


Re: Using postscreen_dnsbl_reply_map

2015-10-23 Thread Alex
Hi,

On Thu, Oct 22, 2015 at 3:56 PM, Alex  wrote:
> Hi,
>
> On Thu, Oct 22, 2015 at 12:45 AM, Viktor Dukhovni
>  wrote:
>> On Wed, Oct 21, 2015 at 07:59:29PM -0400, Alex wrote:
>>
>>> Oct 21 19:56:10 mail01 postfix/smtpd[20778]: NOQUEUE: reject: RCPT
>>> from bx1.c4xf.com[66.150.190.74]: 554 5.7.1 Service unavailable;
>>> Unverified Client host [bx1.c4xf.com] blocked using
>>> mykey.dbl.dq.spamhaus.net;
>>> http://www.spamhaus.org/query/dbl?domain=c4xf.com;
>>> from= to= proto=ESMTP
>>> helo=
>>
>> This was blocked by smtpd(8) NOT postscreen.  Perhaps surprisingly,
>> The smtpd(8) service has a different mechanism for obfuscating the
>> DNSBL service name.
>>
>> http://www.postfix.org/postconf.5.html#rbl_reply_maps

I think I figured out what I'm doing wrong but I don't know how to fix it.

I see for the postconf(5) entry for reject_rhsbl_client is:

reject_rhsbl_client rbl_domain=d.d.d.d

In my smtpd_recipient_restrictions I'm doing the following:

reject_rhsbl_reverse_client mykey.dbl.dq.spamhaus.net,
reject_rhsbl_sender mykey.dbl.dq.spamhaus.net,
reject_rhsbl_helo mykey.dbl.dq.spamhaus.net

without the "d.d.d.d".

Does the "d.d.d.d" represent the A record of the response code from
the DBL? Or the A record of the IP of which we are checking?

I don't understand how to map the restricts to their entry in the
rbl_reply_maps file.

Do I need to change how the restrictions are listed?

Thanks,
Alex


Re: Using postscreen_dnsbl_reply_map

2015-10-23 Thread Viktor Dukhovni
On Fri, Oct 23, 2015 at 03:45:25PM -0400, Alex wrote:

> I see for the postconf(5) entry for reject_rhsbl_client is:
> 
> reject_rhsbl_client rbl_domain=d.d.d.d

That "=d.d.d.d" is your choice of optional filter on the RBL's
reply.

> In my smtpd_recipient_restrictions I'm doing the following:
> 
> reject_rhsbl_reverse_client mykey.dbl.dq.spamhaus.net,
> reject_rhsbl_sender mykey.dbl.dq.spamhaus.net,
> reject_rhsbl_helo mykey.dbl.dq.spamhaus.net
>
> without the "d.d.d.d".

You're not specifying an optional filter.  Therefore, your lookup
keys are just the RBL domains with no "=d.d.d.d".

> Does the "d.d.d.d" represent the A record of the response code from
> the DBL? Or the A record of the IP of which we are checking?

Neither.

> I don't understand how to map the restricts to their entry in the
> rbl_reply_maps file.

Copy the verbatim  in "reject_...bl_... " as the
lookup key.

-- 
Viktor.