NAME

Blog::Spam::Server - An RPC server which detects comment spam.

ABOUT

This program implements a plugin-based XML-RPC server which may be queried from a number of languages.

The intention is that clients will query this server to detect whether their comment submissions are spam or genuine.

Whilst it isn't likely to be amazingly comprehensive it should do better than simple tests are able to do locally, and the benefit of running your own server is that you can centralise the testing which is used by multiple web applications.

(Of course if you trust an external third party then you have a new single point of failure - thats why the server is open-source. Run your own!)

PLUGINS

The core of the server is a collection of plugins, each of which will be loaded dynamically from the Blog::Spam::Plugin namespace. Please see Blog::Spam::Plugin::Sample for available plugin documentation.

Each plugin will be passed a hash of data from the client, and it is expected that the plugin will return a single string result:

"ok"   =>  The comment is OK, and the next plugin should be called.

"spam" =>  The comment is spam, and further plugins should be skipped.

"good" =>  The comment is good, and all further plugins should be skipped.

CALLING

To call the XML-RPC server you should pass the following parameters in a struct:

agent   -> The user-agent of the submitting browser, if any.
comment -> The body of the comment
email   -> The email address submitted
ip      -> The IP the comment was submitted from.
name    -> The name the user chose, if any.

options -> Discussed later.

The only mandatory arguments are "comment" and "IP", the rest are optional but may be useful and it is recommended you pass them if you can.

The return value will either be "OK", or "SPAM". Optionally a reason may be returned in the case a comment is justed as SPAM, for example:

SPAM:I don't like comments submitted before 9AM.

OPTIONS

You may pass the optional "options" string to the server, if you wish finer control.

This option string should consist of comma-separated tokens.

The permissible values are:

whitelist=1.2.3.4      -> Whitelist the given IP / CIDR range.
blacklist=1.2.3.4      -> Blacklist the given IP / CIDR range.

exclude=plugin         -> Don't run the plugin with name "plugin".

mandatory=subject      -> Specify the given field should always be
                          present.

max-links=20           -> The maximum number of URLs.

min-size=1024          -> Minimum body size.

max-size=2k            -> Maximum body size

fail                   -> Always return "spam"

These options may be repeated, for example the following is a valid value for the "options" setting:

mandatory=subject,mandatory=name,whitelist=1.2.3.4,exclude=surbl

That example will:

1. Make the "subject" field mandatory.

2. Makes the "name" field mandatory.

3. Whitelists any comments subitted from the IP 1.2.3.4

4. Causes the server to not run the surbl test.

LICENSE

This code is licensed under the terms of the GNU General Public License, version 2. See included file GPL-2 for details.

AUTHOR

Steve -- http://www.steve.org.uk/

LICENSE

Copyright (c) 2008-2010 by Steve Kemp. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The LICENSE file contains the full text of the license.

new

Create a new instance of this object.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 120:

=cut found outside a pod block. Skipping to next block.