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

Annotation of /rpms/qpsmtpd/sme10/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 Feb 7 20:49:54 2016 UTC (8 years, 8 months ago) by stephdl
Branch: MAIN
CVS Tags: qpsmtpd-0_96-19_el7_sme, qpsmtpd-0_96-12_el7_sme, qpsmtpd-0_96-11_el7_sme, qpsmtpd-0_96-16_el7_sme, qpsmtpd-0_96-13_el7_sme, qpsmtpd-0_96-6_el7_sme, qpsmtpd-0_96-18_el7_sme, qpsmtpd-0_96-23_el7_sme, qpsmtpd-0_96-20_el7_sme, qpsmtpd-0_84-20_el7_sme, qpsmtpd-0_96-17_el7_sme, qpsmtpd-0_96-8_el7_sme, qpsmtpd-0_96-5_el7_sme, qpsmtpd-0_96-2_el7_sme, qpsmtpd-0_96-21_el7_sme, qpsmtpd-0_96-22_el7_sme, qpsmtpd-0_96-14_el7_sme, qpsmtpd-0_96-15_el7_sme, qpsmtpd-0_96-9_el7_sme, qpsmtpd-0_96-4_el7_sme, qpsmtpd-0_96-1_el7_sme, qpsmtpd-0_96-3_el7_sme, qpsmtpd-0_84-18_el7_sme, qpsmtpd-0_96-10_el7_sme, qpsmtpd-0_84-19_el7_sme, HEAD
* Sun Feb 7 2016 stephane de labrusse <stephdl@de-labrusse.fr> 0.84-18.sme
- Build new rpm for sme10

1 stephdl 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