OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: Problems with either canonical_maps or alias_maps

From: Ron Winograd (ron.winogradnovelics.com)
Date: Sun Jul 15 2007 - 10:41:56 CDT


Noel Jones wrote:
> At 11:28 PM 7/14/2007, Ron Winograd wrote:
>> I'm continuing to have a problem with either canonical_maps or
>> alias_maps, but I'm not sure which. My domain is mydomain.com The
>> problem is that email to useranydomain gets changed to
>> usermydomain.com. So when the mail finally arrives, does the To:
>> header still say useranydomain (suspect alias maps) or usermydomain
>> (suspect canonical)?
> To see the rewrites postfix does, add a -v to the cleanup entry in
> master.cf to see the canonical rewrites, or add a -v to the local
> entry to see alias rewrites.

Thank you for the reply Nicole. When the email arrives, the headers are
changed to useranydomain. Using the -v flag you pointed out I was able
to confirm your suspicions that it is canonical_maps causing my problem.

Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: initial envelope A
client_address=192.168.141.14
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: initial envelope A
message_origin=unknown[192.168.141.14]
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: initial envelope A
helo_name=[127.0.0.1]
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: initial envelope A
protocol_name=ESMTP
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: initial envelope R
ronyahoo.com
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: send attr request =
rewrite
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: send attr rule = local
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: send attr address =
ronyahoo.com
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: private/rewrite
socket: wanted attribute: flags
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: input attribute name:
flags
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: input attribute value: 0
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: private/rewrite
socket: wanted attribute: address
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: input attribute name:
address
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: input attribute
value: ronyahoo.com
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: private/rewrite
socket: wanted attribute: (list terminator)
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: input attribute name:
(end)
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: rewrite_clnt: local:
ronyahoo.com -> ronyahoo.com
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: dict_ldap_lookup: In
dict_ldap_lookup
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: dict_ldap_lookup:
Using existing connection for LDAP source /etc/postfix/ldap-canonical.cf
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: dict_ldap_lookup:
/etc/postfix/ldap-canonical.cf: Searching with filter (uid=ron)
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]:
dict_ldap_get_values[1]: Search found 1 match(es)
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]:
dict_ldap_get_values[1]: search returned 1 value(s) for requested result
attribute mail
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]:
dict_ldap_get_values[1]: Leaving dict_ldap_get_values
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: dict_ldap_lookup:
Search returned ron.winograd
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: maps_find:
canonical_maps: ldap:/etc/postfix/ldap-canonical.cf(0,100):
ronyahoo.com = ron.winograd
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: mail_addr_find:
ronyahoo.com -> ron.winograd
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: send attr request =
rewrite
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: send attr rule = local
Jul 15 08:17:05 srv-vantis postfix/cleanup[24518]: send attr address =
ron.winograd

As Wietse has pointed out (I am very sorry for misquoting you earlier)

        username -> first.last

happen only for domains that match myorigin, mydestination, or when
the destination is listed in inet_interfaces or proxy_interfaces.

In this case the domain is yahoo.com -- yahoo.com does not match
myorigin, mydestination, and the IP for yahoo.com is not listed in my
inet_interfaces or proxy_interfaces, so I continue to be confused as to
why this email address is being subjected to canonical address mapping.
In addition I am using yahoo.com here only as an example however the
problem happens with _any_ domain, and I certainly don't have every
domain on the internet listed in any of these parameters!
mydomain = mydomain.com
myorigin = $mydomain
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
inet_interfaces = all
proxy_interfaces =

Now sure enough if I do:
postmap -q ronyahoo ldap:/etc/postfix/ldap-canonical.cf
I get a response of "ron.winograd" because ldap-canonical only looks at
the username portion of the email address, but again my understanding is
that since 'yahoo.com' is not contained in myorigin, mydestination, and
is not listed in inet_interfaces or proxy_interfaces, this canonical map
should not be applied in this situation.

Best regards to all,

-- Ron