/[smeserver]/rpms/qpsmtpd/sme9/0017-added-p0f-support-to-greylist-plugin.patch
ViewVC logotype

Contents of /rpms/qpsmtpd/sme9/0017-added-p0f-support-to-greylist-plugin.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Sat Feb 2 00:59:44 2013 UTC (11 years, 9 months ago) by slords
Branch: MAIN
CVS Tags: qpsmtpd-0_84-14_el6_sme, qpsmtpd-0_84-16_el6_sme, qpsmtpd-0_84-12_el6_sme, qpsmtpd-0_96-7_el6_sme, qpsmtpd-0_96-2_el6_sme, qpsmtpd-0_84-13_el6_sme, qpsmtpd-0_84-6_el6_sme, qpsmtpd-0_84-18_el6_sme, qpsmtpd-0_84-9_el6_sme, qpsmtpd-0_84-4_el6_sme, qpsmtpd-0_96-11_el6_sme, qpsmtpd-0_84-15_el6_sme, qpsmtpd-0_96-4_el6_sme, qpsmtpd-0_96-3_el6_sme, qpsmtpd-0_96-10_el6_sme, qpsmtpd-0_84-17_el6_sme, qpsmtpd-0_84-7_el6_sme, qpsmtpd-0_96-5_el6_sme, qpsmtpd-0_84-10_el6_sme, qpsmtpd-0_84-8_el6_sme, qpsmtpd-0_96-1_el6_sme, qpsmtpd-0_84-5_el6_sme, qpsmtpd-0_96-6_el6_sme, qpsmtpd-0_96-8_el6_sme, qpsmtpd-0_84-11_el6_sme, qpsmtpd-0_96-9_el6_sme, HEAD
* Fri Feb 1 2013 Shad L. Lords <slords@mail.com> 0.84-4.sme
- Update spec so building on rhel6 works [SME: 7263]

1 From b81d464c872867f8df65847f522db6a0df4a96bf Mon Sep 17 00:00:00 2001
2 From: Matt Simerson <matt@tnpi.net>
3 Date: Tue, 11 May 2010 01:31:52 -0400
4 Subject: added p0f support to greylist plugin
5
6 - these changes are in the previous TCPLOCAL patch. Documented here.
7 added p0f config option
8 added POD docs to explain usage
9 modified $dbdir selection logic. The previous logic failed when QPHOME was
10 not selected (as is the case when tests are being run).
11 Added '.' as the dir of last resort for $dbdir selection (others $EMPTY/dir
12 dumped greylisting database in / )
13
14 - These changes are included in this patch -
15 Added t/plugin_tests/greylisting, with greylist logic testing (tests are
16 disabled by default, as greylisting is disabled in config.sample/plugins)
17 Added example entry in config.sample/plugins
18
19 Signed-off-by: Robert <rspier@pobox.com>
20 ---
21 config.sample/plugins | 1 +
22 t/plugin_tests/greylisting | 111 ++++++++++++++++++++++++++++++++++++++++++++
23 2 files changed, 112 insertions(+), 0 deletions(-)
24 create mode 100644 t/plugin_tests/greylisting
25
26 diff --git a/config.sample/plugins b/config.sample/plugins
27 index 0b51124..6a01ba0 100644
28 --- a/config.sample/plugins
29 +++ b/config.sample/plugins
30 @@ -34,6 +34,7 @@ check_badrcptto
31 check_spamhelo
32
33 # sender_permitted_from
34 +# greylisting p0f genre,windows
35
36 auth/auth_flat_file
37 auth/authdeny
38 diff --git a/t/plugin_tests/greylisting b/t/plugin_tests/greylisting
39 new file mode 100644
40 index 0000000..38ed08b
41 --- /dev/null
42 +++ b/t/plugin_tests/greylisting
43 @@ -0,0 +1,111 @@
44 +use Qpsmtpd::Address;
45 +
46 +my $test_email = 'user@example.com';
47 +my $address = Qpsmtpd::Address->new( "<$test_email>" );
48 +
49 +my @greydbs = qw( denysoft_greylist.dbm denysoft_greylist.dbm.lock );
50 +foreach ( @greydbs ) {
51 + unlink $_ if -f $_;
52 +};
53 +
54 +sub register_tests {
55 + my $self = shift;
56 + $self->register_test("test_greylist_p0f_genre_miss", 1);
57 + $self->register_test("test_greylist_p0f_genre_hit", 1);
58 + $self->register_test("test_greylist_p0f_distance_hit", 1);
59 + $self->register_test("test_greylist_p0f_distance_miss", 1);
60 + $self->register_test("test_greylist_p0f_link_hit", 1);
61 + $self->register_test("test_greylist_p0f_link_miss", 1);
62 + $self->register_test("test_greylist_p0f_uptime_hit", 1);
63 + $self->register_test("test_greylist_p0f_uptime_miss", 1);
64 +}
65 +
66 +sub test_greylist_p0f_genre_miss {
67 + my $self = shift;
68 +
69 + $self->{_greylist_config}{'p0f'} = 'genre,Linux';
70 + $self->connection->notes('p0f'=> { genre => 'windows', link => 'dsl' } );
71 + my $r = $self->rcpt_handler( $self->qp->transaction );
72 +
73 + ok( $r == 909, 'p0f genre miss');
74 +}
75 +
76 +sub test_greylist_p0f_genre_hit {
77 + my $self = shift;
78 +
79 + $self->{_greylist_config}{'p0f'} = 'genre,Windows';
80 + $self->connection->notes('p0f'=> { genre => 'windows', link => 'dsl' } );
81 + $self->qp->transaction->sender( $address );
82 + my $r = $self->rcpt_handler( $self->qp->transaction );
83 +
84 + ok( $r eq 'This mail is temporarily denied', 'p0f genre hit');
85 +}
86 +
87 +sub test_greylist_p0f_distance_hit {
88 + my $self = shift;
89 +
90 + $self->{_greylist_config}{'p0f'} = 'distance,8';
91 + $self->connection->notes('p0f'=> { distance=>9 } );
92 + $self->qp->transaction->sender( $address );
93 + my $r = $self->rcpt_handler( $self->qp->transaction );
94 +
95 + ok( $r eq 'This mail is temporarily denied', 'p0f distance hit');
96 +}
97 +
98 +sub test_greylist_p0f_distance_miss {
99 + my $self = shift;
100 +
101 + $self->{_greylist_config}{'p0f'} = 'distance,8';
102 + $self->connection->notes('p0f'=> { distance=>7 } );
103 + $self->qp->transaction->sender( $address );
104 + my $r = $self->rcpt_handler( $self->qp->transaction );
105 +
106 + ok( $r == 909, 'p0f distance miss');
107 +}
108 +
109 +sub test_greylist_p0f_link_hit {
110 + my $self = shift;
111 +
112 + $self->{_greylist_config}{'p0f'} = 'link,dsl';
113 + $self->connection->notes('p0f'=> { link=>'DSL' } );
114 + $self->qp->transaction->sender( $address );
115 + my $r = $self->rcpt_handler( $self->qp->transaction );
116 +
117 + ok( $r eq 'This mail is temporarily denied', 'p0f link hit');
118 +}
119 +
120 +sub test_greylist_p0f_link_miss {
121 + my $self = shift;
122 +
123 + $self->{_greylist_config}{'p0f'} = 'link,dsl';
124 + $self->connection->notes('p0f'=> { link=>'Ethernet' } );
125 + $self->qp->transaction->sender( $address );
126 + my $r = $self->rcpt_handler( $self->qp->transaction );
127 +
128 + ok( $r == 909, 'p0f link miss');
129 +}
130 +
131 +sub test_greylist_p0f_uptime_hit {
132 + my $self = shift;
133 +
134 + $self->{_greylist_config}{'p0f'} = 'uptime,100';
135 + $self->connection->notes('p0f'=> { uptime=> 99 } );
136 + $self->qp->transaction->sender( $address );
137 + my $r = $self->rcpt_handler( $self->qp->transaction );
138 +
139 + ok( $r eq 'This mail is temporarily denied', 'p0f uptime hit');
140 +}
141 +
142 +sub test_greylist_p0f_uptime_miss {
143 + my $self = shift;
144 +
145 + $self->{_greylist_config}{'p0f'} = 'uptime,100';
146 + $self->connection->notes('p0f'=> { uptime=>500 } );
147 + $self->qp->transaction->sender( $address );
148 + my $r = $self->rcpt_handler( $self->qp->transaction );
149 +
150 + ok( $r == 909, 'p0f uptime miss');
151 +}
152 +
153 +
154 +
155 --
156 1.7.2.2
157

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed