/[smeserver]/rpms/qpsmtpd/sme9/0020-new-plugin-check_badmailfrom_patterns.patch
ViewVC logotype

Contents of /rpms/qpsmtpd/sme9/0020-new-plugin-check_badmailfrom_patterns.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, 3 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 e2ee6f13e5d0e2f064143479193fbe4bbc8aeaf8 Mon Sep 17 00:00:00 2001
2 From: Johan Almqvist <johan@almqvist.net>
3 Date: Sun, 11 Jul 2010 17:28:58 -0700
4 Subject: new plugin check_badmailfrom_patterns
5
6 Signed-off-by: Robert <rspier@pobox.com>
7 ---
8 plugins/check_badmailfrom_patterns | 64 ++++++++++++++++++++++++++++++++++++
9 1 files changed, 64 insertions(+), 0 deletions(-)
10 create mode 100644 plugins/check_badmailfrom_patterns
11
12 diff --git a/plugins/check_badmailfrom_patterns b/plugins/check_badmailfrom_patterns
13 new file mode 100644
14 index 0000000..528e49d
15 --- /dev/null
16 +++ b/plugins/check_badmailfrom_patterns
17 @@ -0,0 +1,64 @@
18 +#!/usr/bin/perl
19 +
20 +=pod
21 +
22 +=head1 SYNOPSIS
23 +
24 +This plugin checks the badmailfrom_patterns config. This allows
25 +special patterns to be denied (e.g. FQDN-VERP, percent hack, bangs,
26 +double ats).
27 +
28 +=head1 CONFIG
29 +
30 +Configuration is placed in the following file:
31 +
32 +F<config/badmailfrom_patterns>
33 +
34 +Patterns are stored in the format pattern\sresponse, where pattern
35 +is a Perl pattern expression. Don't forget to anchor the pattern
36 +(front ^ and back $) if you want to restrict it from matching
37 +anywhere in the string.
38 +
39 + ^streamsendbouncer@.*\.mailengine1\.com$ Your right-hand side VERP doesn't fool me
40 + ^return.*@.*\.pidplate\.biz$ I don' want it regardless of subdomain
41 + ^admin.*\.ppoonn400\.com$
42 +
43 +=head1 AUTHOR
44 +
45 +Johan Almqvist <johan-qpsmtpd@almqvist.net> based on L<check_badmailfrom>
46 +
47 +This software is free software and may be distributed under the same
48 +terms as qpsmtpd itself.
49 +
50 +=cut
51 +
52 +sub hook_mail {
53 + my ($self, $transaction, $sender, %param) = @_;
54 +
55 + my @badmailfrom = $self->qp->config("badmailfrom_patterns")
56 + or return (DECLINED);
57 +
58 + return (DECLINED) if ($sender->format eq "<>");
59 +
60 + my $host = lc $sender->host;
61 + my $from = lc($sender->user) . '@' . $host;
62 +
63 + for (@badmailfrom) {
64 + my ($pattern, $response) = split /\s+/, $_, 2;
65 + next unless $from =~ /$pattern/;
66 + $response = "Your envelope sender is in my badmailfrom_patterns list"
67 + unless $response;
68 + $transaction->notes('badmailfrom_patterns', $response);
69 + }
70 + return (DECLINED);
71 +}
72 +
73 +sub hook_rcpt {
74 + my ($self, $transaction, $rcpt, %param) = @_;
75 + my $note = $transaction->notes('badmailfrom_patterns');
76 + if ($note) {
77 + $self->log(LOGINFO, $note);
78 + return (DENY, $note);
79 + }
80 + return (DECLINED);
81 +}
82 --
83 1.7.2.2
84

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