| < Free Open Study > |
|
Vpopmail is another popular virtual domain add-on package for qmail. Like VMailMgr, it includes a set of utilities for managing virtual domains with virtual users. The core utilities are:
vchkpw, an authentication module for qmail-pop3d
vdelivermail, a Message Delivery Agent (MDA) that delivers mail to mail-boxes belonging to virtual users
vadddomain, a utility for setting up a new virtual domain
vadduser, a utility for adding a new virtual user to a virtual domain
More information about Vpopmail is available on the Web (http://www.inter7.com/vpopmail/).
qmail must be installed before Vpopmail can be set up:
Create the vpopmail user and vchkpw group. Use UID and group ID (GID) 89 if they're not already in use. For example:
$ su root Password: rootpassword # groupadd -g 89 vchkpw # useradd -g vchkpw -u 89 vpopmail #
Create a Simple Mail Transfer Protocol (SMTP) access control file under the home directory of vpopmail:
# mkdir ~vpopmail/etc # echo 127.0.0.:allow,RELAYCLIENT=\"\" > ~vpopmail/etc/tcp.smtp #
Download the source tarball. At the time of this writing, the current stable release is 4.9.10. Use your favorite Web browser or the wget utility, if it's installed on your system:
# exit $ cd /usr/local/src $ wget http://www.inter7.com/vpopmail/vpopmail-4.9.10.tar.gz —10:36:19— http://www.inter7.com/vpopmail/vpopmail-4.9.10.tar.gz => `vpopmail-4.9.10.tar.gz' Connecting to www.inter7.com:80. . . connected! HTTP request sent, awaiting response. . . 200 OK Length: 175,545 [application/x-tar] 0K ->.......... .......... .......... .......... .......... .......... [ 29%] 50K ->.......... .......... .......... .......... .......... .......... [ 58%] 100K ->.......... .......... .......... .......... .......... .......... [ 87%] 150K ->.......... .......... .......... .......... .......... .......... [100%] 10:37:30 (2.48 KB/s) - `vpopmail-4.9.10.tar.gz' saved [175545/175545] $
Unpack the source tarball:
$ zcat vpopmail-4.9.10.tar.gz |tar xf - $
Configure the build:
$ cd vpopmail-4.9.10 $ su Password: rootpassword # ./configure —enable-roaming-users=y creating cache ./config.cache checking for a BSD compatible install... /usr/bin/install -c checking whether build environment is sane... yes ...lots of output ending with something like: auth logging = OFF pop syslog = show only failure attempts default domain = # exit $
The —enable-roaming-users=y option allows virtual users to relay after authenticating via the POP3 server. If you don't want this feature, leave off this option.
Make the binaries:
$ make make all-recursive make[1]: Entering directory `/usr/local/src/vpopmail-4.9.10' Making all in cdb ...lots of output ending with something like: gcc -g -O2 -Wall -o vipmap vipmap.o libvpopmail.a -lnsl -lcrypt make[2]: Leaving directory `/usr/local/src/vpopmail-4.9.10' make[1]: Leaving directory `/usr/local/src/vpopmail-4.9.10' $
Install the binaries:
$ su root Password: rootpassword # make install-strip make AM_INSTALL_PROGRAM_FLAGS=-s install make[1]: Entering directory `/usr/local/src/vpopmail-4.9.10' Making install in cdb ...lots of output ending with something like: make[3]: Leaving directory `/usr/local/src/vpopmail-4.9.10' make[2]: Leaving directory `/usr/local/src/vpopmail-4.9.10' make[1]: Leaving directory `/usr/local/src/vpopmail-4.9.10' #
Add crontab entry for roaming user support:
# crontab -e add a line like the following: 40 * * * * /home/vpopmail/bin/clearopensmtp 2>&1 /dev/null
where /home/vpopmail is the home directory of the vpopmail user. See /etc/passwd if you're not sure where this is.
Vpopmail is now installed. Now add a virtual domain; in this example you'll use virtual.example.com.
Note | A DNS record—preferably an MX record—must be set up to direct mail for the virtual domain to the system hosting the virtual domain. The details are beyond the scope of this book and are highly dependent upon the DNS software in use. |
Create the virtual domain:
# cd /home/vpopmail/bin # ./vadddomain virtual.example.com Please enter password for postmaster: somepassword enter password again: somepassword #
This updates the following control files:
/var/qmail/control/locals /var/qmail/control/rcpthosts /var/qmail/control/morercpthosts (if rcpthosts is over 50 lines) /var/qmail/control/virtualdomains /var/qmail/users/assign /var/qmail/users/cdb
It also sets up various files and directories under /home/vpopmail/domains/virtual.example.com, including:
postmaster home directory of postmaster@virtual.example.com vpasswd human-readable password file for virtual.example.com vpasswd.cdb machine-readable version of the password database
Add a virtual user:
# cd /home/vpopmail/bin # ./vadduser zack@virtual.example.com Please enter password for zack@virtual.example.com: somepassword enter password again: somepassword #
Configure your qmail-pop3d service to use vchkpw as the checkpassword utility. For example, if your qmail-pop3d service is started in /service/qmail-pop3d/run, you would change the line from something like this:
exec /usr/local/bin/softlimit -m 2000000 \ /usr/local/bin/tcpserver -v -R -H -l 0 -x /etc/tcp.pop3.cdb -c "$MAXPOP3D" \ 0 110 /var/qmail/bin/qmail-popup FQDN /bin/checkpassword \ /var/qmail/bin/qmail-pop3d Maildir 2>&1
to this:
exec /usr/local/bin/softlimit -m 2000000 \ /usr/local/bin/tcpserver -v -R -H -l 0 -x /etc/tcp.pop3.cdb -c "$MAXPOP3D" \ 0 110 /var/qmail/bin/qmail-popup FQDN /home/vpopmail/bin/vchkpw \ /var/qmail/bin/qmail-pop3d Maildir 2>&1
Restart the qmail-pop3d service to incorporate the change:
# svc -t /service/qmail-pop3d #
Now that Vpopmail is installed and configured, you should test it to make sure that it works and hasn't broken non-virtual users/domains:
Authenticate as a non-virtual user via the qmail-pop3d service:
# telnet 0 110 Trying 0.0.0.0... Connected to 0. Escape character is '^]'. +OK < 18025.993992124@FQDN> user somerealuser +OK pass somepassword +OK quit +OK Connection closed by foreign host. #
The +OK response to the pass command indicates successful authentication. If the response starts with -ERR, the authentication failed.
Authenticate as a virtual user via the qmail-pop3d service. Use the virtual user's e-mail address as the username (substituting a % for the @) and supply the password you set in step 2 of "Configuring Vpopmail":
# telnet 0 110 Trying 0.0.0.0... Connected to 0. Escape character is '^]'. +OK < 1745.993992523@example.com> user zack%virtual.example.com +OK pass somepassword +OK quit +OK Connection closed by foreign host. #
If this test fails, double-check the username and password, step 3 of "Configuring Vpopmail," and all of the installation steps.
Test the virtual user with a POP3 MUA.
| < Free Open Study > |
|