Dspam: Difference between revisions

From QmailToaster
Jump to navigation Jump to search
(Created page with "<pre> Install Dspam: wget https://raw.githubusercontent.com/qmtoaster/dspam/master/dspamdb.sh chmod 755 dspamdb.sh ./dpsamdb.sh Running the script 'dspamdb.sh' creates the dspam database, installs dspam, and starts the dspam service. If dspam is implemented for a domain, every email received by that domain will have a dspam signature in the header and a matching signature will automatically be entered in the dspam maria/mysql database. At this point there has been no tr...")
 
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
<pre>
[[Configuration#Dspam|Back]]<br>
Install Dspam:
Install Dspam:
wget https://raw.githubusercontent.com/qmtoaster/dspam/master/dspamdb.sh
wget https://raw.githubusercontent.com/qmtoaster/dspam/master/dspamdb.sh
chmod 755 dspamdb.sh
chmod 755 dspamdb.sh
./dpsamdb.sh
./dpsamdb.sh<br>
 
Running the script 'dspamdb.sh' creates the dspam database, installs dspam, and starts the dspam service.
Running the script 'dspamdb.sh' creates the dspam database, installs dspam, and starts the dspam service.
If dspam is implemented for a domain, every email received by that domain will have a dspam signature in the header and a
If dspam is implemented for a domain, every email received by that domain will have a dspam signature in the header and a
matching signature will automatically be entered in the dspam maria/mysql database. At this point there has been no training.
matching signature will automatically be entered in the dspam maria/mysql database. At this point there has been no training.
To train I have users create a spam and notspam folder in their IMAP account. All spam will be placed into the spam folder and
To train I have users create a spam and notspam folder in their IMAP account. All spam will be placed into the spam folder and
all ham into the notspam folder. I run a bash script enumerating all mail in these folders and dumping each to dspam.<br>
all ham into the notspam folder. I run a bash script enumerating all mail in these folders and dumping each to dspam.  
If there are spam filters in front of dspam that insert header signatures dspam's configuration file must enumerate them
 
so that they can be ignored for training purposes. Below are the Spamassassin signatures with the proper configuration syntax:<br>
If there are spam filters in front of dspam that insert header signatures dspam's configuration file must enumerate them
IgnoreHeader X-Spam-Checker-Version
so that they can be ignored for training purposes. Below are the Spamassassin signatures with the proper configuration syntax:
IgnoreHeader X-Spam-Level
 
IgnoreHeader X-Spam-Status
IgnoreHeader X-Spam-Checker-Version
IgnoreHeader X-Spam-Flag
IgnoreHeader X-Spam-Level
IgnoreHeader X-Spam-Report
IgnoreHeader X-Spam-Status
IgnoreHeader X-Spam-Prev-Subject<br>
IgnoreHeader X-Spam-Flag
Here's a list of headers to ignore for your config file: https://raw.githubusercontent.com/qmtoaster/dspam/master/IgnoreHeader<br>
IgnoreHeader X-Spam-Report
Training:<br>
IgnoreHeader X-Spam-Prev-Subject
 
Here's a list of headers to ignore for your config file: https://raw.githubusercontent.com/qmtoaster/dspam/master/IgnoreHeader
 
Training:
 
   Flag options:
   Flag options:
       SOURCE=corpus/error  
       SOURCE=corpus/error  
       CLASS=spam/innocent
       CLASS=spam/innocent
       MODE=toe/teft/unlearn
       MODE=toe/teft/unlearn<br>
 
   Dspam call:
   Dspam call:
       cat $email | dspam --user $USER@$DOMAIN --mode=$MODE --class=$CLASS --source=$SOURCE
       cat $email | dspam --user $USER@$DOMAIN --mode=$MODE --class=$CLASS --source=$SOURCE<br>
 
   Source: Depending on email source, corpus or error, dspam must be called with the flags set below.
   Source: Depending on email source, corpus or error, dspam must be called with the flags set below.
       1) Corpus (no dspam signature present in header) Depending on type of corpus, ham or spam, class appropriately.
       1) Corpus (no dspam signature present in header) Depending on type of corpus, ham or spam, class appropriately.
Line 42: Line 34:
         CLASS=spam
         CLASS=spam
         MODE=toe
         MODE=toe
       3) Error (dspam signature present in header) dspam catagorized ham as spam, dspam must be called twice, to unlearn and
       3) Error (dspam signature present in header) dspam catagorized ham as spam, dspam must be called twice, to unlearn/train.
                                                  train.
         A)  
         A)  
             SOURCE=error
             SOURCE=error
Line 51: Line 42:
             SOURCE=error
             SOURCE=error
             CLASS=innocent
             CLASS=innocent
             MODE=toe
             MODE=toe<br>
 
Server side filtering 1) Before queue, 2) after queue :<br>
Server side filtering 2 options 1) Before queue, 2) after queue :
Option 1)
 
  [[Simscan#Filtering|Simscan]]
Option 1)
Option 2a Domain level)
https://www.qmailtoaster.org/simscan.html
  If dspam is enabled at domain level in .qmail-default use this file:
 
  # cd /home/vpopmail/'dspam-enabled-domain'
 
  # mv .qmail-default .qmail-default.bak
Option 2a Domain level)
  # chmod 600 .qmail-default && chown vpopmail:vchkpw .qmail-default
If dspam is enabled at domain level in .qmail-default use this file:
  # wget https://raw.githubusercontent.com/qmtoaster/dspam/master/.qmail-default
# cd /home/vpopmail/'dspam-enabled-domain'
Option 2b User level)
# mv .qmail-default .qmail-default.bak
  If dspam is enabled at user level you must install maildrop and download and install two files  
# chmod 600 .qmail-default && chown vpopmail:vchkpw .qmail-default
  .qmail and .mailfilter.dspam (or .mailfilter) in each user directory for which Dspam will be enabled.
# wget https://raw.githubusercontent.com/qmtoaster/dspam/master/.qmail-default
  # cd /home/vpopmail/'dspam-enabled-domain'/'user'
 
  # wget https://raw.githubusercontent.com/qmtoaster/dspam/master/.qmail
Option 2b User level)
  # wget https://raw.githubusercontent.com/qmtoaster/dspam/master/.mailfilter.dspam
If dspam is enabled at user level you must install maildrop and download and install two files  
  # chown vpopmail:vchkpw .qmail
.qmail and .mailfilter.dspam (or .mailfilter) in each user directory for which Dspam will be enabled.
  # chown vpopmail:vchkpw .mailfilter.dspam
# cd /home/vpopmail/'dspam-enabled-domain'/'user'
  # chmod 600 .qmail
# wget https://raw.githubusercontent.com/qmtoaster/dspam/master/.qmail
  # chmod 600 .mailfilter.dspam<br>
# wget https://raw.githubusercontent.com/qmtoaster/dspam/master/.mailfilter.dspam
Mail should flow and be logged
# chown vpopmail:vchkpw .qmail
  # cat /var/log/maildrop/maildrop-'user'@'dspam-enabled-domain'.log<br>
# chown vpopmail:vchkpw .mailfilter.dspam
At this point in your email client you must create the 'spam' and 'notspam' folders and start placing spam in the spam folder to be learned by the
# chmod 600 .qmail
script.
# chmod 600 .mailfilter.dspam
 
Mail should flow and be logged
# cat /var/log/maildrop/maildrop-'user'@'dspam-enabled-domain'.log


At this point in your email client you must create the 'spam' and 'notspam' folders and start placing spam in the spam folder to be learned by the script.
== [[Dspam w/PostgreSQL]] ==
</pre>

Latest revision as of 09:15, 19 October 2024

Back

Install Dspam:
wget https://raw.githubusercontent.com/qmtoaster/dspam/master/dspamdb.sh
chmod 755 dspamdb.sh
./dpsamdb.sh
Running the script 'dspamdb.sh' creates the dspam database, installs dspam, and starts the dspam service. If dspam is implemented for a domain, every email received by that domain will have a dspam signature in the header and a matching signature will automatically be entered in the dspam maria/mysql database. At this point there has been no training. To train I have users create a spam and notspam folder in their IMAP account. All spam will be placed into the spam folder and all ham into the notspam folder. I run a bash script enumerating all mail in these folders and dumping each to dspam.
If there are spam filters in front of dspam that insert header signatures dspam's configuration file must enumerate them so that they can be ignored for training purposes. Below are the Spamassassin signatures with the proper configuration syntax:
IgnoreHeader X-Spam-Checker-Version IgnoreHeader X-Spam-Level IgnoreHeader X-Spam-Status IgnoreHeader X-Spam-Flag IgnoreHeader X-Spam-Report IgnoreHeader X-Spam-Prev-Subject
Here's a list of headers to ignore for your config file: https://raw.githubusercontent.com/qmtoaster/dspam/master/IgnoreHeader
Training:
Flag options: SOURCE=corpus/error CLASS=spam/innocent MODE=toe/teft/unlearn
Dspam call: cat $email | dspam --user $USER@$DOMAIN --mode=$MODE --class=$CLASS --source=$SOURCE
Source: Depending on email source, corpus or error, dspam must be called with the flags set below. 1) Corpus (no dspam signature present in header) Depending on type of corpus, ham or spam, class appropriately. SOURCE=corpus CLASS=spam or innocent MODE=teft 2) Error (dspam signature present in header) dspam catagorizes spam as ham SOURCE=error CLASS=spam MODE=toe 3) Error (dspam signature present in header) dspam catagorized ham as spam, dspam must be called twice, to unlearn/train. A) SOURCE=error CLASS=spam MODE=unlearn B) SOURCE=error CLASS=innocent MODE=toe
Server side filtering 1) Before queue, 2) after queue :
Option 1) Simscan Option 2a Domain level) If dspam is enabled at domain level in .qmail-default use this file: # cd /home/vpopmail/'dspam-enabled-domain' # mv .qmail-default .qmail-default.bak # chmod 600 .qmail-default && chown vpopmail:vchkpw .qmail-default # wget https://raw.githubusercontent.com/qmtoaster/dspam/master/.qmail-default Option 2b User level) If dspam is enabled at user level you must install maildrop and download and install two files .qmail and .mailfilter.dspam (or .mailfilter) in each user directory for which Dspam will be enabled. # cd /home/vpopmail/'dspam-enabled-domain'/'user' # wget https://raw.githubusercontent.com/qmtoaster/dspam/master/.qmail # wget https://raw.githubusercontent.com/qmtoaster/dspam/master/.mailfilter.dspam # chown vpopmail:vchkpw .qmail # chown vpopmail:vchkpw .mailfilter.dspam # chmod 600 .qmail # chmod 600 .mailfilter.dspam
Mail should flow and be logged # cat /var/log/maildrop/maildrop-'user'@'dspam-enabled-domain'.log
At this point in your email client you must create the 'spam' and 'notspam' folders and start placing spam in the spam folder to be learned by the script.

Dspam w/PostgreSQL