Solved

DSPAM configuration for CENT OS 7

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Forget those services on TV trying to sell you software – that’s step one.  Almost all of the software you need should be available for free.  The tricky part is doing the work.  If you are not comfortable performing these steps yourself, contact a …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

773 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