Ok, I think I'm finally squared away after I downloaded the archive and
was able to read the example setup files. I've got a error in
/var/log/courier-filter.log:
Courier::Filter::Module::MIMEParts: IO::Handle: bad open mode: <:bytes
at /usr/lib/perl5/site_perl/5.8.0/Courier/Message.pm line 218
Rejected message sent from <[EMAIL PROTECTED]> to
<[EMAIL PROTECTED]> through ::ffff:206.46.170.131
(out009pub.verizon.net)
Reason: Mail filters temporarily unavailable.

This is the setup I've got now:
pureperlfilter:
use warnings;
#use diagnostics;
use strict;

use Courier::Config;
use Courier::Filter;

use constant TRUE   => (0 == 0);
use constant FALSE  => not TRUE;

our $options;
my $config_file_name = Courier::Config::COURIER_FILTER_CONF;
require $config_file_name;

my $filter = Courier::Filter->new(%$options);
exit($filter->run() || 0);


pureperlfilter.conf: use utf8;

use Courier::Filter::Logger::File;
use Courier::Filter::Module::MIMEParts;

$options = (
    # Logger Declaration:

    logger      => Courier::Filter::Logger::File->new(
        file_name   => '/var/log/courier-filter.log',
        timestamp   => TRUE
    ),

    # Module Declarations:

    modules     => [
        Courier::Filter::Module::MIMEParts->new(
        max_size    => $max_size,
        signatures  => [
            {
                file_name   => 'file_name.ext' || qr/\.(exe|com|pif|lnk)$/,
                size        => 106496,
                response    => '500 Executable content rejected'
            }
        ]
        )
    ]
};

Julian Mehnle wrote:
Bernard Robbins <[EMAIL PROTECTED]> wrote:

This is what I did:

I installed Courier::Filter::Module::MIMEParts with CPAN.
I created /usr/local/courier/etc/filters/pureperlfilter.conf:

use utf8;

use Courier::Filter::Logger::File;
use Courier::Filter::Module::MIMEParts;

    $options = {
        logger      => Courier::Filter::Logger::File->new(
            file_name   => '/var/log/courier-pureperlfilter.log',
            timestamp   => 1
        }
    };


Up to here, you're doing everything right.


    my $module = Courier::Filter::Module::MIMEParts->new( ... );

    my $filter = Courier::Filter->new(
        modules     => [ $module ],
    );


You need to include your module setup in the $options definition:

| $options = {
|     logger  => Courier::Filter::Logger::File->new( ... ) ,
|     modules => [
|         Courier::Filter::Module::MIMEParts->new( ... )
|     ]
| };

The "my $filter = Courier::Filter->new( ... )" part is handled
automatically by the "pureperlfilter" executable (which is started when
doing `courierfilter start`).

See the sample "pureperlfilter.conf" file that comes with Courier::Filter.


ln -s /usr/local/courier/etc/filters/pureperlfilter.conf /usr/local/courier/etc/filters/active/


No, the link you have to create must not point to "pureperlfilter.conf"
but to the "pureperlfilter" executable instead.


/usr/local/courier/sbin/courierfilter start

/var/log/maillog:
Aug 12 11:56:15 mail courierfilter: exec: Exec format error
Aug 12 11:56:15 mail courierfilter: Starting pureperlfilter.conf

And of course its not working. Can you point me in the right direction?


To sum everything up, you have made two mistakes:
 1. Your symlink points to "pureperlfilter.conf" instead of
    "pureperlfilter".  This causes the "exec: Exec format error" message,
    because "pureperlfilter.conf" is not a valid executable.
 2. Your setup in "pureperlfilter.conf" is slightly wrong.  Move your
    module setup into the definition of the $options variable (see above).



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users




-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to