Re: [courier-users] using .mailfilters

2016-02-09 Thread André Rothe
Thank you for your answer

> .mailfilters is used by maildrop's embedded mode.  Those files should
> not be mixed with delivery mode instructions (the .mailfilter file),
AFAIK.

Okay, I use delivery mode, so it will not work.

>
> As far as I can tell, "include" doesn't support globs, either.

I have tested it with HOME and SIZE and both are available in the
included files (do you mean global variables?).

My solution is now:

.mailfilter

cc "|scripts/buildfilterlist"
include "mailfilters/list"

A directory "mailfilters" in the user's home which contain a lot of
preordered rulesets.

scripts/buildfilterlist

#!/bin/bash
ls -1 mailfilters/* | grep "^.*/[0-9]\{2,\}_.*" | sed -e 's/^/include
"/' | sed -e 's/$/"/' > mailfilters/list
chmod 600 mailfilters/list

The .mailfilter calls a Bash script, which builds a current list of
ruleset files, which the .mailfilter includes again.

So I can add/remove rulesets without changing some others on the system.
The solution is not for mailservers with a lot of incoming mails, but
our internal project mailserver gets less than 100 mails per day
automatically generated from a service.

There is space to optimize it, the grep command can be removed if you
store the list on another location and maybe the two sed commands can be
combined.

Best regards
Andre


--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140
___
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


[courier-users] using .mailfilters

2016-02-09 Thread André Rothe
Hi,

I try to split my maildrop rules into different files ordered by
filename. Now I would like to execute all these files in batch till one
rule will match and exit maildrop.

The only file, which maildrop executes is .mailfilter in the user's
home. But it should execute all files within .mailfilters directory.

My first idea was to include the files witin .mailfilter:

include "/path/to/my/home/.mailfilters/*"

But it doesn't work. What is the correct config?

Thanks
Andre


--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140
___
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


Re: [courier-users] using .mailfilters

2016-02-09 Thread Gordon Messmer
On 02/09/2016 10:55 AM, André Rothe wrote:
> The .mailfilter calls a Bash script, which builds a current list of
> ruleset files, which the .mailfilter includes again.

And if you have two simultaneous deliveries, there is some risk that 
mailfilters/list will be empty when one of the maildrop processes opens 
it to "include" it.



--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140
___
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


Re: [courier-users] using .mailfilters

2016-02-09 Thread Sam Varshavchik

André Rothe writes:


My solution is now:

.mailfilter

cc "|scripts/buildfilterlist"
include "mailfilters/list"

A directory "mailfilters" in the user's home which contain a lot of
preordered rulesets.

scripts/buildfilterlist

#!/bin/bash
ls -1 mailfilters/* | grep "^.*/[0-9]\{2,\}_.*" | sed -e 's/^/include
"/' | sed -e 's/$/"/' > mailfilters/list
chmod 600 mailfilters/list

The .mailfilter calls a Bash script, which builds a current list of
ruleset files, which the .mailfilter includes again.


This is mostly equivalent to:

ls mailfilters/[0-9]* | sed -e 's/^/include "/' | sed -e 's/$/"/' > 
mailfilters/list

There is no need to waste time with grep, when this is much simpler.

However, this is not technically correct. Immediately after opening  
"mailfilter/list" for writing, the file will be empty. The new contents of  
the file get written to it a short time later. The time in question is  
minimal, a small fraction of a second, but it is not atomic, and it's  
possible that mail being delivered at that time will attempt to read  
"mailfilter/list", and read an empty file.


Marginally, it is also possible that if the list of files is very large,  
"mailfilter/list" will be partially written, cut off in a middle of a  
statement, and maildrop will encounter a parsing error, and abort mail  
delivery.


The chances are small, but real.

The way to do it correctly is to write the new contents into a temporary  
file, and rename it. Rename is an atomic operation:


set -e
ls mailfilters/[0-9]* | sed -e 's/^/include "/' | sed -e 's/$/"/' > 
mailfilters/list.tmp
mv mailfilters/list.tmp mailfilters/list




pgpuj_xpydkTZ.pgp
Description: PGP signature
--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140___
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


Re: [courier-users] using .mailfilters

2016-02-09 Thread Gordon Messmer
On 02/09/2016 07:19 AM, André Rothe wrote:
> My first idea was to include the files witin .mailfilter:
> include "/path/to/my/home/.mailfilters/*"

.mailfilters is used by maildrop's embedded mode.  Those files should 
not be mixed with delivery mode instructions (the .mailfilter file), AFAIK.

As far as I can tell, "include" doesn't support globs, either.

--
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151=/4140
___
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users