Discussion:
sender_canonical_maps - from header checking
(too old to reply)
POSTFIX MAIL
2014-01-03 16:21:56 UTC
Permalink
Hello,

Configuration
OS: RHEL 5.3
MTA: mail_version = 2.7.3

I would like to rewrite messages sender header using the "sender_canonical_maps" feature.
Something like that below to remove the location part in () if any for the test.fr sender domain.
from: alain (rennes) <***@test.fr> => from: alain <***@test.fr>

I configured Postfix this way:
sender_canonical_classes = header_sender
sender_canonical_maps = regexp:/etc/postfix/sender_canonical_regexp
remote_header_rewrite_domain = test.fr
local_header_rewrite_clients =

with sender_canonical_regexp
/^(.*)\(.+\)\s*(.*)$/ ${1}${2}

It did not work as expected as if the rewriting only applied on the sender @ part.
Maillog extract :

Jan 3 16:56:26 rhel53-ag-fe1 postfix/cleanup[22775]: cleanup_header_callback: 'from: alain (rennes) <***@test.fr>'
Jan 3 16:56:26 rhel53-ag-fe1 postfix/cleanup[22775]: rewrite_sender: From
Jan 3 16:56:26 rhel53-ag-fe1 postfix/cleanup[22775]: send attr request = rewrite
Jan 3 16:56:26 rhel53-ag-fe1 postfix/cleanup[22775]: send attr rule = remote
Jan 3 16:56:26 rhel53-ag-fe1 postfix/cleanup[22775]: send attr address = ***@test.fr
Jan 3 16:56:26 rhel53-ag-fe1 postfix/cleanup[22775]: private/rewrite socket: wanted attribute: flags
Jan 3 16:56:26 rhel53-ag-fe1 postfix/cleanup[22775]: input attribute name: flags
Jan 3 16:56:26 rhel53-ag-fe1 postfix/cleanup[22775]: input attribute value: 0
Jan 3 16:56:26 rhel53-ag-fe1 postfix/cleanup[22775]: private/rewrite socket: wanted attribute: address
Jan 3 16:56:26 rhel53-ag-fe1 postfix/cleanup[22775]: input attribute name: address
Jan 3 16:56:26 rhel53-ag-fe1 postfix/cleanup[22775]: input attribute value: ***@test.fr
Jan 3 16:56:26 rhel53-ag-fe1 postfix/cleanup[22775]: private/rewrite socket: wanted attribute: (list terminator)
Jan 3 16:56:26 rhel53-ag-fe1 postfix/cleanup[22775]: input attribute name: (end)
Jan 3 16:56:26 rhel53-ag-fe1 postfix/cleanup[22775]: rewrite_clnt: remote: ***@test.fr -> ***@test.fr
Jan 3 16:56:26 rhel53-ag-fe1 postfix/cleanup[22775]: dict_regexp_lookup: /etc/postfix/sender_canonical_regexp: ***@test.fr
Jan 3 16:56:26 rhel53-ag-fe1 postfix/cleanup[22775]: maps_find: sender_canonical_maps: ***@test.fr: not found

I made a new test removing the "sender_canonical_maps" configuration then using the "header_checks" feature.
header_checks = regexp:/etc/postfix/header_checks
with /etc/postfix/header_checks
/^(From: .*)\(.+\)\s*(.*)$/ REPLACE ${1}${2}

And here it worked as expected.

Question: Why doesn't it work with the "sender_canonical_maps" configuration ?

Thank you for Your Help
and Happy New Year

Alain
l***@rhsoft.net
2014-01-03 16:29:11 UTC
Permalink
Post by POSTFIX MAIL
Configuration
OS: RHEL 5.3
MTA: mail_version = 2.7.3
I would like to rewrite messages sender header using the "sender_canonical_maps" feature.
Something like that below to remove the location part in () if any for the test.fr sender domain.
please read the documentation again

the From-header does not matter in context of SMTP
otherwise you would not receive any message you are sending
to a mailing-list

hint: envelope is different to From
Viktor Dukhovni
2014-01-03 16:44:55 UTC
Permalink
Question: Why doesn't it work with the "sender_canonical_maps" configuration?
Header address rewriting applies *only* to the mailbox address part
of email headers. Thus in:

From: Phrase allegedly naming mailbox recipient <***@example.com>

the input to address rewriting is:

***@example.com

and its output (say "***@example.org") replaces just the address yielding:

From: Phrase allegedly naming mailbox recipient <***@example.org>
--
Viktor.
Wietse Venema
2014-01-03 18:04:38 UTC
Permalink
Post by Viktor Dukhovni
Question: Why doesn't it work with the "sender_canonical_maps" configuration?
Header address rewriting applies *only* to the mailbox address part
I thought the documentation cleary says *address* rewriting. What
does it take to make people read what the documentation says, instead
of what they want to hear?

Wietse
LuKreme
2014-01-03 22:29:41 UTC
Permalink
Post by Wietse Venema
Post by Viktor Dukhovni
Question: Why doesn't it work with the "sender_canonical_maps" configuration?
Header address rewriting applies *only* to the mailbox address part
I thought the documentation cleary says *address* rewriting. What
does it take to make people read what the documentation says, instead
of what they want to hear?
Confusion as to what an address is? I’d guess a lot of people would look at this and think, hey, that’s the address:

“Joe and Agnes Blow” <***@example.com>

What is surprising is that a lot of admins of mail servers would do this.
--
And crawling on the planet's face
Some insects called the human race
Lost in time, lost in space, and meaning
POSTFIX MAIL
2014-01-06 10:50:27 UTC
Permalink
maybe a couple of words in the doc about "optional display name" would help as the "address" term is a bit confusing considering it could refer by extension to the whole from field.
or writing "addr-spec address only" in place of "address"
do not consider this as a offensive remark but as a suggestion ...
Post by Wietse Venema
Post by Viktor Dukhovni
Question: Why doesn't it work with the "sender_canonical_maps" configuration?
Header address rewriting applies *only* to the mailbox address part
I thought the documentation cleary says *address* rewriting. What
does it take to make people read what the documentation says, instead
of what they want to hear?
Wietse
Loading...