Class SpamAssassinManager
- All Implemented Interfaces:
TableListener
,PackageManager.PackageListener
,Runnable
The SpamAssassin manager looks for emails left in specific directories by the IMAP server.
When these files are found, the SpamAssassin training command (sa-learn
) is invoked
on these files. The files start with either ham_
or spam_
depending on
the type of messages. In order to maintain the expected behavior, the files
are processed in chronological order. That way if a user drags a message to the Junk
folder then back to the INBOX, it will not be considered spam.
To help avoid any race conditions, only files that are at least 1 minute old (or in the future by 1 or more minutes to handle clock changes) are considered on each pass. This gives the IMAP server at least one minute to write all of its files.
Multiple files from one user are sent to sa-learn
at once when possible for efficiency.
TODO: SELinux port management for non-standard (other than 783) ports.
TODO: Somehow report when users drag from Junk to elsewhere (ham training), perhaps we can tweak our sa_discard_score some
- Author:
- AO Industries, Inc.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
TODO: Make this be a standard Unix-based cron job, outside aoserv-daemon package, so that functionality remains when aoserv-daemon disabled or uninstalled. -
Field Summary
Fields inherited from class com.aoindustries.aoserv.daemon.util.BuilderThread
DEFAULT_MAXIMUM_DELAY, DEFAULT_MINIMUM_DELAY, DEFAULT_PROCESS_TIMER_MAXIMUM_TIME, DEFAULT_PROCESS_TIMER_REMINDER_INTERVAL
-
Method Summary
Methods inherited from class com.aoindustries.aoserv.daemon.util.BuilderThread
getMaximumDelay, getMinimumDelay, getProcessTimerReminderInterval, getProcessTimerSubject, getRandomDelay, packageListUpdated, tableUpdated, waitForBuild
-
Method Details
-
run
public void run() -
start
- Throws:
IOException
SQLException
-
getSpamdBind
Gets theBind
for thespamd
process, ornull
if SpamAssassin is not enabled.Note: CentOS 7 supports more than one bind for spamd, but we have no need for it at this time.
- Throws:
IOException
SQLException
-
doRebuild
protected boolean doRebuild()- Specified by:
doRebuild
in classBuilderThread
- Returns:
true
if successful orfalse
if unsuccessful and needs to be retried.
-
getProcessTimerDescription
- Specified by:
getProcessTimerDescription
in classBuilderThread
-
getProcessTimerMaximumTime
public long getProcessTimerMaximumTime()- Overrides:
getProcessTimerMaximumTime
in classBuilderThread
-