[Mimedefang] mimedefang-filter, string matching from a (big) data source?

Fredrik Pettai pettai at nordu.net
Fri Feb 27 02:14:56 EST 2015


On 26 Feb 2015, at 14:10 , Steffen Kaiser <skmimedefang at smail.inf.fh-bonn-rhein-sieg.de> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Thu, 26 Feb 2015, Fredrik Pettai wrote:
> 
> > I want to make a ìsemiî dynamic rule that would tag emails that matches a list of strings, something like this:
> 
> Transform the strings into a SpamAssassin config file and let do it that 
> job. They found out that pattern matching takes lots of memory and CPU and 
> therefore invented techniques to overcome those problems, e.g. by using 
> pattern matching in C files.

Interesting idea. I’ll try it out...

> You can then probe for your tags.
> 
> > sub filter {
> >    my($entity, $fname, $ext, $type) = @_;
> >
> >    return if message_rejected();
> >
> >    if ($Sender =~ XYZ {
> >
> >        if ($Subject =~ [input from a list] ) {
> >            action_change_header('Subject', ì[ADD CUSTOM TAG]$Subject");
> >        } else {
> >
> >            my $io;
> >            if ($io = $entity->open("r")) {
> >                while (defined($_ = $io->getline)) {
> >                    if ( [input from a list] ) {
> >                        action_change_header('Subject', ì[ADD CUSTOM TAG]$Subject");
> >                        last;
> >                    }
> >                }
> >            $io->close;
> >            }
> >        }
> >    }
> >
> >    return action_accept();
> > }
> >
> >
> > I wonder what the best solution would be to achieve this?
> >
> > Currently, the [input from a list] is a text file which holds a lot of strings, one per line, and is currently about 6000+ lines long...
> > Is it a bad idea to open and read the text file from mimedefang-filter?
> > Would it be better to generate a new version of mimedefang-filter with the content of the text file inline?
> > Or should I consider something else?
> >
> > The text file is also updated, but not that frequentlyÖ
> 
> - -- 
> Steffen Kaiser
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
> 
> iQEVAwUBVO8bO1GgR0+MU/4GAQJosQf/e1i0UGyl0lCSbbuZbEfe55fBedOPHHlZ
> Z4iGNcnRxiPnrirwpUlBXhTg3ofPr3sStBatWV+p0jJMUFgbEsnUF7LUYHauy4aA
> dLPPIyyQv0QYESmu+Z669g5qFBFknzXK37FVVywd4tl1t8ugeKUOAQRYFxAa5yh+
> nDjP0oJ50OjvfgQMlu2I7o6zJbtMi5rSvmzvLHq82vCsTM+TQSMt17og3qEXvAiu
> jd6UE9CFwn60uLGccxkW4jHVp2K9wkzwrFKvdSIFH0Z8t8LEVpQb8LWQE+zIrIrX
> i2VU4yI6W2qNPF4eWJrPz/3Ca1p06ZHu7hXUx3fRNpGK8Ivt2S3Vsg==
> =EjHb
> -----END PGP SIGNATURE-----_______________________________________________
> NOTE: If there is a disclaimer or other legal boilerplate in the above
> message, it is NULL AND VOID.  You may ignore it.
> 
> Visit http://www.mimedefang.org and http://www.roaringpenguin.com
> MIMEDefang mailing list MIMEDefang at lists.roaringpenguin.com
> http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.roaringpenguin.com/pipermail/mimedefang/attachments/20150227/bffe0ba6/attachment.pgp>


More information about the MIMEDefang mailing list