Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Postfix and Ldap (Forward and Redirect)

1,465 views
Skip to first unread message

miolinux

unread,
Jul 11, 2007, 7:02:59 AM7/11/07
to
Hi,

I'm planning a mail server setup based on Postfix and Ldap (Courier
Pop/Imap) plus Amavis, and i would like to keep all user information
into the ldap (no .forward files).

I've setup a test server and working on it. Now i'm stuked and i need
some help :)

Ldap schema is mainly based on the authldap.schema and is like this:
(May change if needed)

mail: us...@our.domain
maildrop: nick...@our.domain
mailForwardingAddress: us...@gmail.com
localdelivery: true / false
accountStatus: active

What i need to do is let the user forward mail to an external account
and if localdelivery is set to true also drop mail into local mailbox,
if localdelivery is set fo false only deliver mail to the external
account.

Before amavis alias map query_filter is something like this:

query_filter=(&(&(|(mail=%s)(maildrop=%s))(accountStatus=active))(objectClass=mailUser))

so amavis rules always refer to the "mail:" address.

After amavis process message this is returned to smtp on port 10025 and
here i need to further process the message:

What i need is a query filter to return mail AND mailForwardingAddress
if localdelivery is true, and just mailForwardingAdress if
localdelivery is false.

I've thinked a lot but i've found no solution. The only things that
comes me to mind is to set up TWO query_filter like this:
The first filter return "mail:" if localdelivery is true
The second filter reurn "mailForwardingAddress:" if present

This way however i'm going to make two ldap lookups (3 with pre-amavis
one) for single message delivery. Is there a smarter way to do
something like this?

Thanks.

MioLinux

Watashi

unread,
Jul 11, 2007, 7:54:02 AM7/11/07
to
Hi Mio,

I had troubles with the same situation than you. What I did was to create in
main.cf the following:

virtual_alias_maps = proxy:ldap:/etc/postfix/bancos/virtual_aliases.cf

virtual_aliases.cf:

bind = yes
server_host = ldap://10.0.1.1
search_base = dc=DOMAIN
version = 3
bind_dn = cn=linuxbind,dc=DOMAIN
bind_pw = secret
scope = sub
query_filter = (&(&(objectClass=user)(maildrop=%s))
result_attribute = mailforward

I don't use openldap here, i use Active Directory. This attribute mailforward is
multivalued and let you put more than one email address.

For example:

mail: wat...@domain.com
mailforward: watashi@gmail
mailforward: watashi@domain
maildrop: wat...@domain.com

Why maildrop and mail is equal?? Because I use maildrop here too, and it look
for users in mail attribute. If there are two mail attribute with the same
content, it gives error, so I had to make it. It works perfect to me!! This
schema above send a email to wat...@gmail.com and one email for the own
recipient.

So, when the email arrives, postfix look for email as alias, and after that, as
local users(ldap). To works with redirect and forward, the destination has to
be a alias unfortunally.

[]'s

Watashi

--------------------------------------

Hi,

query_filter=(&(&(|(mail=%s)(maildrop=%s))(accountStatus=active))(objectClass=mailUser))

Thanks.

MioLinux

___________________________________________________________________________________
Para fazer uma ligação DDD pra perto ou pra longe, faz um 21. A Embratel tem
tarifas muito baratas esperando por você. Aproveite!

0 new messages