File: courier-filter-perl.conf.full

package info (click to toggle)
courier-filter-perl 0.200%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 420 kB
  • sloc: perl: 1,484; sh: 126; makefile: 9
file content (152 lines) | stat: -rw-r--r-- 5,125 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# 
# Configuration file for Courier::Filter, the purely Perl-based filter
# framework for the Courier MTA.
#
# (This is a sample configuration file.)
#
# $Id: courier-filter-perl.conf.full 211 2008-03-23 01:25:20Z julian $
#
##############################################################################

use Courier::Filter::Logger::Syslog;
use Courier::Filter::Logger::File;

use Courier::Filter::Module::BlankBody;
use Courier::Filter::Module::DNSBL;
use Courier::Filter::Module::SPF;
use Courier::Filter::Module::SPFout;
use Courier::Filter::Module::Envelope;
use Courier::Filter::Module::Header;
use Courier::Filter::Module::FakeDate;
use Courier::Filter::Module::BlankBody;
use Courier::Filter::Module::ClamAVd;
use Courier::Filter::Module::Parts;
use Courier::Filter::Module::SendCopy;

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

    # Module Declarations:
    ##############################################################################

    modules     => [
        
        # Reject weird subjects:
        Courier::Filter::Module::Header->new(
            fields      => {
                subject         => qr/fuzzybuzzy/
            },
            response    => 'No fuzzybuzzy, please!',
            testing     => TRUE,
            logger      => Courier::Filter::Logger::Syslog->new()
        ),
        
        # Exempt mails from a forwarding account from the remaining filters:
        Courier::Filter::Module::Header->new(
            inverse     => TRUE,
            fields      => {
                'x-resent-for'  => 'me@forwarding-target.net'
            }
        ),
        
        # Reject black-listed sending IP addresses:
        Courier::Filter::Module::DNSBL->new(
            zones       => [qw(
                bl.spamcop.net
                relays.ordb.org
                dnsbl.njabl.org
                dynablock.njabl.org
                dul.dnsbl.sorbs.net
                zombie.dnsbl.sorbs.net
            )]
        ),
        
        # Inbound SPF HELO filter:
        Courier::Filter::Module::SPF->new(
            scope               => 'helo',
            match_on            => ['fail', 'softfail', 'permerror', 'temperror']
        ),
        
        # Inbound SPF MAIL FROM filter:
        Courier::Filter::Module::SPF->new(
            scope               => 'mfrom',
            match_on            => ['fail', 'permerror', 'temperror'],
            trusting            => TRUE
        ),
        
        # Outbound SPF filter:
        Courier::Filter::Module::SPFout->new(
            match_on            => ['fail', 'softfail', 'permerror', 'temperror'],
            force_response      => 'You are not authorized to use the domain "%{o}" in your sender adress when sending mail through this host (%{xr}).'
        ),
        
        # Filter certain virm:
        Courier::Filter::Module::Envelope->new(
            fields      => {
                'sender'        => 'paul.greenfield@unisys.com'
            }
        ),
        
        # Filter messages with fake dates:
        Courier::Filter::Module::FakeDate->new(
            forward_tolerance   => { hours => 4 },
            backward_tolerance  => { days  => 7 }
        ),
        
        # Filter messages with blank bodies:
        Courier::Filter::Module::BlankBody->new(
            trusting    => TRUE
        ),
        
        # ClamAV daemon filter:
        Courier::Filter::Module::ClamAVd->new(),
        
        # SpamAssassin filter:
        Courier::Filter::Module::SpamAssassin->new(
            prefs_file  => '/etc/courier/filters/courier-filter-spamassassin.cf'
        ),
        
        # Reject various virm:
        Courier::Filter::Module::Parts->new(
            max_message_size    => 1024*1024,
            max_part_size       =>  200*1024,
            views       => ['raw', 'zip'],
            signatures  => [
                {
                    file_name   => qr/\.(com|exe|lnk|pif|scr|vbs)$/i,
                    views       => ['raw'],
                    response    => 'Win32 executable attachment detected'
                },
                {
                    encrypted   => TRUE,
                    views       => ['zip'],
                    response    => 'Worm suspected (only worms and fools use ZIP encryption)'
                },
                {
                    # Detect one of the images sent by W32.Swen, as a
                    # reliable fallback.
                    size        => 3639,
                    digest_md5  => '476225849b39aff9bb18d7fac79ad7da',
                    response    => 'Crippled worm suspected: W32.Swen'
                }
            ]
        ),
        
        # Copy sent messages:
        Courier::Filter::Module::SendCopy->new(
            match_authenticated_user => 'username',
            copy_to_sender           => TRUE
        )
        
    ]
    
};

# vim:tw=79