lib/Mail/Decency.pm untested

filter: Statementstmt 0.0% 0 / 10 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod n/a totaltotal 0.0% 0 / 13 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Mail::Decency;
2  
3  
4 use strict;
5 use warnings;
6  
7 use version 0.74; our $VERSION = qv( "v0.1.6" );
8  
9  
10 =head1 NAME
11  
12 Mail::Decency - Anti-Spam fighting framework
13  
14  
15 =head1 DESCRIPTION
16  
17 Mail::Decency is an interface between postfix (MTA), a bunch of policies (eg DNSBL, SPF, ..), multiple content filters (eg DSPAM, Bogofilter, ClamAV, DKIM validation, ...) and a log parser.
18  
19 It is based on POE and Moose and runs as a daemon with multiple forked instances.
20  
21 =head1 SYNOPSIS
22  
23 Setting up a new policy server
24  
25 use Mail::Decency::Policy;
26 my $policy = Mail::Decency::Policy->new( {
27 config => '/etc/decency/policy.yml'
28 } );
29 $policy->run;
30  
31 Setting up a new content filter
32  
33 use Mail::Decency::ContentFilter;
34 my $content_filter = Mail::Decency::ContentFilter->new( {
35 config => '/etc/decency/content-filter.yml'
36 } );
37 $content_filter->run;
38  
39 Setting up a new syslog parser
40  
41 use Mail::Decency::LogParser;
42 my $syslog_parser = Mail::Decency::LogParser->new( {
43 config => '/etc/decency/log-parser.yml'
44 } );
45 $syslog_parser->run;
46  
47  
48  
49 =head1 INTRODUCTION
50  
51 For now, decency is in alpha-testing state. Don't use it in production. Also: API changes could occure.
52  
53 =head2 WHY ANOTHER POLICY SERVER OR CONTENT FILTER ?
54  
55 Well, that is the first reason why: there is no single (open source) application that combines both that i know of. The spam threat has not been decreased over the time, quite the contrary: it has hugely increased. I think it is of the outermost importance to bring those two points of defense as close together as possible.
56  
57 The second reason: CPAN. The existing (perl implemented) solutions lack imho the modular design for being as extendable as they could be and are not released on CPAN.
58  
59 The third reason is distributability (is this an English word?). In high traffic environments a distributed (mail server) structure is not uncommon. The content filter and policy server solution should be designed for this scenario.
60  
61 The fourth and last reason is more personal. Complex and voluminous configuration lead often to human mistakes (or at least on my part). decency tries to have a simplified and maintainable configuration. Then again, maybe the configuration seams much easier to me, because i wrote it..
62  
63 =head3 IS IT "POSTFIX ONLY" ?
64  
65 No, or at least it does not has to be. For now, mainly postfix is supported, but most other MTAs should be able to implement the content filter. Exim should be able to use the policy server (with a L<<a href="http://www.bebt.de/blog/debian/archives/2006/07/30/T06_12_27/index.html">work around</a>>). For the log parser, there is only a postfix parser modules available, but others can be implemented. Because i work mainly (you could say only) with postfix, i cannot implement other "bindings" then for postfix. But i try to keep it as modular as possible, not to slow down any effort to do this.
66  
67 =head3 WHAT ABOUT QPSMTPD ?
68  
69 Yes, there is qpsmtpd, which does implement the above mentioned techniques (content filtering, policy server) and is also open source. However the approach is entirely different: it is a replacement for your smtp(d) server. It does implements it's policy and content filters capabilities and then delivers the mails to your MTA (postfix, exim, qmail, ..). This is of course more flexible regarding the mail servers which support it, but also reduces the "backend MTA" to a delivery server. decency's approach is the "other way around": it relies on your MTA as the "main SMTP server" and integrates itself below.
70  
71 To put it exaggeratedly: with qpsmtpd you could substitute the backend MTA. With decency, you could substitute your anti-spam measurements. Therefore i would not argue that both address the same issue.
72  
73 Which approach is better or worse is not the question (imho), it is more: which can you integrate in your environment.
74  
75 =head2 HOW DOES IT WORK ?
76  
77 There are three components involved in the process:
78  
79 =over
80  
81 =item 1. Policy server
82  
83 Sits at the very frontier and fights spam before it is received with various measurements.
84  
85 =item 2. Content filter
86  
87 Middleware for applying all kinds of content filtering, such as spam filters and virus filter from third party. Also implements some own filters (DKIM, Archive, ..) without external software.
88  
89 =item 3. Log parser
90  
91 Mail server log analyses is most important for running a healthy system, this tries to simply this effort.
92  
93 =back
94  
95  
96 =head2 THE STRUCTURE
97  
98 ------------ -------------- ------------------
99 | INTERNET | -[SMTP]-> | MAILSERVER | -[SMTP]-> | CONTENT FILTER |
100 ------------ -------------- ------------------
101 | ^ |
102 v | [REINJECT]
103 ---------- v
104 | POLICY | --------------
105 ---------- | MAILSERVER |
106 --------------
107  
108 =over
109  
110 =item * A mail is to be received from the internet, the mail server does not yet accept it.
111  
112 =item * The mail server applies his own policies and then asks the policy server whether the mail shall pass.
113  
114 =item * The mail server rejects the mail finally or accepts and receive it and delivers it to the content filter.
115  
116 =item * The content filter might reject the mail, which will force the mail server to bounce it, or passes it again and re-inject it into another mail server process.
117  
118 =item * The mail server delivers the mail (eg mailbox)
119  
120 =back
121  
122 =head2 SHOULD I USE IT IN PRODUCTION
123  
124 No. Not yet. Far more
125  
126 =head1 SEE ALSO
127  
128 =over
129  
130 =item * L<Mail::Decency::Policy>
131  
132 =item * L<Mail::Decency::ContentFilter>
133  
134 =item * L<Mail::Decency::LogParser>
135  
136 =item * http://blog.foaa.de/decency
137  
138 =back
139  
140  
141  
142 =head1 AUTHOR
143  
144 Ulrich Kautz <uk@fortrabbit.de>
145  
146 =head1 COPYRIGHT
147  
148 Copyright (c) 2010 the L</AUTHOR> as listed above
149  
150 =head1 LICENCSE
151  
152 This library is free software and may be distributed under the same terms as perl itself.
153  
154 =cut
155  
156  
157 1;