Postfix smtp relay with dspam as content filter re-train problem

Discussion in 'Server Operation' started by darklord3k, Nov 5, 2007.

  1. darklord3k

    darklord3k New Member

    Please help, this is drive me crazy as this is my first time setup any server on linux.
    setup as follow
    postfix smtp relay to exchange server
    dspam as content filter
    tranportmap is create for user to retrain the email
    [email protected] dspam-retrain:spam
    [email protected] dspam-retrain:innocent

    on master.cf
    dspam-retrain unix - n n - 10 pipe
    flags=Ru user=dspam argv=/usr/local/bin/dspam-retrain $nexthop $sender $recipient

    dspam-retrain as follow:
    #! /usr/bin/perl
    # Get arguments
    $class = $ARGV[0] || die; shift;
    $sender = $ARGV[0] || die; shift;
    $recip = $ARGV[0] || die; shift;

    if ($recip =~ /^(spam|ham)-(\w+)@/) {
    # username is part of the recipient
    $user = $2;
    } elsif ($sender =~ /^(\w+)@/) {
    # username is in the sender
    $user = $1;
    } else {
    print "Can't determine user\n";
    exit 75; # EX_TEMPFAIL
    }

    # Pull out DSPAM signatures and send them to the dspam program
    while (<>) {
    if ((! $subj) && (/^Subject: /)) {
    $subj = $_;
    } elsif (/(!DSPAM:[a-f0-9]+!)/) {
    #########alway failed at this point ##############
    open(F, "|/usr/local/bin/dspam --source=error --class=$class --user $user") || die "retrain failed";
    ################################################3
    print F "$subj\n$1\n";
    close(F);
    } elsif (/(X-DSPAM-Signature: [a-f0-9]+)/) {
    open(F, "|/usr/local/bin/dspam --source=error --class=$class --user $user");
    print F "$subj\n$1\n";
    close(F);
    }
    }

    It alway failed on this point from when I check the mail.log
    open(F, "|/usr/local/bin/dspam --source=error --class=$class --user $user") || die "retrain failed";
    I have try to retrain by calling the dspam-retrain from shell without any issue by "cat email | dspam-restrain spam [email protected] [email protected]"
    For testing purpose I have give 777 permission for /usr/local/bin/dspam
    Please help
     

Share This Page