Tuning your Trac SpamFilter plugin

How does the plugin work?

This plugin is not really relevant, unless your are allowing anonymous access to your trac instance. 

It's a point based system: 'karma' score. You set a minimum karma, and if it the submission doesn't have the needed 'karma' then it's classified as spam.

There are five ways that it checks a message. It goes through each of them, and either it adds or removes "karma", starting at 0.

Make sure you have enabled the plugin first: Add Trac Plugins. 

Tuning the Spam-Filter plugin

Login to Trac as an admin > Admin > under trac.ini: click spam-filter.

As we mentioned there are 5 checks:

  • Akismet is an external spam filter service. If the message is marked as spam by Akismet it will subtract akismet_karma value (5 default). To use it in this service with your trac plugin, you'd need first to get an Akismet API key from their site, and place it in your Trac seetings.
  • external link. If the ticket is submitted with greater than max_external_links the filter will subtract extlinks_karma value.
  • IP throttling, triggered if over max_posts_by_ip posts/tickets are made from the same IP address in one hour. It could minimise the amount of spam a single bot can post.
  • regex_karma, this is how much karma is subtracted if your post matches BadContent wiki. (Create a wiki page called BadContent, and enter any blacklisted terms and regex you need - here is an example)
  • Captcha. If the min_karma is not reached, then the user will be challenged with a captcha. There are 3 types of captchas available: Expression, Image, and Google's Recaptcha. The first two work right off the bat, but for Recaptcha make sure you get service keys, and place in captcha_recaptcha_private/public_key 

Other important settings:

  • session_karma - not relevant since authenticated users are trusted
  • min_karma is the cut-off. You could be set it to a low or even negative number. For instance set it to -5 so that multiple





Article is closed for comments.