ok - I'm not muck of a programmer - but this should be easy for someone who is. Basically - what I'm trying to do is build a rule generator.

The source file will look like a regulare rules file - except it will have the ability to reference flat text files. The output file will have the contents of the text file inserted in place of the special tag as a giant "or" statement.

A source rule would contain {*/filename*} to indicate the file insertion. The text file is read and blank lines - trailing spaces - and lines starting with # are removed and it is folded into a giant OR expression.

In this example:

header SUBJ_PHRASE Subject =~ /(?re:){*/etc/spamassassin/subjphrase*}/i
describe SUBJ_PHRASE Subject contains spam phrase


File /etc/spamassassin/subjphrase contains:

back guar
big money
# comment string
boink
boost size
borrow up to

The resulting file would be:

header SUBJ_PHRASE Subject =~ /(?re:(back guar|big money|boink|boost size|borrow up to)/i
describe SUBJ_PHRASE Subject contains spam phrase


-------

As you can see - the file is read - white space, comments, blank lines removed, ever newline is replaced by a "|" and parens are added on both ends.

The reason I want this is to be able to build huge rules out of flat text files that are easy to maintain.

If someone write this I will share the rules and lists I've created with everyone. I'm currently using a nasty Exim trick to do this - but the resultes are very impressive. Anyone interested?










Reply via email to