[Mimedefang] invoking mimedefang milter multiple times?

Jan-Pieter Cornet johnpc at xs4all.nl
Wed Feb 23 18:29:54 EST 2011


On 2011 Feb 23, at 21:12 , David F. Skoll wrote:
> On Wed, 23 Feb 2011 14:15:17 -0500
> James Ralston <qralston+ml.mimedefang at andrew.cmu.edu> wrote:
> 
>> David, do you have any opinion on this?  Would you be willing to
>> accept patches in order to enable mimedefang to be invoked as a milter
>> multiple times?  Or are you in the "just run another instance of
>> mimedefang" camp?
> 
> I'm not too enthusiastic about this.  I really can't see the use-case
> for multiple milters.  It seems to me it's easier and more flexible
> to do everything (greylisting, DKIM verification, etc.) in Perl.  It
> gives you one place to write policy.  The "next generation" Sendmail
> (MeTA1) makes it official: It only support one pmilter and says you
> need a multiplexor on your end to support multiple pmilters.  [I'm not
> sure that MeTA1 will ever see the light of day as production software...]

It would probably be Very Cool if mimedefang could have hooks to use Net::Milter to be able to directly link to other milters, from within mimedefang.pl. Something like:

sub filter_initialize {
    md_add_external_milter( name => 'dkim',
                            location => 'inet:8891 at localhost',
                            default_call => 'before', # dkim milter is always called before mimedefang.pl routines
                          );
    md_add_external_milter( name => 'grey',
                            location => 'local:/var/milter-greylist/milter-greylist.sock',
                            default_call => 'after', # dkim milter is called after mimedefang.pl routines (unless called manually)
                          );
}

my %greylist_passed_hosts;

sub filter_recipient {
    my ($recipient, $sender, $ip, $hostname, $first, $helo,
                   $rcpt_mailer, $rcpt_host, $rcpt_addr) = @_;
    # ...
    if ( !$greylist_passed_hosts{$ip} ) {
        my $grey_answer = md_invoke_milter('grey');
        if ( $grey_answer->disposition() eq 'accept' ) {
            $greylist_passed_hosts{$ip} = time;
        }
        md_process_milter_response($grey_answer); # also adds filters if necessary
    }
}

__END__

... but... that requires quite a bit of work, especially if the insides of Net::Milter are wrapped up like this. But it could be really useful, and make it very easy to integrate mimedefang with additional milters, allowing mimedefang to even control the behaviour of the other milter.

-- 
Jan-Pieter Cornet <johnpc at xs4all.nl>
"People are continuously reinventing the flat tyre".







More information about the MIMEDefang mailing list