Solved

DSPAM configuration for CENT OS 7

Posted on 2014-09-21
4
474 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 11

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 11

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 11

Accepted Solution

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

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

808 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