April 25, 2009

Postfix Mail Server with LDAP Server !!!!!!!!

Make sure that Postfix and OpenLDAP are installed and running.
This will get Postfix talking to LDAP and allow for mail lookups to search through your current LDAP.

1. Your LDAP server should be running and working.

2.Open /etc/postfix/main.cf and search for :

alias_maps = hash:/etc/postfix/aliases

This should be changed to include LDAP in mail aliases lookup therefore the line should now look like :
alias_maps = hash:/etc/postfix/aliases, ldap:ldapaliases

3. Append the following lines /etc/postfix/main.cf to specify the LDAP options

# Specify the LDAP server hostname
# If it resides on the same machine
# as Postfix a simple localhost will work

ldapaliases_server_host = localhost

# Specify LDAP server port again if LDAP
# resides locally non encrypted port will work
# otherwise change to port 636

ldapaliases_server_port = 389

# Specify the LDAP tree to search

ldapaliases_search_base = ou=user,dc=Chd,dc=Edu

# Specify LDAP search scope. All subtress under
# ldapaliases_search_base is searched if scope is
# set to "sub". Other options are "base" or "one"

ldapaliases_scope = sub

# Specify whether LDAP binds to the server. Setting
# this to no will save some overhead.

ldapaliases_bind = no

# The ldap_query_filter parameter specifies the filter used for queries.
# The replacement for "%s" is the address input into the map; e.g.
# for alias maps, the "user" part (the RFC 2822 local-part) of
# "user@domain.com" for To: addresses destined for local delivery
# (those matching $mydestination or a virtual domain), and all of
# "user@domain.com" (the RFC 2822 addr-spec) for other addresses.
# "%u" provides just the user portion of the input, and "%d" provides
# just the hostname.

ldapaliases_query_filter = (maillocaladdress=%s)

# This parameter specifies the attribute returned by
# the search.
#
ldapaliases_result_attribute = maildrop

# The parameter specifies how to handle LDAP aliases. See the
# ldap_open(3) man page.
#
ldapaliases_dereference = 3

# The parameter specifies the timeout for LDAP database
# lookups.
#
ldapaliases_timeout = 10
#
ldapaliases_cache = yes

# The parameter specifies how many seconds
ldap_cache_size = 32768

2 comments: