[Mimedefang] read domain list from config file
Kris Deugau
kdeugau at vianet.ca
Thu Mar 27 13:50:25 EDT 2014
Marcus Schopen wrote:
z> for some of my domains I'd like to reject mails at a given spamscore of
>> =5. For some other domains at a higher score. Is it a good idea to read
> those domain names from different "external" config file instead of
> coding them hard into mimedefang-milter?
I did this a number of years ago, using a BerkeleyDB tied hash:
sub filter_initialize {
require DB_File;
use Fcntl;
tie %hosteddomains, "DB_File", "/etc/mail/hosteddomains.db", O_RDONLY;
} # filter_initialize
sub filter_cleanup {
untie %hosteddomains;
}
And to modify your code below:
> sub filter_end {
> [...]
> if (exists $hosteddomains{$Domain} && $hits >= 5) {
> if ($WasResent) {
> action_discard();
> } else {
> action_bounce("Recipient refuses mail due to ...");
> }
> }
> [...]
It worked pretty well.
I used the value in the hash to drive in filter_end to indicate:
- whether or not to call ClamAV or SpamAssassin
- to set a custom threshold at which to redirect mail instead of
delivering it to the Inbox (diverted mail got dropped in spam@<domain>
instead of the original receipient(s) inbox(es))
- to determine whether to munge the Subject on tagged mail or not
-kgd
More information about the MIMEDefang
mailing list