Mail::Decency::Policy
use Mail::Decency::Policy; # run in server mode my $policy = Mail::DecencyPolicy->new( { config => '/etc/decency/policy.yml' } ); $policy->run; # run in maintenance mode $policy->maintenance; # print statistics $policy->print_stats;
Policy server for Postfix or other MTAs. Could be combined with Mail::Decency::ContentFilter. Besides the existing Modules it is easy extendable for custom needs.
To implement this in postfix, add a "check_policy_service" directive in one of the restriction classes:
smtpd_recipient_restrictions = # ... check_policy_service inet:127.0.0.1:15000 # ...
If you want to place this anywhere before the smtpd_recipient_restrictions, you probaly have to enable "smtpd_delay_reject" (depending on the modules you use, but to be save..)
smtpd_delay_reject = yes
The configuration can be provided via YAML file or as HashRef.
Example:
--- include: - database.yml - cache.yml - logging.yml weight_threshold: -100 force_check_local: 1 default_reject_message: "use decency" no_reject_detail: 0 disable_prepend: 0 forward_scoring: 1 forward_sign_key: sign.key enable_stats: 1 server: host: 127.0.0.1 port: 15000 instances: 3 policy: - CWL: policy/cwl.yml - DNSBL: policy/dnsbl.yml - CBL: policy/cbl.yml - SPF: policy/spf.yml - Association: policy/association.yml - GeoWeight: policy/geo-weight.yml - Honeypot: policy/honeypot.yml - Greylist: policy/greylist.yml - Throttle: policy/throttle.yml
SQL CREATE statements (SQLite) for the stats role:
-- TABLE: stats_contentfilter_performance (SQLITE): CREATE TABLE STATS_CONTENTFILTER_PERFORMANCE (calls varchar(10), runtime real, period varchar(10), type varchar(32), start integer, module varchar(32), id INTEGER PRIMARY KEY); CREATE UNIQUE INDEX STATS_CONTENTFILTER_PERFORMANCE_MODULE_PERIOD_START_TYPE ON STATS_CONTENTFILTER_PERFORMANCE (module, period, start, type); -- TABLE: stats_contentfilter_response (SQLITE): CREATE TABLE STATS_CONTENTFILTER_RESPONSE (period varchar(10), type varchar(32), start integer, module varchar(32), id INTEGER PRIMARY KEY); CREATE UNIQUE INDEX STATS_CONTENTFILTER_RESPONSE_MODULE_PERIOD_START_TYPE ON STATS_CONTENTFILTER_RESPONSE (module, period, start, type);
See Mail::Decency::Policy::Core
Threshold of spam score before reject ( actual score <= threeshold == spam )
Instance of Mail::Decency::Core::SessionItem::Policy
Wheter passing everything from localhost or not
Default: 1
Default reject message string (after the SMTP REJECT command .. "REJECT message")
Default: use decency
Wheter pass detailed information of why a particular REJECT has been thrown to the sender or not (not=always the default message)/
Default: 0
Wheter forward scoring informations after policies or not
Wheter disabling the prepend of instance information fully (implies forward_scoring=0)
Path to a file containing a private key for signing forwarded
Instance of Crypt::OpenSSL::RSA representing the forward sign key
Loads policy modules, inits caches, inits databases ..
Returns subref to handlers, called by Mail::Decency::Core::POEForking::Postfix
# all handlers my $handlers_ref = $policy->get_handlers(); # only the awl handler my $handlers_ref = $policy->get_handlers( qw/ AWL / );
Starts all POE servers without calling the POE::Kernel->run
Start and run the server via POE::Kernel->run
Called at start of every handle cycle. Inits all handle/session-variables
Clears all info from session cache, returns final response
Add weight and filter info to current instance.
Throws _FinalStateException if weighting indicates spam
$module
The module which called the method.
$weight
Positive or negative score.
$details
Details for the MIME header
$reject_message
If this scoring makes the rejection final, this is the rejection message
Throws Mail::Decency::Core::Exception exception if state is not DUNNO.
Adds message to list of response messages
Add message (not details) to response
Mail::Decency::Policy::Association
Mail::Decency::Policy::CBL
Mail::Decency::Policy::CWL
Mail::Decency::Policy::Core
Mail::Decency::Policy::DNSBL
Mail::Decency::Policy::Greylist
Mail::Decency::Policy::GeoWeight
Mail::Decency::Policy::Honeypot
Mail::Decency::Policy::SPF
Mail::Decency::Policy::Throttle
Mail::Decency::Core::Stats
Mail::Decency::Core::SessionItem
Mail::Decency::Core::SessionItem::Policy
Mail::Decency
Ulrich Kautz <uk@fortrabbit.de>
Copyright (c) 2010 the "AUTHOR" as listed above
This library is free software and may be distributed under the same terms as perl itself.
To install Mail::Decency, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mail::Decency
CPAN shell
perl -MCPAN -e shell install Mail::Decency
For more information on module installation, please visit the detailed CPAN module installation guide.