Exim LDAP

Da Emigar.
Jump to navigation Jump to search

Come configurare exim4 per utilizzare LDAP:

HOME_DIR=/var/mail/home
...

local_delivery:
driver = appendfile
delivery_date_add
envelope_to_add
return_path_add
maildir_format
create_directory
# can't have normal home directory as users don't have them
# and this driver does a chdir to $home
home_directory = HOME_DIR
directory = $home/$local_part/Maildir 



Configurazione per i mail alias. In LDAP creare gli alias nel seguente modo:

dn: cn=all-users,ou=Aliases,dc=RSPPG
cn: all-users
objectClass: nisMailAlias
objectClass: top
rfc822MailMember: user1
rfc822MailMember: user2
rfc822MailMember: user3
rfc822MailMember: user4

In exim.conf aggiungere un router per cercare gli indirizzi:

ldap_aliases:
driver = redirect
allow_fail
allow_defer
data = ${lookup ldap { \
                      user=LDAPU \
                      pass=LDAPP \
                      LDAPS\
                     rfc822mailMember?sub?(&(objectClass=nisMailAlias)(cn=${quote_ldap:$local_part}))}\
        {$value} fail}
file_transport = address_file
pipe_transport = address_pipe




Fonte: http://lists.exim.org/lurker/message/20040517.092129.6fe45085.en.html

http://www.wlug.org.nz/EximNotes


Alias

root@mail1:/etc/exim4/conf.d/router# more 450_exim4-config_ldap_aliases

# sono definite in /etc/exim4/exim4.conf.localmacros
# ma non funzionano. quindi le ho ridefinite qua
ALIAS_LDAPU = cn=exim-bind-user,dc=emigar,dc=it
ALIAS_LDAPP = <password>
ALIAS_LDAPS = ldap://localhost:389/
ALIAS=LDAPB = ou=aliases,dc=emigar,dc=it


#.ifdef LDAP_ALIASES
ldap_aliases:
  debug_print = "R: ldap_aliases for $local_part@$domain"
  driver = redirect
  domains = +local_domains
  allow_fail
  allow_defer
  data = ${lookup ldap { \
                        user=ALIAS_LDAPU \
                        pass=ALIAS_LDAPP \
                        ALIAS_LDAPS\
                        ALIAS_LDAPB\
                        ?rfc822mailMember?sub?(&(objectClass=nisMailAlias)(cn=${quote_ldap:$local_part}))}\
        {$value} fail}

#  data = ${lookup ldap {LDAP_ALIASES}{${local_part}@${domain}}{:fail: User unknown}}

#  file_transport = address_file
#  pipe_transport = address_pipe

#.endif


Utenti

root@mail1:/etc/exim4/conf.d/router# more 899_exim4-config_ldap_user

### router/899_exim4-config_ldap_user
#################################

# This router matches ldap user mailboxes.

#.ifdef LDAP_USERS

# sono definite in /etc/exim4/exim4.conf.localmacros
# ma non funzionano. quindi le ho ridefinite qua
USER_LDAPU = cn=exim-bind-user,dc=emigar,dc=it
USER_LDAPP = <password>
USER_LDAPS = ldap://localhost:389/
USER_LDAPB = dc=emigar,dc=it


ldap_user:
  debug_print = "R: ldap_user for $local_part@$domain"
  driver = accept
  domains = +local_domains
  condition = ${lookup ldap { \
                             user=USER_LDAPU \
                             pass=USER_LDAPP \
                             USER_LDAPS\
                             USER_LDAPB\
                             ?uid?sub?(&(objectClass=posixAccount)(uid=${quote_ldap:$local_part}))}}
# retry_use_local_part
 transport = dovecot_deliver

#.endif