for Exim4 and Courier IMAP configartion see the excelent installation guide: http://talk.trekweb.com/~jasonb/articles/exim_maildir_imap.shtml
1. Create the "vmail" group, virtual user and folders
groupadd -g 5000 vmail useradd -g vmail -u 5000 vmail -d /home/vmail -m
2. Create the users and mail directories in the "vmail" folder
mkdir /home/vmail/testuser.test maildirmake /home/vmail/testuser.test/Maildir(maildirmake comes with Courier)
-
Do this for every user and then if you are ready set the owner to "vmail" for all:
chown vmail:vmail -R /home/vmail3. Prepare the LDAP:
-
copy the qmail.schema (see: Exim4CourierSetupForOx%schema and
http://www.openldap.org/lists/openldap-software/200304/msg00418.html)
-
edit and add the line to /etc/ldap/slapd.conf
-
to /etc/ldap/schema/
include /etc/ldap/schema/qmail.schema
-
restart LDAP with
/etc/init.d/slapd restart
-
If you get an error in qmail.schema you dont have the right one
4. Prepare the LDAP directory for Courier. For every user do the followings (try to use phpldapadmin or an .ldif file):
-
add the objectClass "qmailUser" to uid=testuser.test,ou=Users,ou=OxObjects,dc=example,dc=org
-
add the new attribute "mailMessageStore" with the value: "/home/vmail/testuser.test/Maildir/" which
-
is the name of the future mailbox
5. Install Courier-LDAP if you don't have it:
apt-get install courier-ldap6. Configure Courier-IMAP to use the OX LDAP directory:
-
Edit the file /etc/courier-imap/authldaprc and modify on the following way:
LDAP_SERVER localhost
LDAP_PORT 389
LDAP_PROTOCOL_VERSION 3
LDAP_BASEDN ou=Users,ou=OxObjects,dc=example,dc=org
LDAP_BINDDN uid=mailadmin,dc=example,dc=org
LDAP_BINDPW mailadmin-password
LDAP_TIMEOUT 5
LDAP_AUTHBIND 1
LDAP_MAIL uid
LDAP_FILTER (&(objectClass=OxUserObject)(mailEnabled=OK))
LDAP_GLOB_UID 5000
LDAP_GLOB_GID 5000
LDAP_HOMEDIR mailMessageStore
LDAP_MAILDIR mailMessageStore
LDAP_FULLNAME cn
LDAP_CRYPTPW userPassword
LDAP_DEREF never
LDAP_TLS 0
-
Edit the file /etc/courier-imap/authdaemonrc and modify to:
authmodulelist="authldap authpam"Notice that if the LDAP authentication fails it falls back to PAM.
-
Restart authdaemon by
/etc/init.d/courier-authdaemon restart
-
Test now and try to log in into webmail with the username and password set for the OX account in the
-
LDAP directory. At this point the IMAP part should work now and webmail should show your inbox.
7. Configure Exim4 SMTP to use the OX LDAP directory:
-
You have to make sure you installed the exim4-daemon-heavy and not the exim4-daemon-light
-
Create a new file /etc/exim4/conf.d/router/450_exim4-config_ldap with the following content:
-
(if you don't split your config file just write it to the router section)
ldap_lookup:
debug_print = "R: ldap_lookup for $local_part@$domain"
driver = redirect
allow_fail
allow_defer
user = vmail
group = vmail
file_transport = address_file
pipe_transport = address_pipe
directory_transport = address_directory
data = ${extract{1}{\n}{ \
${lookup ldap \
{user="uid=mailadmin,dc=example,dc=org" pass=mailadmin-password \
ldap://localhost/uid=${local_part},ou=Users,ou=OxObjects,dc=example,dc=org?mailMessageStore?sub}} }}
-
The mailadmin-password works errorfree only if it is a plaintext password and we could not make him to pass a password to the directory like: pass="{CRYPT}xyz" If somebody knows a solution please let us know !!!
-
If you don't have /etc/exim4/conf.d/transport/30_exim4-config_address_directory create it and write into it:
-
(if you don't split your config file just write it to the transport section)
address_directory:
debug_print = "T: address_directory for $local_part@$domain"
driver = appendfile
envelope_to_add = true
return_path_add = true
check_string = ""
escape_string = ""
maildir_format
-
Make exim4 to reload his new configurations:
update-exim4.conf kill -HUP `pidof exim4`
-
Test if everything is ok with exim4:
exim4 -bt testuser.test
And test webmail now if it works and sends and receives emails! Good luck :))) AktuelleÄnderungen AktuelleÄnderungen
