Commit c30c42ad authored by gregor herrmann's avatar gregor herrmann

Imported Debian version 0.200

parents
#
# Module::Build build script for Courier::Filter
#
# (C) 2005-2008 Julian Mehnle <julian@mehnle.net>
# $Id: Build.PL 211 2008-03-23 01:25:20Z julian $
#
###############################################################################
use Module::Build;
my $build = Module::Build->new(
module_name => 'Courier::Filter',
dist_author => 'Julian Mehnle <julian@mehnle.net>',
license => 'perl',
requires => {
# Core requirements:
perl => '5.008',
Error => 0
},
recommends => {
# Filter module requirements:
Net::RBLClient => 0,
Mail::SPF => 0,
Net::Address::IP::Local
=> 0,
DateTime => 0,
DateTime::Format::Mail
=> 0,
MIME::Tools => '5.400',
IO::InnerFile => '2.110',
Archive::Zip => 0,
ClamAV::Client => 0,
Mail::SpamAssassin => 0
},
build_requires => {
# Build requirements:
Module::Build => 0
},
script_files => [
'bin/test-filter-module'
],
install_path => {
lib => '/usr/share/courier-filter-perl/perl5'
},
create_makefile_pl
=> 'passthrough',
sign => 1
);
$build->create_build_script();
This diff is collapsed.
System Requirements
-------------------
The following Perl version and packages are required for...
...building Courier::Filter:
Perl 5.8
Module-Build
...running Courier::Filter:
Perl 5.8
Error
Some filter modules require additional Perl packages:
DNSBL: Net-RBLClient
SPF: Mail-SPF
SPFout: Mail-SPF
Net-Address-IP-Local
FakeDate: DateTime
DateTime-Format-Mail
Parts: MIME-tools 5.400
IO-stringy 2.110
Archive-Zip
ClamAVd: MIME-tools 5.400
ClamAV-Client
SpamAssassin:
Mail-SpamAssassin
Building and Installing
-----------------------
You can build and install Courier::Filter automatically through CPAN, or
manually with the following commands:
perl Build.PL
./Build
./Build test
./Build install
Please read the Courier::Filter::Overview manpage for further installation
instructions.
# $Id: README 167 2005-01-17 18:26:45Z julian $
# vim:tw=79
This diff is collapsed.
bin/courier-filter-perl
bin/test-filter-module
Build.PL
CHANGES
debian/changelog
debian/compat
debian/control
debian/copyright
debian/install
debian/postinst
debian/postrm
debian/preinst
debian/prerm
debian/rules
examples/courier-filter-perl.conf.bare
examples/courier-filter-perl.conf.full
INSTALL
lib/Courier/Config.pm
lib/Courier/Error.pm
lib/Courier/Filter.pm
lib/Courier/Filter/Logger.pm
lib/Courier/Filter/Logger/File.pm
lib/Courier/Filter/Logger/IOHandle.pm
lib/Courier/Filter/Logger/Syslog.pm
lib/Courier/Filter/Module.pm
lib/Courier/Filter/Module/BlankBody.pm
lib/Courier/Filter/Module/ClamAVd.pm
lib/Courier/Filter/Module/DNSBL.pm
lib/Courier/Filter/Module/Envelope.pm
lib/Courier/Filter/Module/FakeDate.pm
lib/Courier/Filter/Module/Header.pm
lib/Courier/Filter/Module/MIMEParts.pm
lib/Courier/Filter/Module/Parts.pm
lib/Courier/Filter/Module/SendCopy.pm
lib/Courier/Filter/Module/SpamAssassin.pm
lib/Courier/Filter/Module/SPF.pm
lib/Courier/Filter/Module/SPFout.pm
lib/Courier/Filter/Overview.pod
lib/Courier/Filter/Util.pm
lib/Courier/Message.pm
LICENSE
Makefile.PL
MANIFEST This list of files
META.yml
README
TODO
^_build
^Build$
^debian/courier-filter-perl\b
\bCVS\b
^MANIFEST\.
^Makefile$
^\.
/\.
\.tar\.gz$
^tmp/
^lib/Courier/Filter/Logger/USM.pm$
---
name: Courier-Filter
version: v0.200
author:
- 'Julian Mehnle <julian@mehnle.net>'
abstract: Purely Perl-based mail filter framework for the Courier MTA
license: perl
resources:
license: http://dev.perl.org/licenses/
requires:
Error: 0
perl: 5.008
build_requires:
Module::Build: 0
recommends:
Archive::Zip: 0
ClamAV::Client: 0
DateTime: 0
DateTime::Format::Mail: 0
IO::InnerFile: 2.110
MIME::Tools: 5.400
Mail::SPF: 0
Mail::SpamAssassin: 0
Net::Address::IP::Local: 0
Net::RBLClient: 0
provides:
Courier::Config:
file: lib/Courier/Config.pm
Courier::Error:
file: lib/Courier/Error.pm
Courier::Filter:
file: lib/Courier/Filter.pm
version: v0.200
Courier::Filter::Logger:
file: lib/Courier/Filter/Logger.pm
Courier::Filter::Logger::File:
file: lib/Courier/Filter/Logger/File.pm
Courier::Filter::Logger::IOHandle:
file: lib/Courier/Filter/Logger/IOHandle.pm
Courier::Filter::Logger::Syslog:
file: lib/Courier/Filter/Logger/Syslog.pm
Courier::Filter::Module:
file: lib/Courier/Filter/Module.pm
Courier::Filter::Module::BlankBody:
file: lib/Courier/Filter/Module/BlankBody.pm
Courier::Filter::Module::ClamAVd:
file: lib/Courier/Filter/Module/ClamAVd.pm
Courier::Filter::Module::DNSBL:
file: lib/Courier/Filter/Module/DNSBL.pm
Courier::Filter::Module::Envelope:
file: lib/Courier/Filter/Module/Envelope.pm
Courier::Filter::Module::FakeDate:
file: lib/Courier/Filter/Module/FakeDate.pm
Courier::Filter::Module::Header:
file: lib/Courier/Filter/Module/Header.pm
Courier::Filter::Module::MIMEParts:
file: lib/Courier/Filter/Module/MIMEParts.pm
Courier::Filter::Module::Parts:
file: lib/Courier/Filter/Module/Parts.pm
Courier::Filter::Module::SPF:
file: lib/Courier/Filter/Module/SPF.pm
Courier::Filter::Module::SPFout:
file: lib/Courier/Filter/Module/SPFout.pm
Courier::Filter::Module::SendCopy:
file: lib/Courier/Filter/Module/SendCopy.pm
Courier::Filter::Module::SpamAssassin:
file: lib/Courier/Filter/Module/SpamAssassin.pm
Courier::Filter::Util:
file: lib/Courier/Filter/Util.pm
Courier::Message:
file: lib/Courier/Message.pm
version: v0.200
MIME::Words::Better:
file: lib/Courier/Message.pm
generated_by: Module::Build version 0.2808
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.2.html
version: 1.2
# Note: this file was auto-generated by Module::Build::Compat version 0.03
unless (eval "use Module::Build::Compat 0.02; 1" ) {
print "This module requires Module::Build to install itself.\n";
require ExtUtils::MakeMaker;
my $yn = ExtUtils::MakeMaker::prompt
(' Install Module::Build now from CPAN?', 'y');
unless ($yn =~ /^y/i) {
die " *** Cannot install without Module::Build. Exiting ...\n";
}
require Cwd;
require File::Spec;
require CPAN;
# Save this 'cause CPAN will chdir all over the place.
my $cwd = Cwd::cwd();
CPAN::Shell->install('Module::Build::Compat');
CPAN::Shell->expand("Module", "Module::Build::Compat")->uptodate
or die "Couldn't install Module::Build, giving up.\n";
chdir $cwd or die "Cannot chdir() back to $cwd: $!";
}
eval "use Module::Build::Compat 0.02; 1" or die $@;
Module::Build::Compat->run_build_pl(args => \@ARGV);
require Module::Build;
Module::Build::Compat->write_makefile(build_class => 'Module::Build');
Courier::Filter 0.200
A purely Perl-based mail filter framework for the Courier MTA.
(C) 2003-2008 Julian Mehnle <julian@mehnle.net>
<http://www.mehnle.net/software/courier-filter>
==============================================================================
The Courier MTA's courierfilter interface
-----------------------------------------
The Courier MTA <http://www.courier-mta.org> offers an interface for
daemon-style processes to act as mail filters, called courierfilters. For
every incoming mail message, right after the DATA command in the SMTP
transaction phase has completed, Courier calls every registered mail filter
through a UNIX domain socket the filter is listening on, and feeds it the file
names of the incoming message and one or more control files. The mail filter
processes the message and its control file(s), and returns an SMTP-style
status response. If the status response is a positive ("2xx") one, Courier
accepts the message. Otherwise, Courier rejects the message using the
returned response code and text.
About Courier::Filter
---------------------
Courier::Filter implements the courierfilter interface as a framework for mail
filter modules that frees modules from the duties of creating and handling the
UNIX domain sockets, waiting for connections from Courier, and reading and
parsing message and control files. Thus, authors of filter modules can
concentrate on writing the actual filter logic without having to care about
things that can easily be abstracted and can be performed by the framework.
Courier::Filter allows multiple filter modules to be installed, and filter
modules can be stacked and grouped hierarchically, and even a module's polarity
can be reversed, so some modules can be used for explicitly accepting messages
while others are used in the traditional way for rejecting messages.
Getting started
---------------
Read the following perldocs in order to get started with Courier::Filter:
* Courier::Filter::Overview
* Courier::Filter
* Courier::Filter::Module
Upgrading from versions prior to 0.15
-------------------------------------
Starting from version 0.15, the Courier::* Perl modules are no longer being
installed in your Perl's configured "vendorlib" path, but in the private path
'/usr/share/courier-filter-perl/perl5'. (This is because Courier::Filter is
primarily a plug-in for the Courier MTA, and not a library of Perl modules that
are intended to be used by other programs or modules. However some of the
modules (e.g. Courier::Message) are indeed designed genericly, and should any
other program or module actually make use of them in the future, I will split
them off into a separate library package.)
Due to this partial relocation, upgrading from a version prior to 0.15 is
probably best achieved by removing the old version and doing a fresh install.
You can of course keep your old configuration file(s).
Reporting Bugs
--------------
Please report bugs in Courier::Filter and its documentation to the CPAN bug
tracker:
http://rt.cpan.org/Public/Dist/Display.html?Name=Courier-Filter
License
-------
Courier::Filter is free software. You may use, modify, and distribute it under
the same terms as Perl itself, i.e. under the GNU GPL (version 2 or later) or
the Artistic License. See LICENSE for the license texts.
# $Id: README 210 2008-03-21 19:30:31Z julian $
# vim:tw=79
# Legend:
# --- = A new release
# + = Add a feature (in a backwards compatible way)
# ! = Change something significant, or remove a feature
# * = Fix a bug, or make a minor improvement
--- ?
+ Add a multi-threaded mode (using Perl 5.8 ithreads).
+ Implement a _simple_ configuration syntax.
+ Allow filter modules to store their results in message objects for reuse by
other filter modules.
* Factor out the prefixing of "FilterModule:" tags to rejection messages from
individual filter modules.
+ Allow placeholders to be used in filter modules' response options.
# $Id: TODO 211 2008-03-23 01:25:20Z julian $
# vim:tw=79 sts=2 sw=2
#!/usr/bin/perl
#
# Bootstrapping module for Courier::Filter,
# the purely Perl-based filter framework for the Courier MTA.
#
# (C) 2003-2006 Julian Mehnle <julian@mehnle.net>
# $Id: courier-filter-perl 205 2006-07-13 00:03:58Z julian $
#
##############################################################################
=head1 NAME
courier-filter-perl - A Courier::Filter-based filter for the Courier MTA
=head1 VERSION
0.18
=head1 SYNOPSIS
B<filterctl> [ B<start> | B<stop> ] [ B<courier-filter-perl> ]
=head1 DESCRIPTION
The B<courier-filter-perl> executable is a global mail filter for the Courier
MTA and acts as glue between Courier's B<courierfilter> interface and the
B<Courier::Filter> module framework.
For an architectural and administrative overview of the B<Courier::Filter>
framework, see L<Courier::Filter::Overview>.
=head1 FILES
=over
=item F</etc/courier/filters/courier-filter-perl.conf>
This is the configuration file for C<courier-filter-perl> and Courier::Filter.
See L<Courier::Filter::Overview> for its format.
=back
=head1 SEE ALSO
L<Courier::Filter::Overview>, L<Courier::Filter>
For AVAILABILITY, SUPPORT, and LICENSE information, see
L<Courier::Filter::Overview>.
=head1 AUTHOR
Julian Mehnle <julian@mehnle.net>
=cut
use warnings;
use strict;
use lib '/usr/share/courier-filter-perl/perl5';
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);
# vim:tw=79
#!/usr/bin/perl
#
# A tester for Courier::Filter modules.
#
# (C) 2003-2006 Julian Mehnle <julian@mehnle.net>
# $Id: test-filter-module 210 2008-03-21 19:30:31Z julian $
#
##############################################################################
=head1 NAME
test-filter-module - A tester for Courier::Filter modules
=head1 VERSION
0.18
=head1 SYNOPSIS
B<test-filter-module> I<module> [I<options>] I<message> [+I<control> ...] [...]
=head1 DESCRIPTION
This is a tester for B<Courier::Filter> modules. It sets up the specified
Courier::Filter::Module::I<module> filter module, using any supplied
I<options>, and then queries the filter module for consideration of the given
I<message> file and zero or more I<control> files. More than one
message/control files tuple may also be specified, in which case the filter
module is applied to each message and its respective control file(s). Filter
module options must be specified in the format -I<option>=I<expr>, where
I<expr> may be any valid Perl expression.
=head1 EXAMPLES
=over
=item B<test-filter-module> DNSBL -zones='["bl.foo.org", "bl.bar.org"]'
test.rfc2822 +test.control
Applies the Courier::Filter::Module::DNSBL filter module to the
F<test.rfc2822>/F<test.control> message/control file tuple (taking the sending
machine's IP address from the control file), using the blacklist DNS zones
C<bl.foo.org> and C<bl.bar.org>.
=back
=head1 SEE ALSO
L<Courier::Filter::Overview>, L<Courier::Filter>
For AVAILABILITY, SUPPORT, and LICENSE information, see
L<Courier::Filter::Overview>.
=head1 AUTHOR
Julian Mehnle <julian@mehnle.net>
=cut
use warnings;
use strict;
use lib '/usr/share/courier-filter-perl/perl5';
use IO::Handle;
use Courier::Message;
# Declarations:
##############################################################################
use constant TRUE => (0 == 0);
use constant FALSE => not TRUE;
use constant MODULE_NAME_PREFIX => 'Courier::Filter::Module::';
# Implementation:
##############################################################################
if (@ARGV < 2 or $ARGV[0] =~ /^(?:-h|--help)$/) {
my $script_name;
($script_name = $0) =~ s/^.*\///;
STDERR->print(
"Usage:\n" .
" $script_name MODULE [OPTIONS] MESSAGE [+CONTROL ...] [...]\n" .
"\n" .
"Applies the " . MODULE_NAME_PREFIX . "MODULE filter module to the specified\n" .
"MESSAGE file and any CONTROL files (if specified). Multiple MESSAGE files can\n" .
"be specified, and each one may be followed by any number of CONTROL files, each\n" .
"prefixed by a '+' character.\n" .
"Optionally, OPTIONS in the format -<option>=<expr> can be given to the MODULE\n" .
"constructor, where <expr> may be any valid Perl expression.\n" .
"\n" .
"Example:\n" .
" $script_name \\\n" .
" DNSBL -zones='[qw(bl.foo.org bl.bar.org)]' \\\n" .
" test.rfc2822 +test.control\n" .
"\n"
);
exit(64); # EX_USAGE
}
my $module_name = shift();
my %options;
$options{$1} = eval($2), shift()
while $ARGV[0] =~ /^-(.*?)=(.*)/;
my @messages;
while (@ARGV) {
my $file_name = shift();
if ($file_name !~ /^\+(.*)/) {
# Message file:
my $message = Courier::Message->new(
file_name => $file_name
);
push(@messages, $message);
}
else {
# Control file, belonging to the previous message file:
STDERR->print("Orphan control file specified. List a message file first.\n"), exit(64) # EX_USAGE
if not @messages;
push(
@{ $messages[$#messages]->{control_file_names} },
$1
);
}
}
my $class = MODULE_NAME_PREFIX . $module_name;
eval("use $class;");
if ($@) {
STDERR->print("Unable to load filter module $module_name ($class).\n");
exit(1);
}
my $module = $class->new(
%options,
testing => TRUE # Enable testing mode, so no real-life/persistent things are done.
);
foreach my $message (@messages) {
my ($result, $code) = $module->consider($message);
if ($result) {
$code ||= 550;
}
else {
$result = 'Ok';
$code ||= 200;
}
my @lines = split(/\n/, $result);
my $last_line = pop(@lines);
print($message->file_name . ": $code-$_\n") foreach @lines;
print($message->file_name . ": $code $last_line\n");
}
This diff is collapsed.
Source: courier-filter-perl
Section: mail
Priority: optional
Maintainer: Julian Mehnle <julian@mehnle.net>
Build-Depends-Indep: perl (>= 5.8), libmodule-build-perl
Build-Depends: debhelper (>= 5)
Standards-Version: 3.7.3
Package: courier-filter-perl
Architecture: all
Depends: courier-mta, perl (>= 5.8), liberror-perl
Recommends: libnet-rblclient-perl, libmail-spf-perl, libmime-tools-perl (>= 5.400), libio-stringy-perl (>= 2.110), libclamav-client-perl, libmail-spamassassin-perl, libarchive-zip-perl
Suggests: libnet-address-ip-local-perl
Description: purely Perl-based mail filter framework for the Courier MTA
Courier::Filter implements the Courier MTA's courierfilter interface as a
framework for mail filter modules. Authors of filter modules can concentrate
on writing the actual filter logic without having to care about the usual
low-level details of the courierfilter interface. Logging to various
facilities is also supported.
.
Courier::Filter allows multiple filter modules to be installed in stacked and
hierarchically grouped configurations. Also, modules' polarity can be
reversed, so some modules can be used for explicitly accepting messages while
others are used in the traditional way for rejecting messages.
.
The following filter modules are included:
* BlankBody: matching of blank bodies (a stupid spammer symptom)
* DNSBL: matching of calling MTA's IP address against DNS black-lists
* SPF: authentication of sender addresses in inbound messages
* SPFout: authentication of sender addresses in outbound messages
* Envelope: matching of RFC 2821 message envelope fields
* Header: matching of RFC 2822 message header fields
* FakeDate: detection of implausible and malformed date header fields
* ClamAVd: malware detection using the ClamAV scanner
* SpamAssassin: spam detection using SpamAssassin
* Parts: matching of MIME parts and ZIP archive contents
* SendCopy: sending message copies to additional recipients
This is the Debian package for the Courier-Filter CPAN distribution, which is
available from <http://search.cpan.org/dist/Courier-Filter>.
© 2003-2008 Julian Mehnle <julian@mehnle.net>. Julian Mehnle is the upstream
author as well as the maintainer of the Debian package.
This is free software; you can redistribute it and/or modify it under the same
terms as Perl or Courier themselves, that is under the terms of either the GNU
General Public License (version 2 or later) or the Artistic License.
On Debian GNU/Linux systems, the complete text of these licenses can be found
in these files:
/usr/share/common-licenses/GPL-2
/usr/share/common-licenses/Artistic
bin/courier-filter-perl usr/lib/courier/filters/
#!/bin/sh -e
mode=$1
# Move a conffile without triggering a dpkg question
mv_conffile() {
OLDCONFFILE="$1"
NEWCONFFILE="$2"
if [ -e "$OLDCONFFILE" ]; then
echo "Preserving user changes in $OLDCONFFILE to $NEWCONFFILE ..."
mv -f "$NEWCONFFILE" "$NEWCONFFILE".dpkg-new
mv -f "$OLDCONFFILE" "$NEWCONFFILE"
fi
}
# Move a conffile to a non-conffile
mv_conffile_to_noncf() {
OLDCONFFILE="$1"
NEWCONFFILE="$2"
if [ -e "$OLDCONFFILE" ]; then
echo "Preserving user changes in $OLDCONFFILE to $NEWCONFFILE ..."
mv -f "$OLDCONFFILE" "$NEWCONFFILE"
fi
}
case "$mode" in
configure )
old_version=$2
config_file=/etc/courier/filters/courier-filter-perl.conf
if dpkg --compare-versions "$old_version" lt "0.200"; then
# Preserve customized old config file, if any:
mv_conffile_to_noncf /etc/courier/filters/pureperlfilter.conf $config_file
fi
if [ ! -e $config_file ]; then
# No config file exists, create one:
cp /usr/share/doc/courier-filter-perl/examples/courier-filter-perl.conf.bare $config_file
fi
echo "Starting courier-filter-perl mail filter ..."
filterctl start courier-filter-perl
;;
esac
#DEBHELPER#
#!/bin/sh -e
mode=$1
case "$mode" in
purge )
rm /etc/courier/filters/courier-filter-perl.conf
;;
esac
#DEBHELPER#
#!/bin/sh -e
mode=$1
# Prepare to move a conffile without triggering a dpkg question
prep_mv_conffile() {
PKGNAME="$1"
CONFFILE="$2"
if [ -e "$CONFFILE" ]; then
md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
if [ "$md5sum" = "$old_md5sum" ]; then
rm -f "$CONFFILE"
fi
fi
}
case "$mode" in
install | upgrade )
old_version=$2
if dpkg --compare-versions "$old_version" lt "0.200"; then
pureperlfilter_link=/etc/courier/filters/active/pureperlfilter
if [ -h $pureperlfilter_link ]; then
echo "Disabling pureperlfilter mail filter ..."