OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: [Fwd: ldap users & aliases config]

From: Wojtek Bogusz (WojtekFrontLineDefenders.org)
Date: Thu May 08 2008 - 09:47:12 CDT


thank you for reply.

$ sudo postconf -n
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
inet_interfaces = all
mailbox_command = /usr/local/libexec/dovecot/deliver
mailbox_size_limit = 0
mydestination = frontlinedefeders.org, base.localhost, base, localhost
myhostname = base
mynetworks = 127.0.0.0/8,192.168.0.0/28
myorigin = "frontlinedefenders.org"
recipient_delimiter = +
relayhost = mail.localhost
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
virtual_alias_maps = ldap:/etc/postfix/ldap-aliases.cf, hash:/etc/aliases
virtual_gid_maps = static:33
virtual_mailbox_base = /home/vmail/domains
virtual_mailbox_domains = frontlinedefenders.org
virtual_mailbox_maps = ldap:/etc/postfix/ldap-accounts.cf
virtual_minimum_uid = 30000
virtual_transport = dovecot
virtual_uid_maps = static:30000

$ cat /etc/postfix/ldap-accounts.cf
server_host = localhost
search_base = ou=Users,dc=frontline
query_filter = (&(objectClass=posixAccount)(uid=%u))
result_attribute = uid
bind = no
version = 3

$ cat /etc/postfix/ldap-aliases.cf
server_host = localhost
search_base = ou=EmailAliases,dc=frontline
query_filter = (&(objectClass=inetOrgPerson)(sn=%u))
result_attribute = cn
bind = no
version = 3

output from

$ sudo postmap -q wojtekboguszfrontlinedefenders.org
ldap:/etc/postfix/ldap-aliases.cf
$ sudo postmap -q wojtekbogusz ldap:/etc/postfix/ldap-aliases.cf

is nothing... and smtp still rejects the address (any address admin,
adminfrontlinedefenders.org, wojtekbogusz,
wojtekboguszfrontlinedefenders.org, etc.)

cheers, Wojtek

Brian Evans wrote:
> Wojtek Bogusz wrote:
>> dear postfix'ers, please help. i cannot find the solution to my
>> problem. i do not understand what am i doing wrong. Wojtek
>>
>> -------- Original Message --------
>> Subject: ldap users & aliases config
>> Date: Fri, 02 May 2008 17:18:45 +0100
>> From: Wojtek Bogusz <WojtekFrontLineDefenders.org>
>> To: postfix-userspostfix.org
>>
>> hi. i am looking for help in setting up users and aliases in ldap for
>> postfix. i am running on Ubuntu 7.10 with postfix 2.3.8-2
>>
>> in main.cf i defined source for user accounts as:
>>
>> accounts_server_host = localhost
>> accounts_search_base = ou=Users,dc=frontline
>> accounts_query_filter = (&(objectClass=posixAccount)(uid=%u))
>> accounts_result_attribute = uid
>> accounts_bind = no
>> virtual_transport = dovecot
>> virtual_mailbox_base = /home/vmail/domains
>> virtual_mailbox_maps = ldap:accounts
>> virtual_mailbox_domains = frontlinedefenders.org
>> virtual_domain = frontlinedefenders.org
>> virtual_minimum_uid = 30000
>> virtual_uid_maps = static:30000
>> virtual_gid_maps = static:33
>>
>> and source for user aliases as:
>> aliases_server_host = localhost
>> aliases_search_base = ou=EmailAliases,dc=frontline
>> aliases_query_filter = (&(objectClass=inetOrgPerson)(sn=%u))
>> aliases_result_attribute = cn
>> aliases_bind = no
>> virtual_alias_maps = ldap:aliases, hash:/etc/aliases
> I hope these are not the same files. Be more specific with paths to
> avoid confusion.
>
>>
>> i defined ou=EmailAliases,dc=frontline records as inetOrgPerson class
>> type. so i have as 'cn' a user name (eg. 'wojtek') and as 'sn' different
>> aliases for this user name (eg. 'wojtekbogusz', 'admin', ...). so for
>> example you can do anonymous ldapsearch like this from command line:
>>
>> $ ldapsearch -b 'ou=EmailAliases,dc=frontline' -x 'sn=admin' cn
>> # extended LDIF
>> #
>> # LDAPv3
>> # base <ou=EmailAliases,dc=frontline> with scope subtree
>> # filter: sn=admin
>> # requesting: cn
>> #
>>
>> # wojtek, EmailAliases, frontline
>> dn: cn=wojtek,ou=EmailAliases,dc=frontline
>>
>> # john, EmailAliases, frontline
>> dn: cn=john,ou=EmailAliases,dc=frontline
>>
>> # search result
>> search: 2
>> result: 0 Success
>>
>> # numResponses: 3
>> # numEntries: 2
>>
>>
>> i was trying to debug ldap by specifying 'loglevel acl filter' in
>> /etc/ldap/slapd.conf. but most bizarre is that when i am feeding postfix
>> by hand over smtp and give 'rcpt to:
>> wojtekboguszfrontlinedefenders.org'. 'wojtekbogusz' does not appear in
>> the /var/log/syslog (or debug or mail.info) at all. i can see a lot of
>> activity, looking through the entries in ldap but nothing corresponding
>> to query_filer specified above '(&(objectClass=inetOrgPerson)(sn=%u))' -
>> where i believe %u should be set to 'wojtekbogusz'........?
>
> Show 'postconf -n'. Show result of 'postmap -q
> wojtekboguszfrontlinedefenders.org ldap:/path/to/aliases'
> Logging can be done in other places too (mail.warn, maillog, mail.err,
> etc.) depending on how your syslogger is setup.
>
> Brian
>>
>> i do not understand this all and i am a bit crossed :-)
>> can anybody advice please?
>>
>> best regards, Wojtek
>>
>>