Building an Advanced Mail Server
Pages: 1, 2
vpopmail
The wonderful folks over at Inter7 developed vpopmail to handle the management of virtual domains using Qmail. Unfortunately vpopmail is limited to a measly 23 million virtual hosts,
of which each are limited to only 23 million users. So if you have
more than 529 trillion users you may need to look elsewhere.
Creating the vpopmail User and Group
As noted in vpopmail's INSTALL file, "[the]
FreeBSD folks have reserved 89 for the group and 89 for the user for
vpopmail." You will probably want to ensure vpopmail
is running as uid and gid 89.
bash$ groupadd -g 89 vchkpw
bash$ useradd -g vchkpw -u 89 -d /path/to/where/you/want vpopmail
I installed vpopmail into /var/lib/vpopmail, but
you can put it wherever you wish. Just remember that all email messages will be
stored in /var/lib/vpopmail, so choose a partition with plenty of
room.
Setting up MySQL Support
The first thing you need to do is set up vpopmail for MySQL.
This is done by doing some light code editing in a header file. Fire up your
favorite editor. Open up the file vmysql.h and change the
following lines to match the configuration you set up in the MySQL section of
this article:
#define MYSQL_UPDATE_SERVER "localhost"
#define MYSQL_UPDATE_USER "vpopmail"
#define MYSQL_UPDATE_PASSWD "password"
#define MYSQL_READ_SERVER "localhost"
#define MYSQL_READ_USER "vpopmail"
#define MYSQL_READ_PASSWD "password"
Installing vpopmail
After you have finished editing vmysql.h, compile the program.
Be sure to run ./configure --help before configuring the software.
Below is what I used to enable MySQL support and install
vpopmail.
bash$ ./configure \
--enable-mysql=y
--enable-auth-logging=n
--enable-mysql-logging=n
--enable-logging=e
--enable-valias=y
--enable-passwd=n
--enable-defaultquota=15728640
--enable-roaming-users=y
There are a few things to note in the above configuration that you may want to change to suit your needs.
I disable
--enable-auth-loggingbecause SquirrelMail logs in and out every time a page is loaded, which can make logs grow quickly on active mail servers.The
eoption to--enable-loggingenables logging only of errors.--enable-defaultquotaThe default quota can be computed by using the equation (MB * 1024 * 1024) where MB is the number of megabytes you would like your default quota to be.You may need to specify the location of your MySQL include and library directories with
--enable-incdirand--enable-libdir.By disabling
/etc/passwdwith--enable-passwd=n, only virtual users will have access to our mail server.NFS users may wish to look at the
--enable-file-lockingand--enable-file-syncoptions. Because Qmail uses the alternative Maildir format to store messages, it works quite nicely with NFS.
After running the configure script, compile and install
vpopmail with the following commands:
bash$ make
bash$ make install-strip
Note: Debian has packages for vpopmail, however I could not
get them working properly with MySQL.
Creating Domains
Adding domains is extremely simple. Before you create a domain you will want
to read the man pages for vadddomain. There are options for mail
delivery, quotas, etc.
bash$ /path/to/vpopmail/bin/vadddomain example.com password
password is the password for postmaster@example.com, who will
be the administrator for that domain. After you have created the domain your
domain's user directories and .qmail files will exist in
/path/to/vpopmail/domains/example.com.
Adding Users
You can use either qmailadmin to create users or
vpopmail's vadduser.
bash$ /path/to/vpopmail/bin/vadduser username@example.com password
Courier IMAP
Courier IMAP is another piece of software by Inter7. It's a simple IMAP
server that was created specifically to work with Maildir. Read over the
INSTALL file before we get started to familiarize yourself with
the installation process.
bash$ ./configure \
--prefix=/usr/local/courier-imap \
--with-ssl \
--with-authvchkpw
bash$ make
bash$ make install
bash$ make install-configure
NOTE: --with-ssl is optional
Once you are done installing Courier IMAP, you need to edit a few
configuration options in its configuration file. Open
/usr/local/courier-imap/etc/imapd in your favorite editor and
change the following options.
editor's note: some of these options could use further explanation
Change
MAXDAEMONSto40.Raise
MAXPERIPto100. (Many users will be using the web interface, which all come from a single IP.)Change
TCPDOPTSto"-nodnslookup -noidentlookup -user=vpopmail -group=vchkpw".Change
AUTHMODULESto"authvchkpw"to usevpopmail's authentication.Change
IMAP_EMPTYTRASH=Trash:7,Sent:30to whatever you want. This option tells Courier to clear out these folders every 7 and 30 days, respectively. You can add extra folders there as well that you wish to have the server empty periodically.Change
IMAPDSTARTtoYES.
After you have all of this up and running, you should be ready to fire up
your IMAP server. To start Courier IMAP at boot, copy
/usr/local/src/courier-imap-1.7.x/courier-imap.sysvinit to the
directory appropriate for your distro (many use /etc/init.d).
bash$ cp /usr/local/src/courier-imap-1.7.x/courier-imap.sysvinit \
/etc/init.d/courier-imap
bash$ chmod 744 /etc/init.d/courier-imap
bash$ /etc/init.d/courier-imap start
qmailadmin
qmailadmin is a CGI interface to vpopmail. It is totally optional, but will make administering your virtual domains, users, forwards, etc. much easier. Not only does it allow your postmaster to create and manage accounts, forwards, and aliases, but it allows users to log in and change passwords, set vacation messages, etc.
Note: qmailadmin requires EZMLM, DJB's mailing list manager, which you may not wish to install. You can skip this step.
Installing autoresponder
autoresponder is a prerequisite of qmailadmin and does basic auto responding. After you have extracted the source, change into the package's directory.
bash$ make
bash$ make man
bash$ make setup
Installing EZMLM
EZMLM is DJB's mailing list software which works great with Qmail. EZMLM's main website has been down for quite some time. I suggest you grab the source from DJB's EZMLM page. You will most likely wish to patch EZMLM with the famous IDX patch which adds a plethora of options. I found a working mirror where you can download ezmlm-idx-0.40.tar.gz. After you have extracted both the EZMLM source and the IDX patch, install EZMLM.
bash$ mv ezmlm-idx-0.xx/* ezmlm-0.53/
bash$ cd ezmlm-0.53
bash$ patch < idx.patch
bash$ make mysql
bash$ make clean
bash$ make && make man
bash$ make setup
Installing qmailadmin
bash$ ./configure \
--enable-cgibindir=/path/to/your/cgi-bin
--with-htmllibdir=/path/to/your/html/docroot
--enable-imagedir=/path/to/your/images/directory
There are several options to look into if you plan to allow clients to
administer their own domains. --enable-maxpopusers and
--enable-maxmailinglists are just two of the options you may wish
to use. Be sure to check out ./configure --help for a complete
list of options.
bash$ make
bash$ make install-strip
After you have installed qmailadmin, you should be able to log
in to to http://example.com/cgi-bin/qmailadmin to administer your
domains.
Conclusion
Now that you have everything installed and have created your users, you
should be able to log in. Because vpopmail uses virtual hosts your
username will be username@example.com, which is important to
remember. Because of Qmail's flexibility and the power of
vpopmail's MySQL support you can easily create domains and hand
over the ability to manage accounts to your customers, which leaves plenty of
free time.
Now that your mail server is running the hard part is over, but it is not yet complete. The second part of our series will cover installing Apache+PHP and Squirrel Mail. We will also customize Squirrel Mail with a few plugins that will make managing your web mail system a lot easier. In the third and final part of our series, you will see how easy it is to integrate both virus and spam protection into your new mail server.
Joe Stump is the Lead Architect for Digg where he spends his time partitioning data, creating internal services, and ensuring the code frameworks are in working order.
Return to the Linux DevCenter.
You must be logged in to the O'Reilly Network to post a talkback.
Showing messages 1 through 31 of 31.
-
vmysql.h
2005-07-16 13:57:44 crashoverride? [Reply | View]
I can't find these file. I follow all. But now it didn't go. Please, I need support.
-
Problem with vpopmail make
2005-03-25 05:06:34 peecee [Reply | View]
I'm getting an error during make in vpopmail...
gcc -g -O2 -Wall -o vchkpw vchkpw.o md5.o hmac_md5.o libvpopmail.a -L/usr/lib/mysql -lmysqlclient -lz -lcrypt
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make[2]: *** [vchkpw] Error 1
make[2]: Leaving directory `/tmp/vpopmail-5.4.2'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/vpopmail-5.4.2'
make: *** [all] Error 2
My configure statement looks like this:
./configure \
--enable-auth-module=mysql \
--enable-incdir=/usr/include/mysql \
--enable-libdir=/usr/lib/mysql \
--enable-auth-logging=n \
--enable-mysql-logging=n \
--enable-logging=e \
--enable-valias=y \
--enable-passwd=n \
--enable-roaming-users=y
What am I missing? I'm running FC3, kernel 2.6.10-1.770. I've got mysql running and the mysql environment defined in ~vpopmail/etc/vpopmail.mysql (the define statements that were deprecated out of vmysql.h).
-
courier-imap compiling error
2004-09-09 13:00:45 Manis [Reply | View]
Hello
This is Manish.Well i installed vpopmail witt mysql and now i am not able to install courier-imap.I am getting courier-imap compiling error.Therefore Please give me the solution about this.
Eroor was as below:
Making check in authlib
make[1]: Entering directory
`/var/src/courier-imap-3.0.7/authlib'
make[1]: *** No rule to make target `check'. Stop.
make[1]: Leaving directory
`/var/src/courier-imap-3.0.7/authlib'
make: *** [check-recursive] Error 1
Steps
run as non root user as per the courier-imap docs
su - vpopmail
cd /var/src/
tar -jxvf /var/src/tar/tar/courier-imap-3.0.7.tar.bz2
cd /var/src/courier-imap-3.0.7/
export CFLAGS="-DHAVE_OPEN_SMTP_RELAY -DHAVE_VLOGAUTH"
./configure --prefix=/usr/local/courier-imap
--disable-root-check --without-authpam
--without-authldap --without-authpwd
--without-authmysql --without-authpgsql
--without-authshadow --without-authuserdb
--without-authcustom --without-authcram
--enable-workarounds-for-imap-clients-bugs
--with-authdaemon --without-ipv6 --with-authvchkpw
--with-ssl --with-redhat
make
Thanking you
Manish
-
smtp auth
2004-09-01 07:32:57 centyx [Reply | View]
Started qmail-smtpd per example in article. smtp authentication fails ( using login ). Username/password information for vpopmail is stored in a mysql database. Will vchkpwd with smtpd check this same database by default, or do I need to tell it to somehow? Suggestions welcome.
-
courier-imap
2004-07-18 03:54:49 Osiris [Reply | View]
Ok, trying with courier-imap-3.0.5.20040712, all clients just get disconnected with error: cant connect to server bla.bla.bla.
When I try to telnet to it on the imap port it answers with:
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2004 Double Precision, Inc. See COPYING for distribution information.
So I guess that part is right, maybe the ./configure line for useing vpopmail auth isnt correct for newever versions? or?
-
Make in vpopmail
2004-06-24 03:02:48 Osiris [Reply | View]
vauth.c:1334: warning: format argument is not a pointer (arg 3)
vauth.c: In function `valias_delete_domain':
vauth.c:1354: warning: format argument is not a pointer (arg 3)
vauth.c: In function `vcreate_valias_table':
vauth.c:1368: warning: format argument is not a pointer (arg 3)
vauth.c: In function `valias_select_all':
vauth.c:1386: warning: format argument is not a pointer (arg 3)
vauth.c:1390: warning: assignment makes pointer from integer without a cast
vauth.c: In function `valias_select_all_next':
-----------------
vauth.c:1397: subscripted value is neither array nor pointer
vauth.c:1397: subscripted value is neither array nor pointer
vauth.c:1397: subscripted value is neither array nor pointer
vauth.c:1398: subscripted value is neither array nor pointer
make[2]: *** [vauth.o] Error 1
make[2]: Leaving directory `/root/vpopmail-5.4.4'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/vpopmail-5.4.4'
make: *** [all] Error 2
and A LOT more when I try to do make.
did configure with the following line:
./configure --enable-auth-module=mysql --enable-incdir=/ --enable-libdir=/ --enable-auth-logging=n --enable-mysql-logging=n --enable-logging=e --enable-valias=y --enable-passwd=n --enable-roaming-users=y
any ideas?
-
Make in vpopmail
2005-01-02 20:46:08 fatlip [Reply | View]
you need to install mysql-server mysql-client AND mysql-devel
If you use the defaults, your --enable-incdir=/usr/include/mysql and your --enable-libdir=/usr/lib/mysql
without those being correct, vauth.c can't include the file mysql.h from /usr/include/mysql - and therefore all the functions referring to mysql will fail - obviously thats bad.
Good Luck
-
Help required for configuring email server
2004-01-22 01:25:38 pareshrshah [Reply | View]
Hi,
Here is something what I am looking for, I would be very thankful if you can help me out
following is installed at my server
Redhat Linux 7.0 server
MySQL 4.0.x
Apache 1.13
Perl 5.8
Sendmail 8.11
Jabber 1.4.2
What I want is to configure mail server such a way that any incoming emails
should be stored into database & not in /var/mail/username directory
As of not I am able to do it with a small perl script which I have downloaded
from Jabber Forum, which allows to store email into MySQL database.
but there are few problems like attachment not getting stored properly & other problems
I would like to know can you help me to configure email server which allows me to
play with emails before it is stored in the directory or database
for e.g. I would like to authenticate with some other parameters, send auto reply, invoke
some other process if to email id is matched, some thing extra.
Thanks for reading this mail
Regards
Paresh Shah
-
unable to read /etc/tcp.pop3.cdb
2003-11-18 07:25:15 anonymous2 [Reply | View]
I did all of the above with no problems except nothing seems to work. Qmail is running but when I do ps -ax I get somewhere along the way...
"readproctitle service errors: ..............."
But all the supervise scripts seem to be running.
I check my logs and get...
"Unable to read /etc/tcp.pop3.cdb: File does not exist"
And sure enough, it doesn't. Also, the /etc/tcp/smtp.cdb doesn't exist either. So I suspect it's a tcpserver issue but I don't know how to fix/troubleshoot it. Any ideas?
-
pop3d not working
2003-11-17 01:45:41 kzahradnik [Reply | View]
Hy,
I installed qmail and the whole lot. SMTP works, IMAP works also, but POP3 doesn't.
I get the following error message in /var/log/qmail/pop3d/current:
@400000003fb896e3274b8454 tcpserver: status: 1/30
@400000003fb896e3274b93f4 tcpserver: pid 7643 from 192.168.21.143
@400000003fb896e3274b97dc tcpserver: warning: dropping connection, unable to read /etc/tcp.pop3.cdb: protocol error
@400000003fb896e3274b9fac tcpserver: end 7643 status 28416
@400000003fb896e3274ba77c tcpserver: status: 0/30
Can anybody help me out? Goolge doesn't bring any results. I did check all the scripts, but nothing.
Thanks,
Klaus
-
I have this problem loggin in, using outlook express
2003-10-27 19:34:08 anonymous2 [Reply | View]
it tries to login, outlook gives me this error.
There was a problem logging onto your mail server. Your Password was rejected. Account: 'wardeb.no-ip.org', Server: 'wardeb.no-ip.org', Protocol: POP3, Server Response: '/var/lib/vpopmail/bin/vchkpw: error while loading shared libraries: libcrypto.so.0.9.7: failed to map segment from shared object: Cannot allocate memory', Port: 110, Secure(SSL): No, Server Error: 0x800CCC90, Error Number: 0x800CCC92
now, doesn't relaly tell you much , I checked google and only came up with there is some debian authentication problem here, then I checked my log's.
@400000003f9de18f0e8b695c tcpserver: status: 1/30
@400000003f9de18f0e8d3a34 tcpserver: pid 16647 from 10.10.26.75
@400000003f9de18f0e8fca74 tcpserver: ok 16647 <domain name server>:<IP Server>:110 :<IP client>::3193
@400000003f9de18f106a146c tcpserver: end 16647 status 256
@400000003f9de18f106a33ac tcpserver: status: 0/30
and taht doesn't really tell you much eitehr, anyone got any ideas?
-
the make for vpopmail
2003-10-23 00:31:51 anonymous2 [Reply | View]
I am using debian testing. :) having great success so far, except I am getting this error when trying to compile it.
In file included from vauth.c:32:
vmysql.h:25: error: syntax error before "MYSQL_UPDATE_SERVER"
In file included from vauth.c:32:
vmysql.h:53:22: missing terminating " character
vmysql.h:60:35: missing terminating " character
I know, syntax error, but I can find no fault with this file........
#ifndef VPOPMAIL_MYSQL_H
#define VPOPMAIL_MYSQL_H
/* Edit to match your set up */
define MYSQL_UPDATE_SERVER "localhost"
define MYSQL_UPDATE_USER "vpopmail"
define MYSQL_UPDATE_PASSWD "password"
define MYSQL_READ_SERVER "localhost"
define MYSQL_READ_USER "vpopmail"
define MYSQL_READ_PASSWD "password"
/* End of setup section*/
any idea's? I was thinking it was my myqsl setup.. but not sure.. :)
mail me at jurgenw@bluechipit.com.au thanks. -
the make for vpopmail
2003-10-23 07:30:52 joestump [Reply | View]
I had problems with that while installing recently as well. The way I fixed it (IIRC) was downgrading from gcc 3.3 to v3.0. Do do this go into /usr/bin and remove the links gcc and gccbug and relink them to gcc-3.0 and gccbug-3.0.
That should fix it. Remember to "make clean".
--Joe
-
the make for vpopmail
2003-10-23 05:27:48 anonymous2 [Reply | View]
ok, I worked out that first problem.. no worries. NOW, I get this.
wardeb:~/vpopmail-5.2.1# make
make all-recursive
make[1]: Entering directory `/root/vpopmail-5.2.1'
Making all in cdb
make[2]: Entering directory `/root/vpopmail-5.2.1/cdb'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/root/vpopmail-5.2.1/cdb'
make[2]: Entering directory `/root/vpopmail-5.2.1'
gcc -I. -I/usr/include/mysql -g -O2 -Wall -c vauth.c
In file included from vauth.c:32:
vmysql.h:53:22: missing terminating " character
vmysql.h:60:35: missing terminating " character
make[2]: *** [vauth.o] Error 1
make[2]: Leaving directory `/root/vpopmail-5.2.1'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/vpopmail-5.2.1'
make: *** [all-recursive-am] Error 2
wardeb:~/vpopmail-5.2.1#
any idea's... it say's it missing a terminating cahracter.. but, I ain't taht good at coding.. and I carn't see it. :\ -
the make for vpopmail
2003-10-28 11:58:47 anonymous2 [Reply | View]
In lines 54 and 58 of vmysql.h is the trailing \ missing
#define TABLE_LAYOUT "pw_name char(32) not null, \
pw_domain char(64) not null, <===== 54
pw_passwd char(40), \
pw_uid int, pw_gid int, \
pw_gecos char(48), \
pw_dir char(160), <===== 58
pw_shell char(20), \
primary key (pw_name, pw_domain ) "
Have a look at http://www.debianhowto.de for more details
-
pop3 and smtp
2003-10-09 11:06:46 anonymous2 [Reply | View]
I used REDHAT 9.0 and configured as shown above, and after successfully starting qmail i cannot still use smtp or pop3 ???
is there a step missing ???
-
Second and third part ??
2003-10-08 05:30:54 anonymous2 [Reply | View]
Can you please guide me if the second and third part of this document are out or not, and if yes please show me the links.
regards
-
I don't understand why you publish this???
2003-10-08 02:56:24 anonymous2 [Reply | View]
It doesn't new this was allredy done even script provided for automating :))
-
Slackware support??
2003-10-03 09:26:33 anonymous2 [Reply | View]
I'm reading this article and curious to know if anyone has tried this setup on the Slackware Linux distribution. Some of the scripts assume a RPM based system. -
Slackware support??
2003-10-14 11:09:43 anonymous2 [Reply | View]
I've similar 4 systems running over slackware and 1 running over openbsd .. so it seems to be supported ;)
btw, compiling certain pieces such as ucspi-tcp, daemontools and qmail on RH9 or glibc-2.3.x requires a errno-patch, which can be found on the web.
if not, contact me to pires@netual.pt
congrats by the wonderful article
-
I prefer dovecot to Courier IMAP
2003-10-01 20:27:28 anonymous2 [Reply | View]
http://dovecot.procontrol.fi/
More modular, secure, reliable design than Courier, better performance and much simpler configuration!
Share and enjoy,
*** Xanni ***
-
Red Hat and ALL RPM-based distros
2003-10-01 00:17:00 datavortex [Reply | View]
Check out http://www.qmailtoaster.com/ for ready-to-install source packages including:
qmail, vpopmail
daemontools
uscpi-tcp
ezmlm
qmailadmin
vqadmin
qmailmrtg
courier-imap
many extra paches
Plus walkthroughs for adding qmail-scanner, clam antivirus, TMDA (http://www.tmda.net/) spam control.
-
Redhat 9.0 will need important patches
2003-09-29 23:49:04 drunelson [Reply | View]
Redhat 9.0 uses a new version of the glibc.
The new version changes the way errors are
reported for threaded apps.
All of the DJB software will have to be patched
before it will compile properly.
You can find the patches at http://qmail.org/
which will point to: http://qmail.area.com/moni.csi.hu/pub/glibc-2.3.1/




