[Mimedefang] SPF and SMTP auth

Andrea Venturoli ml.ventu at flashnet.it
Mon Feb 16 15:19:34 EST 2004


Hello.

I've set up a mail server with FreeBSD + Sendmail + SASL + Mimedefang (+ others, but OT); now I'm trying to
implement SPF and I think I'm almost there: everything seems to be running fine, mimedefang filters fakes through SPF
and bind puslishes my records.
However I'm in need to allow roaming notebooks to send mail through this smtp server, so I have them authenticate and
everything works fine, except SPF.

Here's my code in mimedefang-filter (adapted from a couple of samples on the net):

sub filter_sender {
    if ($SendmailMacros{"auth_authen"}) {
        return ('CONTINUE', 'ok');
    }
    my ($sender, $ip, $hostname, $helo) = @_;
    my $spfq = Mail::SPF::Query->new(ip => $ip, sender => $sender, helo => $helo);
    my ($result, $smtp_comment, $header_comment) = $spfq->result();
    if ($result eq 'pass' or $result eq 'fail') {
        md_syslog 'info', "$QueueID: SPF implemented=yes, result=$result, smtp_comment=$smtp_comment, header_comment=$header_comment";
        if ($result eq 'fail') {
            return ('REJECT', $smtp_comment);
        }
    } else {
        my ($result, $smtp_comment, $header_comment) = $spfq->best_guess();
        $smtp_comment ||= '';
        $header_comment ||= '';
        md_syslog 'info', "$QueueID: SPF implemented=no, result=$result, smtp_comment=$smtp_comment, header_comment=$header_comment";
    }
    return ('CONTINUE', 'ok');
}


It works almost fine, but it does not allow authenticated users to send mail from "foreign" IPs; in other words, the
first three lines do not work.

Any hint?


 bye & Thanks
        av.

P.S. Sorry, but I'm not that PERL guru... :(




More information about the MIMEDefang mailing list