NAME

Mail::Decency::Policy::Greylist

DESCRIPTION

A greylist implementation (http://www.greylisting.org/) for decency.

CONFIG

--- 

disable: 0

# interval in seconds until a sender is allowed to re-send
#   and pass
min_interval: 60

# per default, the greylist does not work as a whitelist, but
#   a blacklist. it will reject (temporary) any mail not on the
#   list, but does not explicit allow mails which are on the list
#   to be passed (DUNNO).. you can enable passing by setting this
#   to OK, thus any mail is on the list will pass.
#   check with your restriction-classes to determine the better
#   behavior for your mailserver
pass_code: DUNNO

# scoring awre. will put mails only on the permant whitelist
#   (host or domain) if it has been scored zero or above
#   this should keep suspicious mails from the whitelist
scoring_aware: 1

# policy for permanently whitelisting a whole sender server
hosts_policy:
    
    # threshold of different sender mails
    unique_sender: 5
    
    # threshold of mails received from ONE address finally
    #   putting the host on the whitelist
    one_address: 10

# policy for permanently whitelisting a whole sender domain
#   use this with care and SPF (beforehand!)
domains_policy:
    
    # threshold of different sender mails
    unique_sender: 5
    
    # threshold of mails received from ONE address finally
    #   putting the host on the whitelist
    one_address: 10

DATABASE

-- contains all sender host ips, which are or are to be
--  whitelisted due to lot's of positives
CREATE TABLE greylist_client_addresss (
    id INTEGER PRIMARY KEY,
    client_address VARCHAR( 39 ),
    counter integer,
    last_seen integer
);
CREATE UNIQUE INDEX greylist_client_addresss_uk ON greylist_client_addresss( client_address );

-- contains all sender_domains, which are or are to be
--  whitelisted due to lot's of positives
CREATE TABLE greylist_sender_domain (
    id INTEGER PRIMARY KEY,
    sender_domain varchar( 255 ),
    counter integer,
    last_seen integer,
    unique_sender BLOB
);
CREATE UNIQUE INDEX greylist_sender_domain_uk ON greylist_sender_domain( sender_domain );

-- contains all (sender -> recipient) address pairs which
--  are used to allow the second send attempt
CREATE TABLE greylist_sender_recipient (
    id INTEGER PRIMARY KEY,
    sender_address varchar( 255 ),
    recipient_address varchar( 255 ),
    counter integer,
    last_seen integer,
    unique_sender BLOB
);
CREATE UNIQUE INDEX greylist_sender_recipient_uk ON greylist_sender_recipient( sender_address, recipient_address );

CLASS ATTRIBUTES

hosts_policy : HashRef[HashRef[Int]]

Determines accommodation requirements per host (IP)

domains_policy : HashRef[HashRef[Int]]

Determines accommodation requirements per domain (sender)

min_interval : Int

Min interval

reject_message : Str

Message for greylisted rejection.

Default: "Greylisted - Patience, young jedi"

pass_code : Str

Set to "OK" if mails on the found on the greylist shall be whitelisted. Per default, they just won't be rejected (DUNNO).

scoring_aware : Bool

If scoring aware, will not use the host- and domain policies if score is below zero (spammy).

schema_definition : HashRef[HashRef]

Database schema

METHODS

init

handle

update_pass

Add counters to pass databases

maintenance

Called by policy server in maintenance mode. Cleans up obsolete entries in greylist databsae

AUTHOR

Ulrich Kautz <uk@fortrabbit.de>

COPYRIGHT

Copyright (c) 2010 the "AUTHOR" as listed above

LICENCSE

This library is free software and may be distributed under the same terms as perl itself.