[Mimedefang] Can't make filter_sender from slide to work

aNguyen annguyen251 at hotmail.com
Sat Dec 16 12:11:08 EST 2006


The good news: I've added the conicalize_email in and now mimedefang seems 
to like it.
The bad news: I've done a test and mimedefang does not catch it...
 Here's the log entries, which I've x out the real ip and domain...

bash-2.03# grep kBGGqn43012332 /var/adm/messages
Dec 16 08:53:47  milter-greylist: [ID 902575 mail.info] kBGGqn43012332: 
skipping greylist because address x.x.x.x is whitelisted, 
(from=wannatest at comcast.net, rcpt=testmail at mydom.com, 
addr=test.domain.com[[x.x.x.x])
Dec 16 08:54:03  sendmail[12332]: [ID 801593 mail.info] kBGGqn43012332: 
from=wannatest at comcast.net, size=0, class=0, nrcpts=1, 
msgid=<200612161653.kBGGqn43012332 at .domain.com>, proto=SMTP, daemon=MTA, 
relay=test.domain.com [[x.x.x.x]
Dec 16 08:54:03  sendmail[12618]: [ID 801593 mail.info] kBGGqn43012332: 
to=testmail at mydom.com, delay=00:00:16, xdelay=00:00:00, mailer=esmtp, 
pri=120000, relay=test2.domain.com. [x.x.x.x], dsn=2.0.0, stat=Sent (Message 
accepted for delivery)
Dec 16 08:54:03  sendmail[12618]: [ID 801593 mail.info] kBGGqn43012332: 
done; delay=00:00:16, ntries=1

I hope this test fail because the from address is whiteliested by 
milter-greylist. But it is not mimedefang though. Does it mean that 
mimedefang rule won't apply to emails that is whitelisted by 
milter-greylist? I don't think this is true and I hope to be able to make it 
work...
It looks like my code is bad, but I don't know the right way yet...
Thanks for any help.
An Nguyen

ps. here's the two sub filter codes below:

sub canonicalize_email ($) {
my($email) = @_;
 # Remove angle-brackets; convert to lower-case
 $email =~ s/^<//;
 $email =~ s/>$//;
 $email = lc($email);
 return $email;
}

sub filter_sender {
my ($from, $hostip, $hostname, $helo) eq @_;
 $from = canonicalize_email($from);
 if ($from =~ m/\@comcast\.net$/i and
 !($hostname =~ /comcast\.net$/)) {
 return('REJECT',
 "Mail from comcast.net not accepted from $hostname");
 }
 return('CONTINUE', 'OK');
}

----- Original Message ----- 
From: "aNguyen" <annguyen251 at hotmail.com>
To: <mimedefang at lists.roaringpenguin.com>
Sent: Saturday, December 16, 2006 8:22 AM
Subject: [Mimedefang] Can't make filter_sender from slide to work


> I've got this code from mimedefang website's slide but unable to make it 
> work. I've enabled sender_check and added the filter but mimedefang is 
> dead shortly after starting it... I don't know if it's the filter's syntax 
> error or something else... my mimedefang works fine without this addition.
> I also notice that my filter does not include a sub canonicalize_email, so 
> I'm working on adding it above the filter_sender.
> Hope I move into the right direction.
> Thanks,
> An Nguyen
>
> sub filter_sender {
>
> my ($from, $hostip, $hostname, $helo) eq @_;
>
> $from = canonicalize_email($from);
>
> if ($from =~ /\@comcast\.net$/ and
>
> !($hostname =~ /comcast\.net$/)) {
>
> return('REJECT',
>
> "Mail from comcast.net not accepted from $hostname");
>
> }
>
> return('CONTINUE', 'OK');
>
> }
>
> _______________________________________________
> NOTE: If there is a disclaimer or other legal boilerplate in the above
> message, it is NULL AND VOID.  You may ignore it.
>
> Visit http://www.mimedefang.org and http://www.roaringpenguin.com
> MIMEDefang mailing list MIMEDefang at lists.roaringpenguin.com
> http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
> 




More information about the MIMEDefang mailing list