I need to rewrite the envelope field "MAIL FROM:" but only for emails which come
from particular smtp client IP.
Is there any possibility how to do it?
Regards,
Peter Micunek
-----------------------------------------------
Stavebna fakulta STU, Bratislava
Faculty of Civil Engineering STU, Bratislava
http://www.svf.stuba.sk
Can you describe the problem, instead of the solution (per
client rewriting)?
Wietse
problem is that I need to have one domain in the field "MAIL FROM:" for all
emails
come from particular client for example 10.10.10.10 to my postfix server.
The mail header field "From:" will be preserved.
I need to do because these emails is routed via transport map to the
destination (MMS center)
which have policy based on MAIL FROM: domain. I can not allow all domains on
MMSC.
regards,
PM
On Tue, 8 Feb 2011 08:24:17 -0500 (EST), Wietse Venema wrote
You need to configure as follows:
1) Configure Postfix to preserve the From: address in mail from
this client. For control over Postfix header rewriting, see:
http://www.postfix.org/postconf.5.html#local_header_rewrite_clients
2) Configure the client to send mail with the "right" From: address.
The details for doing this are specific to the client.
Wietse
If you are unable to properly configure the sending client,
have your transport map route to a different postfix instance
that uses virtual_alias_maps to rewrite the sender, then the
second postfix instance can use its own transport_maps to
route to the final destination.
http://www.postfix.org/MULTI_INSTANCE_README.html
-- Noel Jones
If (2) is not possible, you can use a null content filter instead,
where a customized Postfix SMTP client "replaces" the From: header
using PCRE regular expressions, and then sends the result directly
into a Postfix SMTP server on 127.0.0.1 port 10026.
/etc/postfix/main.cf:
smtpd_client_restrictions =
check_client_access hash:/etc/postfix/client_access
/etc/postfix/client_access:
10.10.10.10 FILTER foobar:127.0.0.1:10026
/etc/postfix/master.cf:
foobar unix - - n - - smtp
-o smtp_generic_maps=pcre:/etc/postfix/foobar_generic.pcre
127.0.0.1:10026 inet n - n - - smtpd
-o receive_override_options=no_address_mappings,no_milters
/etc/postfix/foobar_generic.pcre:
/^From: something/ REPLACE From: something
This assumes that you aren't already using FILTER for other purposes.
References:
http://www.postfix.org/FILTER_README.html
http://www.postfix.org/master.5.html
http://www.postfix.org/postconf.5.html#receive_override_options
http://www.postfix.org/postconf.5.html#smtp_generic_maps
http://www.postfix.org/generic.html
http://www.postfix.org/pcre_table.html
Wietse
It seems that you helped me.
Thanks a lot
PM
On Tue, 8 Feb 2011 10:26:19 -0500 (EST), Wietse Venema wrote
Good. for posteriority, the examples below uses smtp_header_checks
syntax instead of smtp_generic_checks syntax. Either feature should
do the job, when used appropriately.
Wietse
> Good. for posteriority, the examples below uses smtp_header_checks
> syntax instead of smtp_generic_checks syntax. Either feature should
> do the job, when used appropriately.
That would be smtp_generic_maps of course, which rewrites header
addresses, using a more complete parser than can be shoe-horned into
PCRE regular expressions.
--
Viktor.