[Mimedefang] Using Spamassassin's spamd/c

listuser at neo.pittstate.edu listuser at neo.pittstate.edu
Tue Oct 15 13:28:01 EDT 2002


On Mon, 14 Oct 2002 jmiller at purifieddata.net wrote:

> Haven't looked into spamd/c much... but I commented on whitelisting...
> 
> On Mon, 14 Oct 2002 listuser at neo.pittstate.edu wrote:
> 

<snip>

> >
> > Thanks
> >  Justin
> >
> 
> The short answer on whitelisting, yes, mimedefang can do it.
> 
> I haven't used the default filter, so I'm not sure if it's already got a
> provision for this in it, but I added something similar to the following
> above where I do my spamassassin checks. It'll open two different files
> (each with one e-mail address per line), one for recipients, one for
> senders, and if it finds a match, it won't run spamassassin on the
> message. Please note, though this code should work, it doesn't have all
> the extra fancy data integrity checks in it, or even checks to make sure
> it can open the whitelist files. I tried to keep it short so it'd be
> easier to understand.
> 
> my $whitelisted;
> open(RWL,"< /etc/mail/recipient_whitelist");
> RWLLOOP: while(<RWL>) {
> 	chomp;
> 	foreach my $recipient (@Recipients) {
> 		$recipient =~ s/[<>]//g; # braces not desireable
> 		if ($recipient =~ /$_/i) {
> 			whitelisted++; last RWLLOOP;
> 		}
> 	}
> }
> close(RWL);
> unless ($whitelisted) {
> 	open(SWL,"< /etc/mail/sender_whitelist");
> 	while (<SWL>) {
> 		chomp;
> 		if ($Sender =~ /$_/i) {
> 			$whitelisted++; last;
> 		}
> 	}
> 	close(RWL);
> }
> if ( (! $whitelisted) && $Features{SpamAssassin} ) {
> 	# ... do spam checks
> } else {
> 	syslog('warning',"$MsgID: Whitelisted");
> }

Thanks for the code, Josh!  Things like this should be added to the
recipes page I think.  They are quite useful IMHO.  Question about the
whitelist files, what format should they be in?  Can it just be a domain
or does it have to be a full email address?

Thanks again, 
  Justin




More information about the MIMEDefang mailing list