File: check_spamhelo

package info (click to toggle)
qpsmtpd 0.84-9
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 1,376 kB
  • sloc: perl: 8,012; sh: 382; makefile: 61
file content (33 lines) | stat: -rw-r--r-- 837 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
=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 hook_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(LOGDEBUG, "Denying HELO from host claiming to be $bad");
      return (DENY_DISCONNECT, "Sorry, I don't believe that you are $host.");
    }
  }
  return DECLINED;
}

# also support EHLO
*hook_ehlo = \&hook_helo;