| 1 | package Mail::Decency::Policy::CWL; | ||
| 2 | |||
| 3 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | extends 'Mail::Decency::Policy::Core::CWLCBL'; | |
| 5 | |||
| 6 | 1 | ▶ | use version 0.74; our $VERSION = qv( "v0.1.4" ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 1 | ▶ | use mro 'c3'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 1 | ▶ | use Data::Dumper; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | |||
| 12 | =head1 NAME | ||
| 13 | |||
| 14 | Mail::Decency::Policy::CWL | ||
| 15 | |||
| 16 | |||
| 17 | =head1 CONFIG | ||
| 18 | |||
| 19 | --- | ||
| 20 | |||
| 21 | disable: 0 | ||
| 22 | |||
| 23 | # enable negative cache | ||
| 24 | use_negative_cache: 1 | ||
| 25 | |||
| 26 | # enable all tables | ||
| 27 | tables: | ||
| 28 | - ips | ||
| 29 | - domains | ||
| 30 | - addresses | ||
| 31 | |||
| 32 | |||
| 33 | =head1 DESCRIPTION | ||
| 34 | |||
| 35 | Implementation of a custom whitelist based on sending server (ip/hostname), sending domain or (domain.tld) sending address (email@domain.tld). | ||
| 36 | |||
| 37 | =head1 DATABASE | ||
| 38 | |||
| 39 | CREATE TABLE cwl_ips ( | ||
| 40 | id INTEGER PRIMARY KEY, | ||
| 41 | recipient_domain varchar( 255 ), | ||
| 42 | client_address varchar( 39 ) | ||
| 43 | ); | ||
| 44 | CREATE UNIQUE INDEX cwl_ips_uk ON cwl_ips( recipient_domain, client_address ); | ||
| 45 | |||
| 46 | CREATE TABLE cwl_domains ( | ||
| 47 | id INTEGER PRIMARY KEY, | ||
| 48 | recipient_domain varchar( 255 ), | ||
| 49 | sender_domain varchar( 255 ) | ||
| 50 | ); | ||
| 51 | CREATE UNIQUE INDEX cwl_domains_uk ON cwl_domains( recipient_domain, sender_domain ); | ||
| 52 | |||
| 53 | CREATE TABLE cwl_addresses ( | ||
| 54 | id INTEGER PRIMARY KEY, | ||
| 55 | recipient_domain varchar( 255 ), | ||
| 56 | sender_address varchar( 255 ) | ||
| 57 | ); | ||
| 58 | CREATE UNIQUE INDEX cwl_addresses_uk ON cwl_addresses( recipient_domain, sender_address ); | ||
| 59 | |||
| 60 | =cut | ||
| 61 | |||
| 62 | =head1 CLASS ATTRIBUTES | ||
| 63 | |||
| 64 | =cut | ||
| 65 | |||
| 66 | 0 | ▶ | has schema_definition => ( is => 'ro', isa => 'HashRef[HashRef]', default => sub { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 67 | { | ||
| 68 | 0 | cwl => { | |
| 69 | ips => { | ||
| 70 | recipient_domain => [ varchar => 255 ], | ||
| 71 | client_address => [ varchar => 39 ], | ||
| 72 | -unique => [ 'recipient_domain', 'client_address' ] | ||
| 73 | }, | ||
| 74 | domains => { | ||
| 75 | recipient_domain => [ varchar => 255 ], | ||
| 76 | sender_domain => [ varchar => 255 ], | ||
| 77 | -unique => [ 'recipient_domain', 'sender_domain' ] | ||
| 78 | }, | ||
| 79 | addresses => { | ||
| 80 | recipient_domain => [ varchar => 255 ], | ||
| 81 | sender_address => [ varchar => 255 ], | ||
| 82 | -unique => [ 'recipient_domain', 'sender_address' ] | ||
| 83 | }, | ||
| 84 | } | ||
| 85 | }; | ||
| 86 | 1 | } ); | |
| 87 | |||
| 88 | |||
| 89 | =head1 METHODS | ||
| 90 | |||
| 91 | |||
| 92 | =head2 init | ||
| 93 | |||
| 94 | =cut | ||
| 95 | |||
| 96 | 0 | ▶ | sub init { |
|
Subroutine
init: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 97 | 0 | my ( $self ) = @_; | |
| 98 | |||
| 99 | 0 | $self->next::method(); | |
| 100 | 0 | $self->{ _handle_on_hit } = 'OK'; | |
| 101 | 0 | $self->{ _table_prefix } = 'cwl'; | |
| 102 | 0 | $self->{ _description } = 'Custom White List'; | |
| 103 | |||
| 104 | } | ||
| 105 | |||
| 106 | =head1 AUTHOR | ||
| 107 | |||
| 108 | Ulrich Kautz <uk@fortrabbit.de> | ||
| 109 | |||
| 110 | =head1 COPYRIGHT | ||
| 111 | |||
| 112 | Copyright (c) 2010 the L</AUTHOR> as listed above | ||
| 113 | |||
| 114 | =head1 LICENCSE | ||
| 115 | |||
| 116 | This library is free software and may be distributed under the same terms as perl itself. | ||
| 117 | |||
| 118 | =cut | ||
| 119 | |||
| 120 | |||
| 121 | |||
| 122 | 1 | 1; | |