View Single Post
  #1  
Old 5th November 2007, 23:43
darklord3k darklord3k is offline
Junior Member
 
Join Date: Nov 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Postfix smtp relay with dspam as content filter re-train problem

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
spam@spam.com dspam-retrain:spam
ham@spam.com 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 any@test.com spam@spam.com"
For testing purpose I have give 777 permission for /usr/local/bin/dspam
Please help
Reply With Quote
Sponsored Links