Dear list members,
today I have seen im my logs the following mail from pattern.
###
0-tmi...@cablelettra.it
0-eka.skupin...@warta.pl
0-3r7ukxbqrp...@cheetahmail.com
0-dp74.jphjrc...@mail2world.com
0-2047269-1-tajimi_co...@jmb.jal.com
0-p...@eland.co.kr
0-0-0-36490-1-royceclub...@click.eplus.jp
0...@system.com
0-637651...@creditmailings.com
0...@inext.co.za
0...@telepak.net
###
I have decided to dublicate the check_badrcptto_patterns to
check_badmailfrom_pattern.
I want to share with you this solution, maybe somone have the same
problem but another solution ;-)
The plugin checks the badrcptto_patterns file witch have the same syntax
as the badrcptto_patterns.
I have add the follwoing pattern into the file
###
^\d\- DENY badmailfrom_patterns
###
Cheers
Aleks
=pod
=head1 SYNOPSIS
This plugin checks the badmailfrom_patterns config. This allows
special patterns to be denied (e.g. percent hack, bangs,
double ats).
=head1 CONFIG
config/badmailfrom_patterns
Patterns are stored in the format pattern\sresponse, where pattern
is a Perl pattern expression. Don't forget to anchor the pattern if
you want to restrict it from matching anywhere in the string.
qpsmtpd already ensures that the address contains an @, with something
to the left and right of the @.
=head1 AUTHOR
Copyright 2005 Gordon Rowell <gord...@gormand.com.au>
Copyright 2010 Aleksandar Lazic <al-qpsm...@none.at>
This software is free software and may be distributed under the same
terms as qpsmtpd itself.
=cut
sub hook_mail
{
my ($self, $transaction, $sender, %param) = @_;
my @badmailfrom = $self->qp->config("badmailfrom_patterns") or return
(DECLINED);
return (DECLINED) unless ($sender->format ne "<>"
and $sender->host && $sender->user);
my $host = lc $sender->host;
my $from = lc($sender->user) . '@' . $host;
for (@badmailfrom)
{
my ($pattern, $response) = split /\s+/, $_, 2;
#return (DENY, $response) if ($to =~ /$pattern/);
$transaction->notes('badmailfrom_pattern', $response) if ($from =~
/$pattern/);
}
return (DECLINED);
}
sub hook_rcpt {
my ($self, $transaction, $rcpt, %param) = @_;
my $note = $transaction->notes('badmailfrom_pattern');
if ($note) {
$self->log(LOGINFO, $note);
return (DENY, $note);
}
return (DECLINED);
}