Dspam.DSpamDirectory Class Reference

Operations on the DSPAM directory. More...

List of all members.

Public Member Functions

def __init__
 Initialize DSpamDirectory.
def dspam_ctx
 Create dspam.ctx using configured defaults.
def get_group
 Return group user belongs to.
def user_files
 Set username and return common pathnames.
def check_spam
 Check spaminess of a message.
def write_web_stats
 Update dspam stats stored as text for the web interface.
def add_spam
 Report a false negative.
def false_positive
 Report a false positive.

Public Attributes

 userdir
 DSPAM home.
 groupfile
 Path of group definition file.
 log
 Logging method.
 headerchange
 Hook for changing mail headers in the MTA to mirror changes by Dspam.
 username
 The dspam user current being processed.
 probability
 The spam score from 0.0 to 1.0.
 factors
 The top tokens that determined the spam score.
 algorithms
 Default spam score algorithms to use.
 tokenizer
 Default tokenizer.
 training
 Training mode.
 totals
 DSPAM totals for user from last operation.
 result
 Classification from last check_spam.
 mbox
 Path of quarantine mailbox used by pydspam for user.
 lock
 Path of lock file used by libdspam.
 dspam_dict
 dspam_stats
 sigfile

Private Member Functions

def _lognull
def _add_sig
 Add signature key to message, and quarantine if spammy.
def _feedback
def _innoc

Detailed Description

Operations on the DSPAM directory.


Member Function Documentation

def Dspam.DSpamDirectory.__init__ (   self,
  userdir 
)

Initialize DSpamDirectory.

The base directory is something like /var/lib/dspam.

Parameters:
userdir the DSPAM base directory
def Dspam.DSpamDirectory._add_sig (   self,
  txt,
  sig,
  recipients = None 
) [private]

Add signature key to message, and quarantine if spammy.

The results of the last check_spam as used.

Parameters:
txt the message
sig the signature
recipients list of recipients for later delivery
def Dspam.DSpamDirectory.add_spam (   self,
  user,
  txt 
)

Report a false negative.

Tell DSPAM a message it though was innocent is actually spam. DSPAM looks for signature keys, and looks up stored signatures with them. It trains DSPAM with the signature, setting the source to DSS_ERROR. If no signature is found, it adds the spam as a spam "corpus".

Parameters:
user the DSPAM user
txt the spam message
def Dspam.DSpamDirectory.check_spam (   self,
  user,
  txt,
  recipients = None,
  classify = False,
  quarantine = True,
  force_result = None 
)

Check spaminess of a message.

Parameters:
user the dspam user (email account)
txt the message as collected from the MTA
recipients If provided, a list of recipients to record in quarantined messages to assist later delivery.
classify 
quarantine Add messages classified as spam to mbox quarantine if true.
force_result train as this result
Returns:
tagged message, or None if message was quarantined
def Dspam.DSpamDirectory.dspam_ctx (   self,
  op,
  flags = 0,
  user = None 
)

Create dspam.ctx using configured defaults.

E.g.

 with self.dspam_ctx(dspam.DSM_CLASSIFY) as ds:
   ds.process(txt)
   self.result = ds.result
 
Parameters:
op dspam operation mode: one of dspam.DSM_*
flags dspam operation flags: set of dspam.DSF_*
user a different user, e.g. for innoculation
Returns:
context manager for dspam.ctx
def Dspam.DSpamDirectory.false_positive (   self,
  user,
  txt 
)

Report a false positive.

Tell DSPAM a message it though was spam is actually innocent. DSPAM looks for signature keys, and looks up stored signatures with them. It trains DSPAM with the signature, setting the source to DSS_ERROR. If no signature is found, it adds the message as an innocent "corpus" (DSS_CORPUS).

Parameters:
user the DSPAM user
txt the innocent message
def Dspam.DSpamDirectory.get_group (   self,
  user 
)

Return group user belongs to.

FIXME: update for new group concepts and syntax.

def Dspam.DSpamDirectory.user_files (   self,
  user 
)

Set username and return common pathnames.

Parameters:
user The dspam user for subsequent operations.
Returns:
commonly used pathnames: (dspam_dict,sigfile,mbox)
def Dspam.DSpamDirectory.write_web_stats (   self,
  totals 
)

Update dspam stats stored as text for the web interface.

Parameters:
totals totals obtained from dspam.ctx.totals

Member Data Documentation

Default spam score algorithms to use.

The top tokens that determined the spam score.

Path of group definition file.

Note, syntax has changed since dspam-2.6.

Hook for changing mail headers in the MTA to mirror changes by Dspam.

See mime module from pymilter for details.

Path of lock file used by libdspam.

See also:
dspam.get_fcntl_lock

Logging method.

Path of quarantine mailbox used by pydspam for user.

The dspam LDA and other libdspam clients may have different quarantines.

Classification from last check_spam.

DSPAM totals for user from last operation.

Training mode.

Default to train on everything, since that is what old dspam did, and milter depends on that.

DSPAM home.

Base directory where dspam stores dictionaries and configs.


The documentation for this class was generated from the following file:

Generated on 15 Feb 2015 for pydspam by  doxygen 1.6.1