Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 623
  • Last Modified:

DSPAM configuration for CENT OS 7

I can't find any links for the configuration ... only for other Linux distributions. Can you please help?
0
Starquest321
Asked:
Starquest321
  • 3
3 Solutions
 
Ganesh Kumar ASr Infrastructure SpecialistCommented:
0
 
Starquest321Author Commented:
But I need Cent OS... not ubnutu
0
 
Ganesh Kumar ASr Infrastructure SpecialistCommented:
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
 
Ganesh Kumar ASr Infrastructure SpecialistCommented:
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now