NetBSD is awesome. qmail is awesome. I have been irked, slightly, for several years because the precise forms of their awesomeness are not natively fully complementary. Soon I will be un-irked, however, for of late I've been spending altogether too much time rectifying the situation by improving NetBSD's qmail package. The following describes my soon-to-be-committed changes:
1) Mostly conform to hier(7) and honor PKG_SYSCONFDIR.
Based on a January 1997 post by mrg to the qmail list: prior to installation, we create symlinks in /var/qmail that point into ${LOCALBASE} or ${PKG_SYSCONFDIR}, causing installation to place files in those locations while allowing the canonical /var/qmail paths to continue to work. The notable deviation from hier(7) is that even though some binaries ought to go in sbin, they've all been lumped into bin for simplicity.
Pleasant effects:
- No need to set LOCALBASE.
- No need to set NO_MTREE.
- No need to set RCD_SCRIPTS_EXAMPLEDIR.
- No need to set EVAL_PREFIX to find an installed program.
- No need to set MANPATH (or edit man.conf) to read the man pages.
- Installation and deinstallation work much better.
Unpleasant side effects:
- CONFLICTS with mutt's mbox(5) manual page (XXX)
- ${LOCALBASE}/{bin,man,man/manN} get chown'd to group qmail. Rather than modify the qmail installer, the affected directories are simply chown'd back afterward using SPECIAL_PERMS. (XXX try installing to ${WRKDIR} first)
2) Follow more closely Dave Sill's “Life with qmail” (LWQ).
Similarities:
- Installs into /var/qmail from source code.
- Installs ucspi-tcp and daemontools.
- Applies netqmail patches.
- Applies the recommended patch for oversized DNS response packets.
- Uses tcpserver(1).
- Uses tcp.smtp.cdb for relay access control.
- Uses control/defaultdelivery.
- Uses control/concurrencyincoming.
- Requires that control/rcpthosts exist to prevent open relays.
- Uses similar chains of commands in run scripts.
- Provides a script much like qmailctl.
Differences:
- This package does the following work for you automatically:
- Creates user accounts.
- Fetches, extracts, patches, configures, and compiles the source.
- Installs binaries.
- Runs ./config-fast.
- Creates tcp.smtp{,cdb}.
- Creates control/concurrencyincoming.
- Creates control/defaultdelivery (defaulting to ”./Mailbox”).
- Creates the three required system aliases.
- LWQ suggests doing some things this package doesn't do:
- Copying a script from /var/qmail/boot to /var/qmail/rc.
- Configuring svscan(8) to run at boot.
- Creating and populating /service.
- Using supervise(8) and multilog(8).
- Using the qmailctl script to control qmail.
- Using the inst_check script to verify the installation.
- Storing tcp.smtp{,cdb} in /etc.
- Renaming the system sendmail(8) and marking it non-executable.
- Instead, this package:
- Uses NetBSD-style rc.d scripts (including one similar to qmailctl).
- Sends log messages to syslog(3).
- Stores tcp.smtp{,cdb} in ${PKG_SYSCONFDIR}.
- Provides an example mailer.conf(5).
3) Add a bunch of features to the rc.d scripts.
Rename the qmail script and rcvar to qmailsend. Add “doqueue” (synonyms: alrm, flush) and “queue” commands, add “hup” as a synonym for “reload”, and determine default delivery instruction from control/defaultdelivery (LWQ). Add control/defaultdelivery to required_files.
In the qmailsmtpd script, add -x and remove -H from flags passed to tcpserver(1), limit the number of incoming connections to control/concurrencyincoming, and add “cdb” command (LWQ). Add control/concurrencyincoming and tcp.smtp.cdb to required_files.
In the qmailsmtpd and qmailpop3d scripts, enforce resource limits with softlimit(8) (LWQ). Add dependency on sysutils/daemontools for this.
Log to splogger's default syslog facility (”mail”), and use the name of the script as the tag.
Add “pause” and “cont” commands (LWQ). They send -STOP and -CONT signals, respectively. Add “stat” as a synonym for “status” (LWQ).
Add qmail script (structure copied from net/samba/files/samba.sh). Its interface is very similar to LWQ's qmailctl: it provides the commands “start stop restart rcvar pause cont stat status cdb doqueue reload queue alrm flush hup help”. These commands can be run either directly from the appropriate service-specific script(s), or from this qmail script (which will call the right script(s) for you).
4) Remove some (but not all) obstacles to binary packaging.
Each of these is better explained elsewhere. Summary:
- Installs into the normal ${LOCALBASE}.
- /var/qmail paths still work.
- Patches are not applied by default.
5) Introduce QMAIL_SPOOL, QMAIL_WITH_PATCHES, QMAIL_QUEUE_EXTRA.
QMAIL_SPOOL (default: /var/spool/qmail): the path to the queue.
QMAIL_WITH_PATCHES (default: NO): whether to apply the patches included in pkgsrc. “NO” may seem a strange default, but building from unmodified source by default is a step toward creating binary packages which can be redistributed.
QMAIL_QUEUE_EXTRA (default: empty): an additional recipient that will be added to every delivery. This is used primarily for logging. If this is set to a non-empty value, the necessary dot-qmail(5) file is created automatically at install time.
6) Retire QMAILDIR.
Since /var/qmail now contains only symlinks, there's no need to change its location. This is also a step toward creating binary packages which can be redistributed.
7) Bump PKGREVISION.
Other user-visible changes:
Remove <URL:http://patch.be/qmail/badrcptto-v1.01.patch> (implements control/badrcptto). If you relied on this patch, consider using qmail-qfilter instead. As with any other package, if you wish to apply this or other patches to your local builds, please use pkgsrc's LOCALPATCHES mechanism.
Add netqmail patches erroneously omitted during the previous package update. The complete netqmail patches are now included. <URL:http://www.ckdhr.com/ckd/qmail-103.patch> is the only patch not from netqmail; it's been in pkgsrc for some time, and it's still included because Dave Sill suggests that netqmail ought to include it.
Restrictions on the redistribution of modified qmail apply not only to binaries but also to source. Clarify this in RESTRICTED.
Add “hoststat” and “purgestat” entries to the sample mailer.conf. Install it to ${PREFIX}/share/examples/${PKGBASE}, as other pkgsrc mailers do.
Describe the steps needed to enable qmail in MESSAGE (cribbed from the postfix package).