
mbhangui at gmail
Apr 17, 2009, 4:21 AM
Post #1 of 1
(668 views)
Permalink
|
|
ANNOUNCE: spawn-filter for netqmail-1.06 (Long Mail)
|
|
I am pleased to announce release of spawn-filter for netqmail. This was written way back in 2003 but in those days I didn't know about sourceforge. spawn-filter is the equivalent of QMAILQUEUE for local and remote deliveries. No more messing around with renaming qmail-remote or qmail-local for inserting your custom filters. spawn-filter exploits my earlier patch for QMAILLOCAL and QMAILREMOTE which allows qmail-lspawn, qmail-rspawn to run any program other than qmail-local and qmail-rspawn respectively. For those who had earlier downloaded by patch for DKIM, this patch was included (without spawn-filter). This patch now includes all my earlier modification plus spawn-filter. This patch also adds a new environment variable DKIMSIGNOPTIONS for qmail-dkim to set all possible options for DKIM signing. For this I would like to thank Fred from this list who explained me the possibilities and making qmail-dkim better than what it was earlier. I give below a more detailed description and examples of usage. Pardon my long sentences. The code is experimental and comes without warranty and is expected to go further changes. You can download dkim-netqmail-1.06.patch-1.5.gz at https://sourceforge.net/project/showfiles.php?group_id=230686&package_id=314675 The patch provides 1) qmail-dk (for DK signing at qmail-queue) 2) qmail-dkim (for DKIM signing at qmail-queue) 3) spawn-filter 4) QMAILLOCAL, QMAILREMOTE functionality 6) dkimtest, dktest (for testing DK, DKIM signing and verification) 7) A filter that can be used by spawn-filter for DK, DKIM signing/verifcation at remote/local delivery The patch requires libdomainkeys.a in a directory one level below. DESCRIPTION --------------------- You can turn on spawn-filter by defining QMAILLOCAL or QMAILREMOTE to the path of spawn-filter executable. If you do not define QMAILLOCAL and QMAILREMOTE, qmail-lspawn and qmail-rspawn will continue to call qmail-local, qmail-remote as originally. You can call any program instead of qmail-local by defining QMAILLOCAL. You can call any program instead of qmail-remote by defining QMAILREMOTE. spawn-filter understands the arguments passed to qmail-local and qmail-remote. Also spawn-filter understands the format in which errors need to be reported back to qmail-lspawn and qmail-rspawn. Hence, it can be convenient to define QMAILLOCAL=/var/qmail/bin/spawn-filter and QMAILREMOTE=/var/qmail/bin/spawn-filter spawn-filter is a utility to help qmail run any filter during local or remote delivery. It can run any script/program which reads on fd 0 and writes on fd 1. The descriptor 0 in usual case will point to the 'mess' file in the queue. You can define which filter to run by defining env variable FILTERARGS or having a control file /var/qmail/control/filterargs. spawn-filter feeds the 'mess' file to the filter program. The output of the filter program is then supplied to qmail-local or qmail-remote on fd 0. The filter can be turned on individually for local and remote mails by defining QMAILLOCAL and QMAILREMOTE environment variables respectively in qmail-send supervise or rc script. If spawn-filter is invoked as qmail-local, it executes the original qmail-local after runing the mail through the filter. If spawn-filter is invoked as qmail-remote, it executes the original qmail-remote after running the mail through the filter. Hence QMAILLOCAL should be set as /var/qmail/bin/spawn-filter for filtering local mails and QMAILREMOTE as /var/qmail/bin/spawn-filter for filtering remote mails. Filters can be run by setting the environment variable FILTERARGS. This environment variable overrides the control file filterargs (see below). spawn-filter uses /bin/sh to run the filter (with arguments) specified by the FILTERARGS environment variable (or the control file filterargs). The environment variable FILTERARGS apply to both local and remote mails. For individual domain level control, it is best to use the control file filterargs. The format of this file is of the form domain:args for both local and remote mails. domain:remote:args for remote mails and domain:local:args for local mails. domain can be any REGEX pattern e.g. I use the below for DKIM/DK signing for all remote mails *:remote:/var/qmail/bin/dk-filter WHERE CAN I USE IT ------------------ e.g If you want to append disclaimers (the stupid ones) to all your outgoing mails, have the following in the control file /var/qmail/control/filterargs *:remote:/var/qmail/bin/altermime --input=- --disclaimer-/var/qmail/control/disclaimer If you want to do DKIM/DomainKey signing for all mails destined for gmail.com, have the following in /var/qmail/control/filterargs *:gmail.com:/var/qmail/bin/dk-filter (Appropriately define DKSIGN, DKIMSIGN environment variable in the boot script for starting qmail) If you want to do DKIM verification for all incoming mails *:local:env - DKIMVERIFY=1 QMAILLOCAL=/var/qmail/bin/spawn-filter /var/qmail/bin/dk-filter -- Regards Manvendra - http://www.indimail.org
|