[Kroupware] Postfix routing - elegant solution needed

Stephan Buys s.buys at codefusion.co.za
Fri Jul 18 13:32:02 CEST 2003


Hi all,

I have a situation whereby the postfix mydomain is set to an organization wide
e-mail address. 

My situation is that sometimes mail gets sent to the server that has the pattern:
unknownuser at mydomain

This user does not exist on the system, but because mydomain is set to the same
domain the mail is handed to lmtp, upon which Cyrus replies with:

550-Mailbox unknown.  Either there is no mailbox associated with this
    550-name or you do not have authorization to see it. 550 5.1.1 User unknown
    (in reply to RCPT TO command)

To resolve this issue I have done the following:

1) Use the canonical rewrite mechanism to rewrite all known and unknown 
addresses from mydomain into a special format:

/kolab/etc/postfix/canonical
@kolabtest.co.za          kolab at unknown.kolabtest.co.za

/kolab/etc/kolab/main.cf.template
recipient_canonical_maps = ldap:ldapsource 
canonical_maps = hash:/kolab/etc/postfix/canonical

ldapsource_search_base = dc=baronny,dc=kolabtest,dc=co,dc=za
ldapsource_query_filter = (mail=%s)
ldapsource_result_attribute = mail
ldapsource_result_filter = %s.known
ldapsource_search_timeout = 2
ldapsource_scope = one
ldapsource_bind = no
ldapsource_version = 3

The result of this step is that any mailbox on my server resolves through ldap
if a user is local or not. 
-If not the user becomes: user at unknown.kolabtest.co.za
-If known the user becomes: user at kolabtest.co.za.known
---

2) All unknown addresses are relayed out to my main router, where the router
rewrites unknown.kolabtest.co.za to kolabtest.co.za and continues merilly.
---

3) All known users are fixed through virtual as follows:

/kolab/etc/postfix/virual.reg
/^(.*)@kolabtest\.co\.za\.known/      $1 at kolabtest.co.za

/kolab/etc/kolab/main.cf.template
virtual_maps = regexp:/kolab/etc/postfix/virtual.reg hash:/kolab/etc/postfix/virtual

This fixes the addresses from kolabtest.co.za.known to kolabtest.co.za after which
the addresses are handed to Cyrus through lmtp and delivered.
---

Is there an easier way to do this? This solution works with pretty good performance.

Any postfix gurus out there? ;-)

Regards,
-- 
Stephan 



More information about the Kroupware mailing list