infinitech07 wrote:
Apr 29 21:50:41 server postfix/smtpd[20416]: NOQUEUE: reject: RCPT from mona.bmstech.com.au[203.33.248.10]: 450 4.1.1 <
Raymond_Elmo@domain.com>: Recipient address rejected: User unknown in virtual mailbox table; from=<> to=<
Raymond_Elmo@domain.com> proto=ESMTP helo=<mail.bmstech.com.au>
if (($lgfile eq $config{CUSTOM2_LOG}) and ($line =~ /^.* reject: RCPT from (\S+)\[(\S+)\]: 450 4.1.1 <(\S+)>.*$/)) {
#It will block anyone with more than 1 matches for 1 day.
return ("SMTP spam attack - $3",$1,"SMTP","1","25,587,465","1");
}
Hi infinitech07.
Your issue is the $1 that you are trying to block. Remeber that anything inside each pair of "( )" will be saved as $1, $2, $3, etc.
So, in your log:
$1="mona.bmstech.com.au"
$2="203.33.248.10"
$3="
Raymond_Elmo@domain.com"
With that in mind, if you review your rule, you are setting:
"SMTP spam attack -
Raymond_Elmo@domain.com",mona.bmstech.com.au,"SMTP","1","25,587,465","1"
So, just replace $1 by $2 at ...$3",$2,"SMTP"...
and your rule will look like this:
"SMTP spam attack -
Raymond_Elmo@domain.com",203.33.248.10,"SMTP","1","25,587,465","1"
and this will block the offending IP.
Sergio