QMail HOWTO
Copyright 2000, 2001, 2002 by Oliver Lehman
Translation 2002 by Steven N. Fettig
Modified: 6 August 2002 - Steven N. Fettig
Modified: 25 November 2002 - Steven N. Fettig
Modified: 21 January 2003 - Steven N. Fettig
The following HOWTO is provided for the installation of an email server. POP3, POP3 over ssl, IMAP4, and IMAP4 over ssl are the different service configurations in this document. Mail transport is done using SMTP. The authentication for the roaming use of SMTP is taken care of through a preauthorization check done when one authenticates via IMAP4 or POP3. It is assumed that for the purposes of the installation, one is using a current version of FreeBSD.
(Translators note: The translation of this document is more of a "recreation" of the original, not a true translation. It would have taken me much more time to use the exact language structure that Oliver Lehman has used, and I decided that the better purpose of this document would be to give non-German speaking peoples the opportunity to take a look at this wonderful HOWTO in English. So, this is a Steve-ization of Oliver's original writings and I offer my apologies where I have butchered his original document. I only hope to make this thorough and as close as possible to his original, but offer no promises ;) . I will also offer some personal notes, as I have found some issues with the setup of some services. Those notes will be in itallics and enclosed by [ ] brackets.)
This HOWTO was written with great care, however, there may be errors in the following document. I cannot be responsible for erroneous directions and their results and will not be held to any judicial proceedings. I am thankful for any suggestions or corrections.
Chapter 1. Installation of the Required Programs
1.1 Qmail
1.2 ucspi-tcp
1.3 daemontools
1.4 vpopmail
1.5 courier-imap
1.6 courier-imap Hack
1.7 ezmlm-idx
1.8 autorespond
1.9 qmail-conf
We will now discuss the compiling and installation of the necessary programs. Most of these programs will be available through the Ports system and make this part of the document fairly short. In later sections of this document, we will make the use of shell variables discussed here.
SRC_PATH
This variable contains the path in which software that is not a port will be temporarily stored and compiled. Please pay attention to which partition this path is located and make sure that you have enough space and write privileges to that path.
If you are using the Bourne Shell, you can set this variable using:
export VARIABLE="value"
If you are using the C-Shell, you can set this variable using:
setenv VARIABLE "value"
1.1 Qmail
Qmail is the "main program." It will be responsible for the sending of outgoing and receipt and distribution of incoming mail.
cd /usr/ports/mail/qmail
make disable-sendmail
make enable-qmail -DWITH_BIG_TODO_PATCH
1.2 ucspi-tcp
With the help of ucspi-tcp, we can forgoe the use of the Internet Superserver (inetd) [which is often argued to be less secure than ucspi-tcp].
cd /usr/ports/sysutils/ucspi-tcp
make extract
cd work/
fetch http://www.qmail.org/ucspi-rss.diff
patch < ucspi-rss.diff
rm ucspi-rss.diff
cd ../
make install clean
The ucspi-tcp package does not install any man-pages itself. Gerrit Pape has made man-pages based upon the HTML documents from DJ Bernstein available.
cd $SRC_PATH
fetch ftp://ftp.innominate.org/pub/pape/djb/ucspi-tcp-0.88-man.tar.gz
tar -xzf ucspi-tcp-0.88-man.tar.gz
cd ucspi-tcp-0.88-man
gzip *.1 ; cp *.1.gz /usr/share/man/man1/
1.3 daemontools
In order to make the administration of the individual mail programs easier (POP3, SMTP, etc), daemontools will be used. In the case that a daemon/service is brought down or ended, daemontools will make sure that it is restarted within 5 seconds. (Thusly, killing your mail services would be senseless [- giving hackers no real victory if the services were brought down temporarily.])
cd /usr/ports/sysutils/daemontools
make all install clean
1.4 vpopmail
Vpopmail administers all of the domains and associated user accounts. [Vpopmail is what essentially allows you to set up mail services on one box for multiple virtual domains and allows for easy administration of user accounts, mailboxes, etc.]
cd /usr/ports/mail/vpopmail
make all install clean
1.5 courier-imap
Courier-IMAP allows for the installation of daemons for IMAP, IMAP over ssl and POP3 over ssl.
cd /usr/ports/mail/courier-imap
perl -pi -e 's/(disable-root-check)/$1 --without-authdaemon/' Makefile
make all install -DWITH_VPOPMAIL
cd work/courier-imap*/ &&
\
gmake install-configure
&& \
cd ../../
make clean
1.6 courier-imap Hack
Because the SMTP after IMAP4(s)/POP3(s) of courier-imap does not work, here is a small wrapper. This "hack" tracks the IP of the authenticating user and allows for SMTP sending (i.e. a form of authenticated SMTP relay).
cd $SRC_PATH
fetch http://www.pofo.de/HOWTO/qmail/files/open_relay.c
gcc -o open_relay open_relay.c `cat /usr/local/vpopmail/etc/*deps` -lcrypt
install -o root -g wheel -m 755 open_relay /usr/local/bin/
1.7 ezmlm-idx
The installation and use of mailing lists is made possible through ezmlm-idx.
cd /usr/ports/mail/ezmlm-idx
make all install clean
1.8 autorespond
Autorespond is, as the name implies, an autoresponder which allows an automatic return email to be sent to the original sender. [People often call this an "out of office" or "vacation message." If you plan on using a webmail interface, you should probably install an autoresponder, since I have found that many webmail interfaces require it's presence.]
cd $SRC_PATH
fetch http://www.inter7.com/devel/autorespond-2.0.2.tar.gz
tar -xzf autorespond-2.0.2.tar.gz
cd autorespond-2.0.2
perl -pi -e 's|INSTALL_GID = root|INSTALL_GID = wheel|g' Makefile
perl -pi -e 's|strcasestr|str_casestr|g' autorespond.c
make all install clean
1.9 qmail-conf
qmail-conf makes the configuration of the POP3d, SMTPd and other qmail delivery daemon startup scripts much easier. [This is another area that I highly recommend. I have tried creating my own, only to find that these configuration scripts are better and use the daemon startup methodology that DJ Bernstein recommends.]
cd $SRC_PATH
fetch http://www.din.or.jp/~ushijima/qmail-conf/qmail-conf-0.60.tar.gz
fetch http://cr.yp.to/djbdns/djbdns-1.05.tar.gz
tar -xzf qmail-conf-0.60.tar.gz
cd qmail-conf-0.60
tar -xzf ../djbdns-1.05.tar.gz
make -f Makefile.ini
make
make setup check
Comments (1)
in section 1.8 (autorespond) the following line "perl -pi -e 's|INSTALL_GID
= root|INSTALL_GID = wheel|g' Makefile" should be
" perl -pi -e 's|INSTALL_UID= root|INSTALL_GID = wheel|g' Makefile"
Posted by Calvin Smith | March 17, 2003 10:21 PM
Posted on March 17, 2003 22:21