Edgewall Software

Version 10 (modified by Christian Boos, 18 years ago) ( diff )

Added table for recommended version

Trac Spam Filtering

A plugin is being developed that will allow different ways to reject contributions that contain spam. This plugin requires the forthcoming Trac release 0.10. It currently needs at least [3180], which has the necessary hooks for spam filtering to work.

Supported Filtering Strategies

Regular Expressions

The regex filter reads a list of regular expressions from a wiki page named “BadContent”, each regular expression being on a separate line inside the first code block on the page, using the Python syntax for regular expressions.

If any of those regular expressions matches the submitted content, the submission will be rejected.

IP Blacklisting

The ip_blacklist filter uses the third-party Python library dnspython to make DNS requests to a configurable list of IP blacklist servers.

Akismet

The akismet filter uses the Akismet web service to check content for possible spam.

The use of this filter requires a Wordpress API key. The API key is configured in trac.ini in a separate section:

[akismet]
api_key = 1234567890

Bayes

TODO (The code in svn uses SpamBayes, which is a logical choice. It would make sense to use a custom tokenizer, however, rather than the email-centric one that is included with SpamBayes. The bigger issue is that some form of training is required (e.g. the API could be extended so that (optionally) authenticated users (and the other filters) could report contributions as spam (using automatic training to assume that everything else is ham); however, this is a complex change). An alternative to this would be a script that could be periodically executed that would train all existing contributions as ham, and gather spam from an appropriate source. If you decide to continue with this in the future, please don't hestiate to ask spambayes-dev for help.

Get the Plugin

The SpamFilter plugin is currently only available through Subversion:

  svn co http://svn.edgewall.com/repos/trac/sandbox/spam-filter

You can browse the source here.

Recommended versions:

Trac Spam Filter
0.10dev r3559

See TracPlugins for instructions on building and installing plugins.

Enabling the Plugin

If you install the plugin globally (as described here), you'll also need to enable it in trac.ini as follows:

[components]
tracspamfilter.* = enabled

See also: TracPlugins, PluginList

Note: See TracWiki for help on using the wiki.