This page should help you in configuring Virtual Services with Qmail.

This is all taken from Brian Ackerman's Virtual Services Guide.

Source Code

The source codes used in all this can be downloaded from here.

make - Compiles all the source code.
make install - Install them to /usr/local/bin (virtmailfilter will be installed with mode 04750 user root and group nofiles).
make uninstall - Remove the compiled source codes.
make clean - Clean up garbage.


 9.4.  Qmail Solution

  9.4.1.  Introduction

  This solution takes over the delivery responsibilities of qmail-local,
  so use of the .qmail files in the virtual home directories will not
  work.  However, each domain will still get a domain master user that
  will control aliasing for the whole domain.  Two external programs
  will be used for that domain masters .qmail-default file.  The mail
  will be passed through these two programs in order to deliver mail for
  each domain.


  Two programs are required since one of them is run setuid root.  It is
  a small program that changes to a non-root user and then runs the
  second program.  Consult your nearest security related site for a
  discussion as to why this is necessary.


  This solution bypasses the need for using virtuald.  Qmail is flexible
  enough to not require a general virtuald setup.  Qmail's design
  utilizes the chaining of programs together to deliver mail.  This
  design makes it very easy to insert the virtual section into the Qmail
  delivery process without altering a stock install of Qmail.


  A note that since you are using one Qmail any unqualified domain name
  will be expanded with the domain of the main server.  This is because
  you do not have a separate Qmail server for each domain.  Therefore,
  make sure that your client (Eudora, elm, mutt, etc.) knows to expand
  all of your unqualified domain names.


  9.4.2.  Setup Virtual Domains

  Qmail has to be configured to accept mail for each of the virtual
  domains you will be serving.  Type the following commands.


  echo "domain1.com:domain1" >> /var/qmail/control/virtualdomains

  9.4.3.  Setup Domain Master User

  Add to your main /etc/passwd file the user domain1.  I would make the
  shell /bin/false so that the domain master cannot log in.   That user
  will be able to add .qmail files and all mail for domain1 will route
  through that account.  Note that usernames can only be eight
  characters long and domain names can be longer.  The remaining
  characters are truncated.  That means that user domain12 and domain123
  are going to be the same user and Qmail might get confused.  So be
  careful in your master domain user naming convention.


  Create the domain master's .qmail files with the following commands.
  Add any other system aliases at this point.  For example, webmaster or
  hostmaster.


  echo "user@domain1.com" > /home/d/domain1/.qmail-mailer-daemon
  echo "user@domain1.com" > /home/d/domain1/.qmail-postmaster
  echo "user@domain1.com" > /home/d/domain1/.qmail-root

  Create the domain master's .qmail-default file.  This will filter all
  mail to the virtual domain.


  echo "| /usr/local/bin/virtmailfilter" > /home/d/domain1/.qmail-default

Qmail requires a special pop that can support the Maildir format.  The
pop program has to be virtualized.  The author of Qmail recommends
using tcpserver (an inetd replacement) with Qmail so my examples use
tcpserver and NOT inetd.

Tcpserver does not require a config file.  All the information can be
passed to it via the command line. The tcpserver file
that you would use for the mail daemon and popper is included in the source tarball above.

9.4.5.  Qmail.init

  You can use the standard Qmail init script provided.  Qmail comes with
  very good documentation describing how to set this up.

 9.4.6.  Source

  You require two other programs to get virtual mail working with Qmail.
  They are virtmailfilter and virtmaildelivery.  This is the C source code
  for virtmailfilter and virtmaildelivery is included in the source tarball. 


Return to the Virtfs Main Page.