[Mimedefang] Filtering Local Submission

Stefano McGhee SMcGhee at ARCweb.com
Thu Feb 20 11:39:01 EST 2003

Thanks for the prompt reply. :-)

	It seems then that the thing to do is to add
add_ip_validation_header(); to filter_end and perhaps
delete_ip_validation_header(); to filter begin.  Also, I would need to
reconfigure MD with the --with-ipheader argument to get that to work.
Finally I would add code similar to 
            if ($WasResent) {
                 if ($RealRelayAddr ne "ip.of.secondary.mx" and
                     $RealRelayAddr ne "ip.of.tertiary.mx") {
                      $RelayAddr = $RealRelayAddr;
                      $RelayHostname = $RealRelayHostname;
Is that correct?


> Yes, indeed.  Read the "PRESERVING RELAY INFORMATION" section of the
> mimedefang-filter man page.  If you create an IP validation header,
> then the stream_by_recipient() function will preserve the original IP
> address for filter_begin/filter/filter_end.
> If you use this feature, a beautiful thing happens:  
> Streamed-and-resent
> mail has $RelayAddr set to the actual original relay's IP address,
> while locally-originated or manually-bounced mail has $RelayAddr
> set to  Cool, eh? :-)
> However, you should not use ACCEPT_AND_NO_MORE_FILTERING in your
> filter_relay function.  Instead, do it in 
> filter_begin/filter/filter_end.
> Check if $RelayAddr is local, and return action_accept() if 
> so.  That's
> because filter_relay only sees for resend mail, whereas the
> other filter functions extract the "real" relay address from the IP
> validation header.
> --
> David.

More information about the MIMEDefang mailing list