Mailing List Archive

Running qmail in chroot - here's how
I needed to run the mail injection capability, specifically the sendmail
clone (and whatever other qmail programs are needed to complete the process)
in a chroot environment. So, I got the electronic screw-driver out and had a
bit of an experiment. Note that the following in not sanctioned by the
author as far as I know.

The easiest way turns out to be to do a loopback mount of the whole of
/var/qmail into /var/qmail in the chroot environment. The crucial point is
that /var/qmail/queue must be shared - for a whole stack of obvious reasons,
with the most important one being sharing the named pipe used to trigger
qmail-send.

If you want a minimalist qmail in the chroot environment you only need the
following:

CHQ=$CHROOT/var/qmail

$CHQ/control/me
$CHQ/bin/qmail-inject
$CHQ/bin/qmail-queue
$CHQ/bin/qmail-sendmail

and the important bit:

mount -F lofs /var/qmail/queue $CHQ/queue

Making sure that the permissions on all directories and files match the
non-chroot equivalents.

Note that even in the minimalist version the queue is mounted into the chroot
environment so that non-chroot system and the chroot system share the
same queue.

The main assumption with this strategy is that delivery of mail will occur
in the non-chroot environment and qmail-alias et al can deduce the correct
home directories.


Regards.