XMailforum is a readonly knowledge archive now.

Registering as a new user or answering posts is not possible anymore.

Might the force be with you, to find here what you are looking for.

2019-09-20 - hschneider, Admin

Cookie Disclaimer: This forum uses only essential, anonymous session cookies (xmailforum*), nothing to be scared of.

XMail Forum -> Spam Filtering

Reply to this topicStart new topicStart Poll

> Spam Filtering
aju_rathod
Posted: Jul 25 2006, 08:06 AM
Quote Post


Advanced Member
****

Group: Members
Posts: 137
Member No.: 1858
Joined: 17-December 05



Hi,

I am using Xmail server on Linux. I have spanassassin insatlled on the server. I have downloaded safilter-1.3 and configured the same. The configuration is as follows.

safilter.tab configuration:

"/var/MailRoot/bin/sa_filter.pl" "-t" "@@FILE" "-r" "@@RCPT"

sa_filter.pl configuration:

#!/usr/bin/perl

# $Id: sa_filter.pl,v 1.5 2003/10/02 14:09:13 drake Exp $
#
# sa_filter.pl
#
# Don Drake
# Drake Consulting
# don@drakeconsult.com
# http://www.drakeconsult.com/xmail/
#
# sa_filter.pl Copyright © 2002 Don Drake - Drake Consulting
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


use strict;
use Getopt::Std;

my $XMAIL_LOG_PATH="/var/MailRoot/logs";
my $TMP_DIR="/tmp";
my $MAX_SIZE=256000;

sub getCommandLine();
sub logit($$$);
sub openLog($);
sub closeLog($);

my($rcpt,$fileName)=getCommandLine();
my $logHandle=openLog($XMAIL_LOG_PATH);

# Verify the arguments sent to us are valid.
if ($rcpt !~/^[\w@.-]/) {
logit($logHandle,"Invalid RCPT: $rcpt",$rcpt);
exit 1;
}

if (! -f $fileName) {
logit($logHandle,"Can't find email file $fileName",$rcpt);
exit 1;
}

if (-s $fileName > $MAX_SIZE) {
logit($logHandle,"EMAIL TOO BIG",$rcpt);
exit 1;
}

if (! -d $TMP_DIR) {
logit($logHandle,"TMP_DIR is not a directory",$rcpt);
exit 1;
}

if (! -w $TMP_DIR) {
logit($logHandle,"TMP_DIR is not writable",$rcpt);
exit 1;
}

#Need to take first 6 lines out of file (xmail header)
#so spamc doesn't see it.
my $randNum=rand $$ * 1000;
my $tmpFile="$TMP_DIR/tmp.DrakeSpam.$$.$randNum";
open my $inHandle, $fileName or die ("can't open filename: $fileName");
open my $tmpHandle, ">$tmpFile" or die ("can't open filename for writing: $tmpFile");
my $count=0;
my $xmailHeader="";
while (<$inHandle>) {
if ($count < 6) {
$xmailHeader.=$_;
} else {
print $tmpHandle $_;
}
$count++;
}
close $tmpHandle;
close $inHandle;

# pass rest to spamc
my $checkedEmail=`spamc < $tmpFile`;

#results are in $checkedEmail, don't need the temp file anymore.
unlink $tmpFile;

my $isSpam="NOT SPAM";
if ($checkedEmail=~/X-Spam-Flag: YES/) {
$isSpam="SPAM";
$checkedEmail=~s/(?<!\r)\n/\r\n/g;
$xmailHeader=~s/(?<!\r)\n/\r\n/g;
}

# put first 6 lines back on returned message
# put it back in the file
open my $outHandle,">$fileName" or die("Can't open file $fileName for writing");
print $outHandle $xmailHeader;
print $outHandle $checkedEmail;
close $outHandle;

# log results
logit($logHandle,$isSpam,$rcpt);

closeLog($logHandle);

# We're always modifying the message because spamassassin will add some X-Spam- headers
# if it's spam or not.
exit 7;

sub openLog($) {
my ($logPath)=(@_);

my ($sec,$min,$hour,$dmon,$mon,$year,$wday,$yday,$isdst) = localtime(time());
$year+=1900;
$mon++;

# format the filename similar to other xmail log files.
my $date = sprintf("%04d%02d%02d",$year,$mon,$dmon );

my $logFile = "$logPath/spam-${date}0100";

open (my $logHandle, ">>$logFile") or die("Can't open log file $logFile");
return $logHandle;
}

sub closeLog($) {
my ($logHandle)=@_;

close($logHandle);
}

sub logit($$$) {
my ($logHandle,$msg,$rcpt)=@_;

#Strip any new lines.
$msg=~s/\n|\r//g;
my ($sec,$min,$hour,$dmon,$mon,$year,$wday,$yday,$isdst) = localtime(time());
$year+=1900;
$mon++;

my $dateTime = sprintf("\"%04d-%02d-%02d %02d:%02d:%02d\"",$year,$mon,$dmon,$hour,$min,$sec);
$msg="\"$msg\"";
$rcpt="\"$rcpt\"";
print $logHandle "$dateTime\t$msg\t$rcpt\n";
}

sub getCommandLine() {
use vars qw($opt_r $opt_t );

$opt_r=$opt_t="";
getopt('r:t:');
if ($opt_r eq "" || $opt_t eq "" ) {
die "usage: $0 -f -r \@\@RCPT -t \@\@TMPFILE \n";
}
return ($opt_r,$opt_t);
}


filter.in.tab configuration :

"*" "*@synchronresearch.com" "0.0.0.0/0" "0.0.0.0/0" "safilter.tab"

But still i am getting lots of spam mails, i.e. mails are not getting filtered through filters. What changes do i need to configure to stop spams?

Regards,
Ajay Rathod.

PMEmail Poster
Top
sherm
Posted: Aug 8 2006, 06:38 PM
Quote Post


Junior Member
**

Group: Members
Posts: 46
Member No.: 543
Joined: 18-April 03



I do somthing similar, but we have grown so much that I finally just bought a barracuda. I love it.

Sherm


--------------------
PMEmail PosterUsers WebsiteYahoo
Top
aju_rathod
Posted: Aug 14 2006, 01:28 PM
Quote Post


Advanced Member
****

Group: Members
Posts: 137
Member No.: 1858
Joined: 17-December 05



Hi,

What is baracuda? How do u configure that for spam protection? Can i have some details on the same?

Regards,
Ajay Rathod.
PMEmail Poster
Top
hschneider
Posted: Aug 14 2006, 01:41 PM
Quote Post


No - I'm not an answering script ...
Group Icon

Group: Admin
Posts: 6631
Member No.: 195
Joined: 19-June 02



Think he means a Seagate Barracuda Harddisc ... http://www.seagate.com/cda/products/discsa...081,580,00.html

wink.gif


--------------------
Bye,
Harald


-- Download XMail Queue Manager 1.46 NOW: XMail Server Tools
-- Cross platform remote queue management!
-- Message analyzing on the fly!
-- Builtin diagnostics knowledge base!
-- Manages multiple mail queues!

Sponsored by
CD-Produktion und DVD-Produktion and Homestaging Saarland - Immobilien schneller verkaufen in der Region Saarland, Rheinland-Pfalz und Luxembourg
PMEmail PosterUsers Website
Top
svenvg
Posted: Aug 17 2006, 05:13 PM
Quote Post


Junior Member
**

Group: Members
Posts: 34
Member No.: 1088
Joined: 29-April 04



I think he means a Barracuda appliance (hardware) that you prug in between your Internet access and the Xmail server...

http://www.barracudanetworks.com


I would like to know what price it has tough....

bye ,
Sven.
PMEmail PosterAOL
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
« Next Oldest | Fighting SPAM | Next Newest »

Reply to this topicStart new topicStart Poll