Vpopmail with MySQL support:

šŸ“Note: vpopmail assumes that Qmail is installed in /var/qmail.

QMR provides vpopmail-5.4.13.tar.gz QMR package. Whereas latest is 5.4.27, on the Vpopmail download site:

http://sourceforge.net/project/showfiles.php?group\_id=85937

Download this new version:

cd /downloads/qmailnew

wget http://internap.dl.sourceforge.net/sourceforge/vpopmail/vpopmail-5.4.27.tar.bz2

tar xjf vpopmail-5.4.27.tar.bz2

cd /downloads/qmailnew/vpopmail-5.4.27

Letā€™s do the preparation first. We already have created a user vpopmail and group vchkpw earlier. If not, create them now:

groupadd -g 702 vchkpw

useradd -u 708 -g vchkpw -d /home/vpopmail -s /sbin/nologin -p '\*' vpopmail
mkdir ~vpopmail/etc

chown vpopmail:vchkpw ~vpopmail/etc

echo "localhost|0|vpopmailuser|redhat|vpopmail" > ~vpopmail/etc/vpopmail.mysql

chown vpopmail.vchkpw ~vpopmail/etc/vpopmail.mysql

chmod 640 ~vpopmail/etc/vpopmail.mysql

The echo command above specifies the following pieces of information:-

Server, where DB is hosted: localhost

Mysql listening on port : 0 (If MySQL runs on localhost, on default 3306. Any non-standard port must be mentioned, instead of 0).

Name of database : vpopmail

Username for the database : vpopmailuser

Password for this DB user: redhat

Create vpopmail Database:

mysql -u root -p

CREATE DATABASE vpopmail;

GRANT all ON vpopmail.\* TO vpopmailuser@localhost IDENTIFIED BY 'redhat';

flush privileges;

quit;

Make sure you connect successfully:

mysql -u vpopmailuser -D vpopmail -predhat

Configure and compile:

cd /downloads/qmailnew/vpopmail-5.4.27

āš ļøWarning: Donā€™t use the configure / compile options mentioned in QMR Guide ,which are:

./configure ā€“enable-logging=p ā€“enable-auth-module=mysql

--disable-passwd ā€“enable-clear-passwd

--disable-many-domains ā€“enable-auth-logging ā€“enable-sql-logging

--enable-valias ā€“disable-mysql-limits

Instead, use the following to compile Vpopmail :-

./configure ā€“enable-logging=p

--enable-auth-module=mysql ā€“disable-clear-passwd

--enable-many-domains

--enable-sql-logging ā€“enable-mysql-replication

--disable-roaming-users

--enable-libdir=/usr/lib64/mysql

šŸ“Note: Use ā€œā€“enable-libdir=/usr/lib64/mysqlā€ only on 64 bit systems. Not needed on 32 bit systems. And if not provided on 64 bit system, you will get errors during make.

These options are explained in the doc files which come with the vpopmail package. Also on http://www.qmailwiki.org/Vpopmail#Getting_started

--enable-vpopuser=USER OS User name allocated to vpopmail vpopmail.

--enable-vpopgroup=GROUP Group name allocated to vpopmail vchkpw.

--enable-roaming-users Enable POP-before-SMTP functionality.

--disable-clear-passwd Donā€™t store a cleartext version of the password in addition to the encrypted version.

--enable-spamassassin Enable spamassassin. See README.spamassassin for more info.

--enable-libdir=DIR Your MySQL/Oracle ā€˜libā€™ directory.

--enable-auth-module=MOD Nominate how to store the vpopmail account information (cdb (default), mysql, pgsql, ldap, oracle, sybase, or activedir).

--enable-logging=OPT Log to syslog: n=nothing, e=errors only (default), y=all attempts, p=errors with passwords, v=verbose (all attempts, withpasswords).

--enable-log-name=TEXT Set syslog name vpopmail.

--disable-auth-logging Donā€™t record time and ip of last auth attempt. Valid only for CDB, MySQL, PGSQL, LDAP, ActiveDir.

--enable-sql-logging Enable authentication logging to MySQL/Postgres.

--enable-mysql-limits Use MySQL to store limits instead of .qmailadmin-limits files.

--enable-mysql-replication Enable support for replicated MySQL auth servers.

--enable-valias Store email aliases in MySQL.

--disable-many-domains Creates a table for each virtual domain instead of storing all users in a single table. Only valid for MySQL and PostgreSQL.

--enable-many-domains Creates one large table for all virtual domains.Only valid for MySQL and PostgreSQL.

A note from the vpopmail author:

ā€œI used to recommend the ā€“disable-many-domains switch ā€“ which tells vpopmail to create one MySQL table per email domain. When I first started building vpopmail servers, I found this to be the most logical way, having each domain in its own table. However there has been some discussion about this config option on the vpopmail mailing lists, and it sound like this option may be removed at some point in the future. If you have a lot of domains on your server, having each domain in its own table can hurt performance. I now agree that ā€“enable-many-domains is probably the better choice.ā€

Also note that SMTP-AUTH is preferred over ā€œPOP before SMTPā€ (a.k.a Roaming users). So we used disable-roaming-users.

Enabling the ā€œā€“enable-spamassassinā€ also depends on your requirements. If I want to control anti-spam through SpamAssassin, server wide, ā€œnotā€ on individual user level, I would not use ā€œā€“enable-spamassassinā€.

So, coming back to the configuration and compilation steps again:

./configure ā€“enable-logging=p ā€“enable-auth-module=mysql

--disable-clear-passwd

--enable-many-domains

--enable-sql-logging ā€“enable-mysql-replication

--disable-roaming-users

--enable-libdir=/usr/lib64/mysql

ā€¦

ā€¦

config.status: creating Makefile

config.status: creating config.h

config.status: executing depfiles commands
vpopmail 5.4.27

Current settings


vpopmail directory = /home/vpopmail

domains directory = /home/vpopmail/domains

uid = 708

gid = 702

roaming users = OFF ā€“enable-roaming-users

tcpserver file = /home/vpopmail/etc/tcp.smtp

open_smtp file = /home/vpopmail/etc/open-smtp

rebuild tcpserver file = ON ā€“enable-rebuild-tcpserver-file (default)

password learning = OFF ā€“disable-learn-passwords (default)

md5 passwords = ON ā€“enable-md5-passwords (default)

file locking = ON ā€“enable-file-locking (default)

vdelivermail fsync = OFF ā€“disable-file-sync (default)

make seekable = ON ā€“enable-make-seekable (default)

clear passwd = OFF ā€“disable-clear-passwd

user dir hashing = ON ā€“enable-users-big-dir (default)

address extensions = OFF ā€“disable-qmail-ext (default)

ip alias = OFF ā€“disable-ip-alias-domains (default)

onchange script = OFF ā€“disable-onchange-script (default)

auth module = mysql ā€“enable-auth-module=mysql

mysql replication = ON ā€“enable-mysql-replication

sql logging = ON ā€“enable-sql-logging

mysql limits = OFF ā€“disable-mysql-limits

SQL valias table = OFF ā€“disable-valias

auth inc = -I/usr/include/mysq

auth lib = -Xlinker -R -Xlinker /usr/lib/mysql -L/usr/lib/mysql -lmysqlclient -lz -lm

system passwords = OFF ā€“disable-passwd (default)

pop syslog = show failed attempts with clear text password ā€“enable-logging=p

auth logging = ON ā€“enable-auth-logging (default)

Many domains per SQL table = ā€“enable-many-domains

spamassassin = OFF ā€“disable-spamassassin

maildrop = OFF ā€“disable-maildrop (default)
[root@www vpopmail-5.4.27]#

Now compile it:

[root@www vpopmail-5.4.27]# make && make install-strip

ā€¦

ā€¦

/usr/bin/install -c -o vpopmail -m 711 -g vchkpw -s ā€˜vpopmaildā€™ ā€˜/home/vpopmail/bin/vpopmaildā€™

/usr/bin/install -c -o vpopmail -m 711 -g vchkpw -s ā€˜vlistā€™ ā€˜/home/vpopmail/bin/vlistā€™

/usr/bin/install -c -o vpopmail -m 711 -g vchkpw -s ā€˜authvchkpwā€™ ā€˜/home/vpopmail/bin/authvchkpwā€™

make[3]: Leaving directory `/downloads/qmailnew/vpopmail-5.4.27ā€™

make[2]: Leaving directory `/downloads/qmailnew/vpopmail-5.4.27ā€™

make[1]: Leaving directory `/downloads/qmailnew/vpopmail-5.4.27ā€™

āš ļøWARNING:

Do not use the ā€œā€“enable-maildropā€ switch in vpopmail, otherwise you will not get any mails, and will get the following ā€œUnable to open mailboxā€ errors in the /var/log/maillog: May 9 20:04:07 www spamd[31043]: spamd: clean message (-1.4/5.0) for kamran@wbitt.com:711 in 1.3 seconds, 934 bytes.

May 9 20:04:07 www spamd[31043]: spamd: result: . -1 - ALL_TRUSTED scantime=1.3,size=934,user=kamran@wbitt.com,uid=711,required_score=5.0,rhost=localhost.localdomain,raddr=127.0.0.1,rport=54894,mid=51830.203.82.59.56.1210345345.squirrel@72.51.42.23,autolearn=unavailable,shortcircuit=no

May 9 20:04:07 www spamd[31040]: prefork: child states: II

May 9 20:04:07 www maildrop[19011]: Unable to open mailbox.