Académique Documents
Professionnel Documents
Culture Documents
*** This is a basic installation of Qmail-LDAP and does not covers any antivirus/antispam
integration
Download directory :-
# cd /usr/local/src
Qmail - ftp://ftp.ntnu.no/pub/unix/mail/qmail/qmail-1.03.tar.gz
Qmail-conf – http://www.din.or.jp/~ushijima/qmail-conf/qmail-conf-
0.60.tar.gz
Djbdns - http://cr.yp.to/djbdns/djbdns-1.05.tar.gz
Daemontools - http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
UCSPI - http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz
Courier-Authlib -
http://nchc.dl.sourceforge.net/sourceforge/courier/courier-authlib-
0.60.2.tar.bz2
Courier-Imap – http://jaist.dl.sourceforge.net/sourceforge/courier/courier-
imap-4.3.0.tar.bz2
1. gcc
2. gcc++
3. openldap
4. openldap-devel
5. openldap-servers
6. httpd
7. httpd-devel
8. gamin
9. gamin-devel
10. postgresql-libs
11. libtool-ltdl
12. libtool-ltdl-devel
Note :- The above RPM’s might be having certain depencies, ensure that you install
each one of them.
UCSPI :-
# cd /usr/local/src
# cd ucspi-tcp-0.88
# vi error.h
Find this line: extern int errno;
Comment the line out, and add this new line below it:
/* extern int errno; */
#include <errno.h>
:wq
# make
# make setup check
Daemontools :-
# mkdir -p /package
# cd /package
# cd admin/daemontools-0.76/src
# vi error.h
Find this line: extern int errno;
Comment the line out, and add this new line below it:
/* extern int errno; */
#include <errno.h>
:wq
# cd ..
# package/install
Djbdns :-
# cd /usr/local/src
# cd djbdns-1.05
# vi error.h
Find this line: extern int errno;
Comment the line out, and add this new line below it:
/* extern int errno; */
#include <errno.h>
:wq
qmail-conf :-
# cd /usr/local/src
# cd qmail-conf-0.60
Qmail Configuration :-
Creating qmail users ~
# groupadd nofiles
# useradd -g nofiles -d /var/qmail/alias alias
# useradd -g nofiles -d /var/qmail qmaild
# useradd -g nofiles -d /var/qmail qmaill
# useradd -g nofiles -d /var/qmail qmailp
# groupadd qmail
# useradd -g qmail -d /var/qmail qmailq
# useradd -g qmail -d /var/qmail qmailr
# useradd -g qmail -d /var/qmail qmails
# mkdir /home/vmail
# chown -R vmail:vmail /home/vmail
# cd /usr/local/src
# cd qmail-1.03
Patching Qmail ~
# vi Makefile
# vi qmail-ldap.h
# cp qmail.schema /etc/openldap/schema/
Openldap Configuration :-
# slappasswd -h {md5}
New password:
Re-enter new password:
{MD5}72KZyef9rm13WBnOHiYguA==
# vi /etc/openldap/slapd.conf
include /etc/ldap/schema/qmail.schema
database bdb
suffix "dc=wipro,dc=com"
rootdn "cn=Manager,dc=wipro,dc=com"
rootpw {MD5}72KZyef9rm13WBnOHiYguA==
directory /var/lib/ldap
index objectClass eq
index mail,mailAlternateAddress,uid eq,sub
index accountStatus,mailHost,deliveryMode eq
index default sub
# vi /etc/openldap/create_dn.ldif
dn: dc=wipro,dc=com
objectclass: dcObject
objectclass: organization
o: wipro
dc: wipro
dn: cn=Manager,dc=wipro,dc=com
objectClass: organizationalRole
cn: Manager
# vi /etc/openldap/users.ldif
dn: ou=users,dc=wipro,dc=com
ou: users
objectclass: top
objectclass: organizationalUnit
dn: ou=groups,dc=wipro,dc=com
ou: groups
objectclass: top
objectclass: organizationalUnit
# vi /etc/openldap/postmaster-Abuse.ldif
dn: cn=Postmaster,ou=users,dc=wipro,dc=com
cn: Postmaster
ou: users
sn: Postmaster
objectClass: top
objectClass: person
objectClass: inetOrgPerson
objectClass: qmailUser
mail: postmaster@wipro.com
mailHost: server.wipro.com
mailQuotaSize: 0
mailQuotaCount: 0
uid: postmaster
accountStatus: active
mailMessageStore: postmaster
userPassword: {MD5}JQ9g7OhNwTK81ciA0aS3KQ==
dn: cn=Abuse,ou=users,dc=wipro,dc=com
cn: Abuse
ou: users
sn: Abuse
objectClass: top
objectClass: person
objectClass: inetOrgPerson
objectClass: qmailUser
mail: abuse@wipro.com
mailHost: server.wipro.com
mailQuotaSize: 0
mailQuotaCount: 0
uid: abuse
accountStatus: active
mailMessageStore: abuse
userPassword: {MD5}JQ9g7OhNwTK81ciA0aS3KQ==
# echo "mail.wipro.com">/var/qmail/control/me
# echo "0">/var/qmail/control/ldaplocaldelivery
# echo "0">/var/qmail/control/ldapcluster
# echo "10000000">/var/qmail/control/defaultquotasize
# echo "10000">/var/qmail/control/defaultquotacount
# echo "ldaponly">/var/qmail/control/ldapdefaultdotmode
# echo "/home/vmail">/var/qmail/control/ldapmessagestore
# echo "11184">/var/qmail/control/ldapuid
# echo "2110">/var/qmail/control/ldapgid
# echo "30">/var/qmail/control/ldaptimeout
# touch /var/qmail/control/rbllist
# echo "0.0.0.0">/var/qmail/control/outgoingip
# echo "./Maildir/">/var/qmail/control/defaultdelivery
#!/bin/sh
# Taken from LWQ by Dave Sill
# Using stdout for logging
# Using control/defaultdelivery from qmail-local to deliver messages by
default
exec env - PATH="/usr/local/bin:/var/qmail/bin:/bin" \
qmail-start ./Maildir/
qmail-delivery service ~
# ln -s /var/qmail/service/qmail /service
# svstat /service/qmail
qmail-smtpd service ~
# ln -s /var/qmail/service/smtpd /service
# svstat /service/smtpd
# cd /service/smtpd/
# vi tcp
127.:allow,RELAYCLIENT=""
192.168.1.:allow,RELAYCLIENT=""
:allow
# make
# vi /var/qmail/bin/dirmaker.sh
#!/bin/sh
/bin/mkdir -m 700 -p $1/Maildir
/bin/mkdir -m 700 -p $1/Maildir/new
/bin/mkdir -m 700 -p $1/Maildir/cur
/bin/mkdir -m 700 -p $1/Maildir/tmp
# chmod +x /var/qmail/bin/dirmaker.sh
POP Service ~
# cd /var/qmail/service/pop3d/
# vi tcp
127.:allow
OR
# make
# ln -s /var/qmail/service/pop3d /service
# tail -f /service/pop3d/log/main/current
COURIER-IMAP ~
# useradd Wipro
# su - Wipro
$ mkdir rpmbuild
$ cd rpmbuild
$ cd RPMS
$ cd ../SRPMS
$ cd $HOME
$ vi .rpmmacros
$ cd rpmbuild/SOURCES
# cp /usr/local/src/courier-authlib-0.60.2.tar.bz2 .
# cp /usr/local/src/courier-imap-4.3.0.tar.bz2 .
This will create the binary RPM in the respective Arch, become ROOT before installing
them ( 3 packages )
$ exit
# su - Wipro
$ cd rpmbuild/SOURCES
$ rpmbuild -ta courier-imap-4.3.0.tar.bz2
This might give dependency error such as , please identify and install them
postgresql-libs
libtool-ltdl-devel
gamin-devel
$ exit
# vi /etc/authlib/authdaemonrc
authmodulelist="authldap"
authmodulelistorig="authldap"
daemons=20
DEBUG_LOGIN=2
# /etc/authlib/authldaprc
LDAP_URI ldap://127.0.0.1 ldaps://127.0.0.1
LDAP_PROTOCOL_VERSION 3
LDAP_BASEDN dc=wipro, dc=com
LDAP_BINDDN cn=Manager, dc=wipro, dc=com
LDAP_BINDPW <secret>
LDAP_TIMEOUT 15
LDAP_MAIL mail
LDAP_FILTER (objectClass=qmailUser)(accountStatus=active)
LDAP_DOMAIN wipro.com
LDAP_GLOB_UID vmail
LDAP_GLOB_GID vmail
LDAP_HOMEDIR mailMessageStore
LDAP_MAILROOT /home/vmail
LDAP_DEFAULTDELIVERY defaultDelivery
LDAP_MAILDIRQUOTA quota
LDAP_FULLNAME cn
LDAP_CLEARPW clearPassword
LDAP_CRYPTPW userPassword
LDAP_DEREF never
# vi /usr/lib/courier-imap/etc/imapd
MAXDAEMONS=40
MAXPERIP=20
DEFDOMAIN="@wipro.com"
##IMAP_EMPTYTRASH=Trash:7
IMAPDSTART=YES
MAILDIRPATH=Maildir
# vi /usr/lib/courier-imap/etc/imapd-ssl
<< Same as above >>
# vi /usr/lib/courier-imap/etc/pop3d
POP3DSTART=NO
# vi /usr/lib/courier-imap/etc/pop3d-ssl
POP3DSSLSTART=NO
# /etc/init.d/courier-authlib restart
# /etc/init.d/courier-imap restart
# netstat –vatn
# telnet localhost 25
# telnet localhost 110
# telnet localhost 143
Note :- You are free to use PHP interface such as phpldapadmin etc. to manage
LDAP users or you can use shell script to add them. Use whatever way you are
comfortable.