Dear List,

I am using RHEL4 with postfix 2.2.10-1 and openldap 2.2.13-6. I have created
the ldap tree where I can search for the mail-id and get result:

ldapsearch  -x  mail=bo...@rpg.in responds as
# extended LDIF
#
# LDAPv3
# base <> with scope sub
# filter: mail=bo...@rpg.in
# requesting: ALL
#

# bonhi, rpg.in, rpg.orgn
dn: uid=bonhi,ou=rpg.in,dc=rpg,dc=orgn
uid: bonhi
cn: Bonhi  Sengupta
sn: bonhi
title: bonhi
homeDirectory: /home/vmail/rpg.in/bonhi
mailMessageStore: /home/vmail/rpg.in/bonhi/Maildir/
accountStatus: enable
loginShell: /sbin/nologin
uidNumber: 5000
gidNumber: 5000
objectClass: qmailUser
objectClass: posixAccount
objectClass: person
objectClass: shadowAccount
objectClass: organizationalPerson
mail: bo...@rpg.in
mail: bo...@rpgnet.com
mailQuotaSize: 52428800S
mailForwardingAddress: bo...@rpg.in

# search result
search: 2
result: 0 Success

# numResponses: 2
# numEntries: 1

But if I try to test the ldap lookup as being used in postfix then I don't
get any result. The command

postmap -v  -q bo...@rpg.in ldap:/etc/postfix/maps.ldap    returns

..... ..... .....

postmap: dict_ldap_open: /etc/postfix/maps.ldap server_host URL is
ldap://127.0.0.1:389
postmap: cfg_get_str: /etc/postfix/maps.ldap: scope = sub
postmap: cfg_get_str: /etc/postfix/maps.ldap: search_base =
ou=%d,dc=rpg,dc=orgn
postmap: cfg_get_str: /etc/postfix/maps.ldap: domain =
postmap: cfg_get_int: /etc/postfix/maps.ldap: timeout = 60
postmap: cfg_get_str: /etc/postfix/maps.ldap: query_filter = (&(mail=%s)
(accountStatus=active))
postmap: cfg_get_str: /etc/postfix/maps.ldap: result_format = <NULL>
postmap: cfg_get_str: /etc/postfix/maps.ldap: result_filter = %s
postmap: cfg_get_str: /etc/postfix/maps.ldap: result_attribute =
mailMessageStore
postmap: cfg_get_str: /etc/postfix/maps.ldap: special_result_attribute =
postmap: cfg_get_bool: /etc/postfix/maps.ldap: bind = on
postmap: cfg_get_str: /etc/postfix/maps.ldap: bind_dn =
postmap: cfg_get_str: /etc/postfix/maps.ldap: bind_pw =
postmap: cfg_get_bool: /etc/postfix/maps.ldap: cache = off
postmap: cfg_get_int: /etc/postfix/maps.ldap: cache_expiry = -1
postmap: cfg_get_int: /etc/postfix/maps.ldap: cache_size = -1
postmap: cfg_get_int: /etc/postfix/maps.ldap: recursion_limit = 1000
postmap: cfg_get_int: /etc/postfix/maps.ldap: expansion_limit = 0
postmap: cfg_get_int: /etc/postfix/maps.ldap: size_limit = 0
postmap: cfg_get_int: /etc/postfix/maps.ldap: dereference = 0
postmap: cfg_get_bool: /etc/postfix/maps.ldap: chase_referrals = off
postmap: cfg_get_bool: /etc/postfix/maps.ldap: start_tls = off
postmap: cfg_get_bool: /etc/postfix/maps.ldap: tls_require_cert = off
postmap: cfg_get_str: /etc/postfix/maps.ldap: tls_ca_cert_file =
postmap: cfg_get_str: /etc/postfix/maps.ldap: tls_ca_cert_dir =
postmap: cfg_get_str: /etc/postfix/maps.ldap: tls_cert =
postmap: cfg_get_str: /etc/postfix/maps.ldap: tls_key =
postmap: cfg_get_str: /etc/postfix/maps.ldap: tls_random_file =
postmap: cfg_get_str: /etc/postfix/maps.ldap: tls_cipher_suite =
postmap: cfg_get_int: /etc/postfix/maps.ldap: debuglevel = 0
postmap: dict_open: ldap:/etc/postfix/maps.ldap
postmap: dict_ldap_lookup: In dict_ldap_lookup
postmap: dict_ldap_lookup: No existing connection for LDAP source
/etc/postfix/maps.ldap, reopening
postmap: dict_ldap_connect: Connecting to server ldap://127.0.0.1:389
postmap: dict_ldap_connect: Actual Protocol version used is 2.
postmap: dict_ldap_connect: Binding to server ldap://127.0.0.1:389 as dn
postmap: dict_ldap_connect: Successful bind to server ldap://127.0.0.1:389
as
postmap: dict_ldap_connect: Cached connection handle for LDAP source
/etc/postfix/maps.ldap
postmap: dict_ldap_lookup: /etc/postfix/maps.ldap: Searching with filter
(&(mail=bo...@rpg.in) (accountStatus=active))
postmap: dict_ldap_get_values[1]: Search found 0 match(es)
postmap: dict_ldap_get_values[1]: Leaving dict_ldap_get_values
postmap: dict_ldap_lookup: Search returned nothing
postmap: dict_ldap_close: Closed connection handle for LDAP source
/etc/postfix/maps.ldap

The content of the /etc/postfix/maps.ldap is

[r...@mail postfix]# cat maps.ldap
timeout = 60
server_host = 127.0.0.1
server_port = 389
search_base = ou=%d,dc=rpg,dc=orgn
query_filter = (&(mail=%s) (accountStatus=active))
result_attribute = mailMessageStore

In the search_base if I don't use the ou=%d then also I get the same result.
My postconf -d look like this:

alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
broken_sasl_auth_clients = yes
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
default_destination_recipient_limit = 200
default_privs = vmail
default_process_limit = 105
disable_vrfy_command = yes
fallback_transport = virtual
home_mailbox = Maildir/
inet_interfaces = all
ipc_timeout = 5000s
local_transport = maildrop
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
message_size_limit = 25728640
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
rpgnet.com
mydomain = rpg.in
myhostname = mail.rpg.in
mynetworks = 127.0.0.0/8, 10.50.0.0/16
mynetworks_style = subnet
myorigin = $mydomain
newaliases_path = /usr/bin/newaliases.postfix
queue_directory = /var/spool/postfix
rbl_reply_maps = hash:/etc/postfix/imss_rbl_reply
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtpd_banner = $myhostname ESMTP $mail_name
smtpd_client_restrictions = check_sender_access
hash:/etc/postfix/rbl_sender_exception,reject_rbl_client
ASNQWAVAPX7S683TZDZFBFUVXP56QLC.r.mail-abuse.com,reject_rbl_client
ASNQWAVAPX7S683TZDZFBFUVXP56QLC.q.mail-abuse.com
smtpd_helo_required = yes
smtpd_recipient_limit = 250
smtpd_recipient_restrictions = permit_mynetworks,
permit_auth_destination,         permit_sasl_authenticated,         reject
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
smtpd_sender_restrictions = permit_mynetworks,
reject_unknown_sender_domain,        permit_sasl_authenticated
smtpd_tls_auth_only = no
soft_bounce = no
transport_maps = hash:/etc/postfix/transport
unknown_local_recipient_reject_code = 550
virtual_alias_maps = ldap:forward
virtual_gid_maps = static:5000
virtual_mailbox_base = /home/vmail
virtual_mailbox_domains = cpl.in
virtual_mailbox_maps = ldap:/etc/postfix/maps.ldap
virtual_minimum_uid = 5000
virtual_uid_maps = static:5000

Will someone kindly point out the mistakes that I am making? My intention is
to run postfix to work as a mail server of multiple domains while the userid
within a domain will be unique but the same user name can exist in both the
domains. But the mail store will be separate for each domains.

With regards,

Goutam



Reply via email to