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

Annotation of /rpms/qpsmtpd/sme8/0020-new-plugin-check_badmailfrom_patterns.patch

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


Revision 1.1 - (hide annotations) (download)
Sun Nov 14 20:50:20 2010 UTC (14 years ago) by slords
Branch: MAIN
CVS Tags: qpsmtpd-0_84-3_el5_sme, qpsmtpd-0_84-6_el5_sme, qpsmtpd-0_84-2_el5_sme, qpsmtpd-0_84-5_el5_sme, qpsmtpd-0_84-8_el5_sme, qpsmtpd-0_84-9_el5_sme, qpsmtpd-0_84-4_el5_sme, qpsmtpd-0_84-7_el5_sme, HEAD
* Sun Nov 14 2010 <slords@mail.com> 0.84-2.sme
- Sync with upstream git repo.
- Fix require_resolvable_fromhost doesn't work [SME: 6369]
- Fix TLS security defaults [SME: 6366]
- Fix fatal errors when mail has no headers [SME: 6345]

1 slords 1.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