Re: QMAILREMOTE patch
Manvendra Bhangui <[email protected]> Wed, 24 May 2017 11:53:24 +0530
| Newsgroups | gmane.mail.qmail.general |
|---|---|
| Message-ID | <CAOqj+1OPTMeYTiynyaWeiFW8UU74CzB112=P5y6e1M3CRtppcg@mail.gmail.com> |
On 24 May 2017 at 11:19, Amitai Schleier < [email protected]> wrote: > On 23 May 2017, at 0:21, Manvendra Bhangui wrote: > > Nice and quite useful. Have done exactly the same. I use the same variable >> QMAILREMOTE. Additionally, I have modified qmail-lspawn.c to use >> QMAILLOCAL >> and call a binary other than qmail-local. Use it for doing DKIM >> verification. >> > > Makes sense. If my friend gets around to wanting to verify DKIM on > incoming messages, we'll want that. Have you posted these patches somewhere > stable? > > I use the variables QMAILLOCAL and QMAILREMOTE to run some filters before >> the actual delivery attempt. >> > > Would you be willing to share some of your filters? I'm curious to see > examples (besides DKIM) of what qmail-{remote,local} wrappers can be used > for. > It is posted here. dkim-netqmail-1.06.patch-1.18.gz <https://sourceforge.net/projects/indimail/files/netqmail-addons/qmail-dkim-1.0/dkim-netqmail-1.06.patch-1.18.gz/download> <https://sourceforge.net/projects/indimail/files/netqmail-addons/qmail-dkim-1.0/dkim-netqmail-1.06.patch-1.18.gz/download>Full instructions to use it is available here. https://notes.sagredo.eu/node/92 The change I have made, uses QMAILLOCAL and QMAILREMOTE to call a program called spawn-filter. You can define it to anything else. For remote deliveries spawn-filter calls qmail-remote. For local deliveries, spawn-filter calls qmail-local. It uses a control file /var/qmail/control/filterargs. filterargs control file is like this example.com:remote:grep -v ^DKIM-SIGNATURE *:remote:dk-filter mydomain.com:local:grep -v ^X-Forwarded NOTE: spawn-filter uses sh -c to call the commands, hence filterargs can contain any shell code snippet. The first line causes spawn-filter to strip out DKIM-Signature before sending any email to example.com The second line causes spawn-filter to call dk-filter and feed the output of dk-filter to qmail-remote for all remote deliveries. dk-filter is a small shell script which adds DKIM-Signature to the email The 3rd line simply strips out X-Forwarded line for local deliveries to mydomain.com If there is no match, the email passes unchanged to qmail-local or qmail-remote spawn-filter can also be used to ratelimit emails to certain domains. I used it for yahoo.com. There is a man page too. But off course, you need not use spawn-filter at all and are free to set QMAILLOCAL or QMAILREMOTE as per your requirement. The latest code can be obtained from (git) can be browsed here. You can look at qmail-lspawn.c, qmail-rspawn.c, spawn-filter.c at https://sourceforge.net/p/indimail/code/ci/master/tree/qmail-1.03/ -- Regards Manvendra - http://www.indimail.org GPG Pub Key http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC7CBC760014D250C