lib/Exim/Grey.pm
author Heiko Schlittermann <hs@schlittermann.de>
Wed, 21 Jun 2017 00:26:46 +0200
changeset 73 e2559ee78cb3
parent 72 f095f28db247
permissions -rw-r--r--
[snapshot] working?
58
27440e1334b7 Use lib/ and ExtUtils::MakeMaker
heiko
parents: 57
diff changeset
     1
package Exim::Grey;
67
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
     2
# for usage please see at the end
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
     3
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
     4
use strict;
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
     5
use warnings;
58
27440e1334b7 Use lib/ and ExtUtils::MakeMaker
heiko
parents: 57
diff changeset
     6
use base 'Exporter';
12
de787ecf7c3c DB_File
heiko
parents: 9
diff changeset
     7
use Carp;
de787ecf7c3c DB_File
heiko
parents: 9
diff changeset
     8
69
0f66e8a1364a Export seen()
Heiko Schlittermann <hs@schlittermann.de>
parents: 68
diff changeset
     9
our @EXPORT_OK   = qw(unseen seen getDBDir connectDB getDefault);
63
8525154c1389 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 61
diff changeset
    10
our %EXPORT_TAGS = (all => \@EXPORT_OK,);
8525154c1389 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 61
diff changeset
    11
our $VERSION     = '2.0';
58
27440e1334b7 Use lib/ and ExtUtils::MakeMaker
heiko
parents: 57
diff changeset
    12
73
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    13
our $verbose;
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    14
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    15
sub verbose {
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    16
    return if not $verbose;
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    17
    print STDERR __PACKAGE__ . ': ' . map { s/\0//gr } @_, "\n";
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    18
}
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    19
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    20
sub exim_bool { $_[0] ? 'yes' : 'no' }
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    21
12
de787ecf7c3c DB_File
heiko
parents: 9
diff changeset
    22
# You may choose, but DB_File's footprint is smaller.
de787ecf7c3c DB_File
heiko
parents: 9
diff changeset
    23
# perl -MDB_File -e 'tie %h, ...':	real    0m0.063s
de787ecf7c3c DB_File
heiko
parents: 9
diff changeset
    24
# perl -MBerkeleyDB -e 'tie %h, ...':	real	0m0.112s
de787ecf7c3c DB_File
heiko
parents: 9
diff changeset
    25
# And DB_File is part of the Perl core distribution (?)
de787ecf7c3c DB_File
heiko
parents: 9
diff changeset
    26
# use BerkeleyDB;
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    27
# use DB_File;
73
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    28
#
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    29
# But we need locking! DB_File::Lock isn't part of the corelist.
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    30
use DB_File::Lock;
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
    31
48
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
    32
my %DEFAULT = (
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
    33
    delay => 600,
67
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
    34
    db    => 'seen',
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
    35
);
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
    36
12
de787ecf7c3c DB_File
heiko
parents: 9
diff changeset
    37
# some helper functions
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
    38
sub getDBDir();
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
    39
sub findExim(;$);
12
de787ecf7c3c DB_File
heiko
parents: 9
diff changeset
    40
sub connectDB($$);
47
1c2ae71d226b - viel verändert
heiko
parents: 44
diff changeset
    41
sub getDefault() { %DEFAULT }
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
    42
31
7d2c9f3186f4 wildcard behaviour cleaned
heiko
parents: 23
diff changeset
    43
# dbm file is relativ to $spool_directory/grey, EXCEPT its name
73
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    44
# starts with "/".
47
1c2ae71d226b - viel verändert
heiko
parents: 44
diff changeset
    45
73
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    46
sub unseen_ {
61
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
    47
    my $item   = shift;
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
    48
    my $delay  = shift // $DEFAULT{delay};
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
    49
    my $db     = shift // $DEFAULT{db};
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
    50
    my $now    = time();
73
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    51
    my ($auto) = $item =~ /.*?\/(.+?)$/ # remember the /<autokey> from the item
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    52
        and $item =~ s/\/.*?$//;        # and remove it from the item
48
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
    53
    my $rc;
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
    54
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    55
    connectDB(\my %h, $db);
48
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
    56
73
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    57
    return 1    # not unseen, ergo known
61
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
    58
      if defined $auto and is_whitelisted($auto, \%h);
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    59
73
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    60
    my $key = "$item\0";                # for compatibility with Exim's dbm functions
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    61
73
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    62
    # We do not know anything about the client -> unknown.
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    63
    # But remember that key with the associated "auto" subkey
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    64
    if (not exists $h{$key}) {
73
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    65
        $h{$key} = serialize(t0 => $now, t1 => $now, count => 0, auto => [defined $auto ? $auto : ()]);
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    66
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    67
        verbose "unseen: $item" if $verbose;
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    68
        return 1;
48
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
    69
    }
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    70
73
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    71
    my %entry = deserialize($h{$key});
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    72
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    73
    # we know the client, but last contact was recently (too fast)
73
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    74
    # should we add it to our list auto entries too?
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    75
    if ($now - $entry{t0} < $delay) {
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    76
        return 1;
48
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
    77
    }
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    78
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
    79
    # we know the client, was patiently enough
73
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    80
    whitelist(\%h, uniq($auto, $entry{auto})) if defined $auto;
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    81
    $entry{count}++;
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    82
    $h{$key} = $_ = serialize(%entry);
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    83
    verbose "seen: $_" if $verbose;
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    84
    return 0;
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
    85
}
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
    86
73
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    87
sub unseen { exim_bool unseen_ @_ }
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
    88
sub seen { exim_bool !unseen_ @_ }
69
0f66e8a1364a Export seen()
Heiko Schlittermann <hs@schlittermann.de>
parents: 68
diff changeset
    89
52
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    90
# According to a thought from "David Woodhouse <dwmw2@infradead.org>"
61
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
    91
# on exim-users@exim.org (Thu, 08 May 2008 13:10:21 +0100,
52
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    92
# Message-Id: <1210248621.25560.1088.camel@pmac.infradead.org>) we
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    93
# should have the ability to "auto whitelist" hosts which are known
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    94
# for retries, because there is no benefit in greylisting them.
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    95
#
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    96
# Most safe approach would be something based on message id.
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    97
# If we see the message id a second time it indicates successful retry.
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    98
# But we do not see the message id the first time we reject the message.
23160db926d4 added some comments
heiko
parents: 50
diff changeset
    99
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   100
# This function has to be called twice per message delivery attempt
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   101
# <KEY> <$sender_host_address> <$sender_helo_name>
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   102
# (Where <KEY> is something like <$sender_address>+<$local_part@$domain>
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   103
# If we see the same message a second time (same message means here:
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   104
# same greylist criteria
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   105
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   106
sub whitelist {
73
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   107
    my ($h, @items) = (shift, uniq(@_));
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   108
    my $now = time;
73
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   109
    warn __PACKAGE__ . ": whitelist: @items\n"
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   110
        if $verbose;
72
f095f28db247 Implement auto-history
Heiko Schlittermann <hs@schlittermann.de>
parents: 70
diff changeset
   111
    $h->{"$_\0"} = "$now $now 1 auto\0"
f095f28db247 Implement auto-history
Heiko Schlittermann <hs@schlittermann.de>
parents: 70
diff changeset
   112
        foreach uniq(@items);
f095f28db247 Implement auto-history
Heiko Schlittermann <hs@schlittermann.de>
parents: 70
diff changeset
   113
}
f095f28db247 Implement auto-history
Heiko Schlittermann <hs@schlittermann.de>
parents: 70
diff changeset
   114
f095f28db247 Implement auto-history
Heiko Schlittermann <hs@schlittermann.de>
parents: 70
diff changeset
   115
sub uniq {
f095f28db247 Implement auto-history
Heiko Schlittermann <hs@schlittermann.de>
parents: 70
diff changeset
   116
    my %h = map { $_, undef } @_;
f095f28db247 Implement auto-history
Heiko Schlittermann <hs@schlittermann.de>
parents: 70
diff changeset
   117
    return keys %h;
52
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   118
}
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   119
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   120
sub is_whitelisted {
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   121
    my ($item, $h) = @_;
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   122
    my $key = "$item\0";
52
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   123
73
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   124
    warn __PACKAGE__ . 'is '
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   125
        . (exists $h->{$key} ? '' : 'not')
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   126
        . "whitelisted: $item\n" if $verbose;
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   127
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   128
    return 0 if not exists $h->{$key};
61
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
   129
59
8088c95fac5d Fix small bugs
heiko
parents: 58
diff changeset
   130
    my ($t0, undef, $cnt, $flag) = split /[ \0]/, $h->{$key};
57
9db6f9fdba12 Tag the auto-whitelist keys
heiko
parents: 55
diff changeset
   131
    $h->{$key} = join(' ' => $t0, time, ++$cnt, $flag ? $flag : ()) . "\0";
52
23160db926d4 added some comments
heiko
parents: 50
diff changeset
   132
73
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   133
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   134
    return 1;
38
329e69e5c6dd - started some auto whitelist implementation
heiko
parents: 36
diff changeset
   135
}
329e69e5c6dd - started some auto whitelist implementation
heiko
parents: 36
diff changeset
   136
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
   137
# Get the directory where we could store the database file(s)
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
   138
# If we're running under exim it's easy, otherwise we've to find exim
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
   139
# and then ask...
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
   140
sub getDBDir() {
48
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   141
    my ($spooldir, $dbdir);
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   142
    eval { $spooldir = Exim::expand_string('$spool_directory') };
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   143
    if (not defined $spooldir) {
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   144
        my $exim = findExim();
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   145
        chomp($spooldir = `$exim -be '\$spool_directory'`);
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   146
        die "Can't find spooldir" if not defined $spooldir;
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   147
    }
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   148
    -d ($dbdir = "$spooldir/grey") and return $dbdir;
16
b47059897e9b DB-Autocreation
heiko
parents: 12
diff changeset
   149
61
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
   150
    my ($mode, $owner, $group) = (stat $spooldir)[2, 4, 5];
48
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   151
    {
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   152
        local $) = $group;
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   153
        local $> = $owner;
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   154
        $mode &= 0777;
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   155
        mkdir $dbdir, $mode or die "Can't create $dbdir: $!";
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   156
    }
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   157
    return $dbdir;
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
   158
}
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
   159
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
   160
sub findExim(;$) {
48
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   161
    my $path = shift || $ENV{PATH};
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   162
    my $exim;
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   163
    foreach (split /:/, $ENV{PATH}) {
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   164
        -x ($exim = "$_/exim")  and return $exim;
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   165
        -x ($exim = "$_/exim4") and return $exim;
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   166
    }
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   167
    die "Can't find exim binary (missing .../sbin dirs in PATH?";
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
   168
}
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
   169
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   170
sub connectDB($$) {
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   171
    my ($h, $db) = @_;
73
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   172
    $db = getDBDir() . "/$db" unless $db =~ m(^/);
47
1c2ae71d226b - viel verändert
heiko
parents: 44
diff changeset
   173
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   174
    # Creation of DB-File if it doesn't exist
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   175
    # to avoid races we change our own uid/gid for creation of
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   176
    # this file.
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   177
    if (!-f $db) {
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   178
        (my $dir = $db) =~ s/^(.*)\/.*?$/$1/;
47
1c2ae71d226b - viel verändert
heiko
parents: 44
diff changeset
   179
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   180
        # copy mode, uid, gid from the directory
61
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
   181
        my ($mode, $user, $group) = (stat $dir)[2, 4, 5]
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   182
          or die "Can't stat $dir: $!";
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   183
        my $umask = umask(($mode & 0777) ^ 0777);
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   184
        local $) = $group;
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   185
        local $> = $user;
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   186
        open(X, ">>$db") or die "Can't create $db: $!";
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   187
        close(X);
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   188
        umask $umask;
48
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   189
    }
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   190
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   191
    # now test which of the DB-Modules has been loaded
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   192
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   193
    if (exists &BerkeleyDB::Hash::TIEHASH) {
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   194
        no strict;
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   195
        my $umask = umask 077;
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   196
        tie %$h, "BerkeleyDB::Hash", -Filename => $db
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   197
          or die "$0: $db: $!";
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   198
        return $db;
48
61a2dc11f50b - perltidy
heiko
parents: 47
diff changeset
   199
    }
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   200
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   201
    if (exists &DB_File::Lock::TIEHASH) {
61
68eb79f3f500 [perltidy]
Heiko Schlittermann <hs@schlittermann.de>
parents: 59
diff changeset
   202
        tie %$h, 'DB_File::Lock', [$db], 'write'
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   203
          or die "$0: $db: $!";
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   204
        return $db;
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   205
    }
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   206
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   207
    if (exists &DB_File::TIEHASH) {
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   208
        tie %$h, 'DB_File', $db or die "$0: $db: $!";
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   209
        warn "$0: using DB_File, no locking is possible!\n";
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   210
        return $db;
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   211
    }
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   212
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   213
    die "Can't connect to database driver";
47
1c2ae71d226b - viel verändert
heiko
parents: 44
diff changeset
   214
}
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   215
73
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   216
# These two functions do not truly serialize/de-serialize the data
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   217
# passed. They're specialiased to a fixed data format:
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   218
# serialized: <t0> <t1> <count> [auto=<item>[,<item>]...]
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   219
# structured: (
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   220
#   t0 => <t0>,
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   221
#   t1 => <t1>,
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   222
#   count => <count>,
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   223
#   auto => [item, item, …],
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   224
#   )
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   225
sub serialize {
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   226
    my %data = @_;
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   227
    my $auto = (ref $data{auto} && @{$data{auto}}) ?  join ',', @{$data{auto}} : '';
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   228
    return "$data{t0} $data{t1} $data{count} auto=$auto\0";
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   229
}
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   230
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   231
sub deserialize {
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   232
    my @data = split / /, $_[0] =~ s/\0$//r;
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   233
    my %data;
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   234
    ($data{t0}, $data{t1}, $data{count}) = splice @data, 0, 3;
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   235
    if ($data[0] =~ /^auto=(.*)/) {
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   236
        $data{auto} = [split /,/, $1];
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   237
    }
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   238
    return %data;
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   239
}
e2559ee78cb3 [snapshot] working?
Heiko Schlittermann <hs@schlittermann.de>
parents: 72
diff changeset
   240
50
79b972eb8990 - exim-exigrey.pl: end with 1 (true)
heiko
parents: 48
diff changeset
   241
1;
9
417562509dbe Installation to .../share and ../sbin
heiko
parents:
diff changeset
   242
67
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   243
__END__
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   244
=head1 NAME
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   245
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   246
 Exim::Grey
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   247
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   248
=head1 SYNOPSIS
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   249
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   250
 perl_startup use Exim::Grey qw(unseen);
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   251
 ...
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   252
 acl rcpt
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   253
    defer condition = ${perl{unseen}{<$sender_address>:<$local_part@$domain>}}
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   254
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   255
=head1 DESCRIPTION
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   256
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   257
This is a module to be loade by Exim, the MTA. On request it exports
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   258
a single function C<unseen()>. This function may be used in the ACL section
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   259
to support greylisting.
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   260
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   261
=head1 FUNCTIONS
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   262
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   263
=over
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   264
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   265
=item scalar B<unseen>(I<key>, I<delay>, I<db>)
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   266
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   267
This function returns I<true> if the key is already known in the I<db> database
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   268
for the minimum I<delay> time. (Note: The database may be cleaned regularly by
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   269
the compangion L<exigrey> tool.)
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   270
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   271
The I<key> is mandotory, the default I<delay> is 600 seconds and the default I<db>
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   272
is called F<seen>.
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   273
70
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   274
I<Key> may contain a suffix, separated by "/". This suffix is used for
67
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   275
automatic whitelisting.
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   276
70
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   277
=item scalar B<seen>(I<key>, I<delay>, I<db>)
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   278
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   279
The same as C<unseen()>, but with reversed result.
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   280
67
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   281
=back
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   282
70
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   283
=head1 EXAMPLES
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   284
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   285
=head2 Greylisting
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   286
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   287
First you have to include B<Exim::Grey> into your Exim. If Exim is built with Perl
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   288
support, the configuration syntax allows for C<perl_startup>:
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   289
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   290
    perl_startup = use Exim::Grey qw(unseen);
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   291
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   292
In the ACL section of the configuration can check if a given key (sender, or combination
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   293
of sender and recipient, or whatever) is new (unseen):
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   294
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   295
    defer condition = ${perl{unseen}{<$sender_address>:$<local_part@$domain>}}
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   296
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   297
If the same condition is checked more then I<delay> later, the C<unseen> function returns
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   298
false.
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   299
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   300
=head2 Greylisting + automatic whitelisting
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   301
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   302
Greylisting gets annoying if you do it for senders that are already known to retry. Thus it might be
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   303
good to maintain a whitelist. You may use a suffix to your key, separated by "/". Once the greylist
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   304
filter is passed, the used suffixes are registered with the whitelist.
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   305
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   306
  t
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   307
  |
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   308
  0  a->b/x  # a->b never seen, suffix never seen: greylist
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   309
  1  a->b/y  # a->b again: accept AND put x and y to the whitelist,
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   310
  |          # as they are known to retry
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   311
  2  c->b/x  # c->b unknown, but x is already whitelisted: accept
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   312
  3  d->b/y  # d->b unknown, but y is already whitelisted: accept
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   313
  |
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   314
  v
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   315
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   316
This can be implemented in your ACL as:
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   317
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   318
    defer condition = ${perl{unseen}{<$sender_address>:$<local_part@$domain>/$sender_host_address}}
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   319
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   320
But, if I<a> and I<b> are the sender and the recipient address, and the
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   321
subkey is the sender host address, a spammer might send a forged message
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   322
after t0, to get whitelisted.
bb6af74ba8b2 Documentation
Heiko Schlittermann <hs@schlittermann.de>
parents: 69
diff changeset
   323
67
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   324
=head1 INTERNALS
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   325
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   326
=head2 Format of the database
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   327
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   328
The record structure is
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   329
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   330
 key:   item\0
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   331
 value: timestamp(creation) timestamp(usage) counter[ flags]\0
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   332
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   333
This way we are compatible with ${lookup{...}dbm{...}}
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   334
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   335
=head1 FILES
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   336
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   337
The database files are placed in C<$spool_directory/grey/>.
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   338
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   339
=head1 SEE ALSO
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   340
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   341
The companion tool L<exigrey> should be used for inspection and manipulation
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   342
of the database.
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   343
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   344
=cut
da29842506b4 Add POD documentation to the Exim::Grey.pm
Heiko Schlittermann <hs@schlittermann.de>
parents: 66
diff changeset
   345
55
ab282b335eb5 Allow autowhitelists
heiko
parents: 52
diff changeset
   346
# vim:aw et sw=4 ts=4: