Solved

DSPAM configuration for CENT OS 7

Posted on 2014-09-21
4
431 Views
Last Modified: 2014-09-21
I can't find any links for the configuration ... only for other Linux distributions. Can you please help?
0
Comment
Question by:Starquest321
  • 3
4 Comments
 
LVL 10

Assisted Solution

by:Ganesh Kumar A
Ganesh Kumar A earned 500 total points
ID: 40335158
0
 

Author Comment

by:Starquest321
ID: 40335159
But I need Cent OS... not ubnutu
0
 
LVL 10

Assisted Solution

by:Ganesh Kumar A
Ganesh Kumar A earned 500 total points
ID: 40335172
Create Dspam User

#adduser -d /usr/local/var/dspam -s /sbin/nologin dspam

Download and Installing Dspam

Login as root
#cd /root
#wget http://repository.wowtutorial.org/dspam-3.9.0-BETA1.tar.gz
#tar -zxvf dspam-3.9.0-BETA1.tar.gz
#cd dspam-3.9.0-BETA1
#./configure --enable-daemon \
    --with-storage-driver=mysql_drv \
    --with-mysql-includes=/usr/local/mysql/include/mysql \
    --with-mysql-libraries=/usr/local/mysql/lib/mysql \
    --enable-preferences-extension \
    --with-dspam-home-owner=dspam \
    --with-dspam-home-group=postdrop \
    --with-dspam-home=/usr/local/var/dspam \
    --enable-long-usernames \
    --with-dspam-group=postdrop \
    --enable-mysql4-initialization \
    --enable-domain-scale \
    --enable-virtual-users \
    --enable-clamav \
    --enable-debug \
    --enable-verbose-debug
#make && make install

Setting Dspam MySQL DB

#cd /root/dspam-3.9.0-BETA1
#mysqladmin create dspam
#mysql dspam < ./src/tools.mysql_drv/mysql_objects-4.1.sql

Grant Dspam User to Dspam DB with Password

#mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 732 to server version: 5.1.37-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> grant all on dspam.* to dspam@localhost identified by 'password123';
Query OK, 0 rows affected (0.03 sec)

mysql> exit

We also need to add extra virtual user table SQL DB to Dspam DB

#mysql dspam < ./src/tools.mysql_drv/virtual_users.sql

Configure Dspam

Note : dspam.conf is in /usr/local/etc/

#pico /usr/local/etc/dspam.conf

Home /usr/local/var/dspam
StorageDriver /usr/local/lib/dspam/libmysql_drv.so
TrustedDeliveryAgent "/usr/bin/procmail"
DeliveryHost        127.0.0.1
DeliveryPort        10026
DeliveryIdent       localhost
DeliveryProto       SMTP
OnFail error
Trust root
Trust dspam
Trust postfix
Trust daemon
Debug *
TrainingMode teft
TestConditionalTraining on
Feature whitelist
Algorithm graham burton
Tokenizer chain
PValue bcr
WebStats on
Preference "signatureLocation=headers"  # 'message' or 'headers'
Preference "showFactors=on"
Preference "spamAction=tag"
Preference "spamSubject=[SPAM]"
AllowOverride trainingMode
AllowOverride spamAction spamSubject
AllowOverride statisticalSedation
AllowOverride enableBNR
AllowOverride enableWhitelist
AllowOverride signatureLocation
AllowOverride showFactors
AllowOverride optIn optOut
AllowOverride whitelistThreshold
MySQLServer             /tmp/mysql.sock
MySQLPort               3306
MySQLUser               dspam
MySQLPass               password123
MySQLDb                 dspam
MySQLCompress           true
MySQLVirtualTable          dspam_virtual_uids
MySQLVirtualUIDField       uid
MySQLVirtualUsernameField  username
MySQLUIDInSignature    on
HashRecMax              98317
HashAutoExtend          on
HashMaxExtents          0
HashExtentSize          49157
HashPctIncrease 10
HashMaxSeek             10
HashConnectionCache     10
PurgeSignatures 14          # Stale signatures
PurgeNeutral    90          # Tokens with neutralish probabilities
PurgeUnused     90          # Unused tokens
PurgeHapaxes    30          # Tokens with less than 5 hits (hapaxes)
PurgeHits1S     15          # Tokens with only 1 spam hit
PurgeHits1I     15          # Tokens with only 1 innocent hit
LocalMX 127.0.0.1
SystemLog on
UserLog   on
Opt out
ParseToHeaders on
ChangeModeOnParse on
ChangeUserOnParse full
ClamAVPort      3310
ClamAVHost      127.0.0.1
ClamAVResponse accept
ServerPID              /var/run/dspam.pid
ServerMode auto
ServerParameters        "--deliver=innocent, spam"
ServerIdent             "localhost.localdomain"
ServerDomainSocketPath  "/tmp/dspam.sock"
ProcessorURLContext on
ProcessorBias on
StripRcptDomain off

Create dspam-retrain file in /usr/local/bin

#pico /usr/local/bin/dspam-retrain
#! /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]+!)/) {
        open(F, "|/usr/local/bin/dspam --source=error --class=$class --user $user");
        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);
    }
}

Change dspam-retrain permission

#chmod 755 /usr/local/bin/dspam-retrain
0
 
LVL 10

Accepted Solution

by:
Ganesh Kumar A earned 500 total points
ID: 40335174
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now