qpsmtpd/plugins/check_spamhelo
Ask Bjørn Hansen 5d34bad178 Date: Thu, 13 Mar 2003 00:57:39 -0800
From: Devin Carraway <qpsmtpd-list@devin.com>
To: qpsmtpd@perl.org
Subject: HELO hook and check plugin

Speaking of direct-to-MX spam, both AOL and Yahoo are large companies
with whole walls-full of servers devoted to mail delivery.  None of them
announce themselves with "HELO yahoo.com" or "HELO aol.com."  Spammers
certainly do, though.

Here's a patch to SMTP.pm to add hooks for HELO and EHLO, and a plugin
to use them.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@119 958fd67b-6ff1-0310-b445-bb7760255be9
2003-03-18 09:43:22 +00:00

38 lines
961 B
Plaintext

=head1 NAME
check_spamhelo - Check a HELO message delivered from a connecting host.
=head1 DESCRIPTION
Check a HELO message delivered from a connecting host. Reject any
that appear in the badhelo config -- e.g. yahoo.com and aol.com, which
neither the real Yahoo or the real AOL use, but which spammers use
rather a lot.
=head1 CONFIGURATION
Add domains or hostnames to the F<badhelo> configuration file; one
per line.
=cut
sub register {
my ($self, $qp) = @_;
$self->register_hook("helo", "check_helo");
$self->register_hook("ehlo", "check_helo");
}
sub check_helo {
my ($self, $transaction, $host) = @_;
($host = lc $host) or return DECLINED;
for my $bad ($self->qp->config('badhelo')) {
if ($host eq lc $bad) {
$self->log(5, "Denying HELO from host claiming to be $bad");
return (DENY, "Uh-huh. You're $host, and I'm a boil on the bottom of the Marquess of Queensbury's great-aunt.");
}
}
return DECLINED;
}