Discussion:
Migrating from sendmail with LDAP routing
(too old to reply)
Jean-Michel Dault
17 years ago
Permalink
Hello all!

I'm trying to convert a large organization (80,000 email entries, 72
domains/subdomains) from Sendmail to Postfix, and I've hit a brick wall.

They're using the following schema: http://www.sendmail.org/m4/laser.txt

Basically, Sendmail does an LDAP search with
(&(objectClass=inetLocalMailRecipient)(mailLocalAddress=%0))
and returns "mailRoutingAddress" and "mailHost". It then rewrites the
envelope to the mailRoutingAddress and sends it via smtp to mailHost.

I've read all the Postfix documentation I could find, and googled
extensively, but I can't duplicate *exactly* the behavior.

The closest way I found is to do a first rewrite with LDAP
virtual_alias_maps using "mailRoutingAddress" as the result_attribute.
Then, I use transport_maps to search for the "mailRoutingAddress", and
use "mailHost" with result_format = smtp:%s.

However, this assumes that the mailRoutingAddress is a unique ID, which
is not the case. In such a large organization with many departments with
different types of mail servers (Unix/Linux/Windows), and multiple
migrations, you have different servers covering the same domains.

The problem is that once you've rewritten the address once, you can't
use the "original" mail address to make a new search, like Sendmail
does.

Is there a way in postfix to either:
1) use the "orig_to" in an LDAP request instead of the "to" address?
2) do *both* rewrite and transport at the same time (maybe using
trivial-rewrite "resolve" request)?

What I would need is a map like this:
***@domain ***@realdomain smtp:server.otherdomain

Thanks in advance!
--
Jean-Michel Dault <***@revolutionlinux.com>
Révolution Linux inc.
Christian Kratzer
17 years ago
Permalink
Hi,
Le vendredi 22 février 2008 à 14:21 -0300, Reinaldo de Carvalho a
Use virtual_alias_maps and transport_maps.
virtual_alias_maps = hash:/etc/postfix/virtual
transport_maps = hash:/etc/postfix/transport
That's what I tried at first.
Problem is, if you look at /etc/postfix/transport, there are two
I know, it's twisted =(
example.com comment anything
example.net comment2 anything
otherisp.com smtp:127.0.0.1
we have a similar setup which gives us most of the laser draft
features ignoring a couple of corner cases.

1. We use a transport map that maps mailLocalAddress to smtp:[mailHost].
The ldap query filter is set to match only if mailHost!=$myhostname.

query_filter =
(&
(objectClass=inetLocalMailRecipient)
(mailLocalAddress=%s)
(!(mailHost=myhostname))
)
result_attribute = mailHost
result_filter = smtp:[%s]


2. We also use a virtual_alias_map to map mailLocalAddress to
mailRoutingAdress.

The ldap query filter only matches if mailhost==$myHostname
and if mailRoutingAddress is set.

query_filter =
(&
(objectClass=inetLocalMailRecipient)
(mailLocalAddress=%s)
(mailRoutingAddress=*)
(mailHost=myhostname)
)
result_attribute = mailRoutingAddress


Above is not perfect but works quite well.

The mails are routed to the final destination on mailHost without
rewriting the envelope recipient. The envelope recipient is only
rewritten on mailHost and then only if mailRoutingAddress is set.

We always need a mailHost. I think laser can do without.

I think there are a couple of cases we cannot handler but the
above jsmith cases should work.

We also redefined mailRoutingAddress as a multivalued attribute
in our local schema which laser does not support.

Greetings
Christian
--
Christian Kratzer CK Software GmbH
Email: ***@cksoft.de Schwarzwaldstr. 31
Phone: +49 7452 889 135 D-71131 Jettingen
Fax: +49 7452 889 136 HRB 245288, Amtsgericht Stuttgart
Web: http://www.cksoft.de/ Geschaeftsfuehrer: Christian Kratzer
Loading...