Different %s key from postconf and real lookups

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Different %s key from postconf and real lookups

Tommaso Visconti
Hi everybody,
i'm trying to configure my postfix for ldap lookups, but with strange
results.

My ldap record has 2 important fields: 'mail' and 'uid'. Postfix should
use the 'mail' field to verify the recipient and than save the email
into /mail/'uid'/Maildir

 From main.cf:
[..]
   alias_maps = hash:/etc/aliases, ldap:/etc/postfix/ldap-aliases.cf
[..]

 From ldap-aliases.cf:
[..]
   search_base = dc=example, dc=com
   query_filter = mail=%s
[..]

An example ldap record:
[..]
mail = [hidden email]
uid = tommaso
[..]

The postmap command:
~$ postmap -q [hidden email]
ldap:/etc/postfix/ldap-aliases.cf

returns:
tommaso

So it seems to work. But if i send an email to
[hidden email] postfix's log reports:

Sep  6 14:56:26 pippo postfix/local[2594]: 0E37C53528:
to=<[hidden email]>, relay=local, delay=0.45,
delays=0.25/0.06/0/0.14, dsn=5.1.1, status=bounced (unknown user:
"tommaso.visconti")

Changing ldap-aliases.cf as:
[..]
   query_filter = mail=%[hidden email]
[..]

postmap command fails, but the email arrives correctly. so it seems that
the search key %s in ldap-aliases.cf is '[hidden email]'
while using postmap and only 'tommaso.visconti' while receiving an email.

I'd like to change this second behaviour because the postmap way is that
i'm looking for... :)

thanks,
Tommaso
Reply | Threaded
Open this post in threaded view
|

Re: Different %s key from postconf and real lookups

mouss-2
Tommaso Visconti wrote:

> Hi everybody,
> i'm trying to configure my postfix for ldap lookups, but with strange
> results.
>
> My ldap record has 2 important fields: 'mail' and 'uid'. Postfix should
> use the 'mail' field to verify the recipient and than save the email
> into /mail/'uid'/Maildir
>
>  From main.cf:
> [..]
>   alias_maps = hash:/etc/aliases, ldap:/etc/postfix/ldap-aliases.cf
> [..]
>
>  From ldap-aliases.cf:
> [..]
>   search_base = dc=example, dc=com
>   query_filter = mail=%s
> [..]
>
> An example ldap record:
> [..]
> mail = [hidden email]
> uid = tommaso
> [..]
>
> The postmap command:
> ~$ postmap -q [hidden email]
> ldap:/etc/postfix/ldap-aliases.cf
>
> returns:
> tommaso
>
> So it seems to work.

it does not. as documented, the lookup key in alias_maps is a local-part
(no domain part).
        http://www.postfix.org/aliases.5.html
It says
        "The name is a local address (no domain part)."

> But if i send an email to
> [hidden email] postfix's log reports:
>
> Sep  6 14:56:26 pippo postfix/local[2594]: 0E37C53528:
> to=<[hidden email]>, relay=local, delay=0.45,
> delays=0.25/0.06/0/0.14, dsn=5.1.1, status=bounced (unknown user:
> "tommaso.visconti")
>
> Changing ldap-aliases.cf as:
> [..]
>   query_filter = mail=%[hidden email]
> [..]
>
> postmap command fails, but the email arrives correctly. so it seems that
> the search key %s in ldap-aliases.cf is '[hidden email]'
> while using postmap and only 'tommaso.visconti' while receiving an email.
>
> I'd like to change this second behaviour because the postmap way is that
> i'm looking for... :)
>
> thanks,
> Tommaso