key Log In

You are here: wiki.fini > TWiki Web > BlackListPlugin

Start of topic | Skip to actions

Black List Plugin

Description

This is a simple utility to keep black sheep away from a public TWiki site. The site can be protected against excessive page access (e.g. by bad robots), suspicious activities of users, such as multiple registrations or rapid topic updates indicating Wiki:WikiSpam, or saving text with wiki-spam.

The Plugin monitors activities by IP address and uses three IP address lists to protect the TWiki site:

  • WHITELIST: Manually maintained list of users who should never get on the BANLIST
  • BLACKLIST: Manually maintained list of malicious users
  • BANLIST: Automatically updated list of users with suspicious activities

On topic save, text is compared to a known list of spam patterns. If wiki-spam is identified, topic save is cancelled, an error message is shown, and the IP address is put on the BANLIST. Two wiki-spam lists are used:

  • Local SPAMLIST: Manually maintained list of spam patterns
  • Public wiki-spam list: Big list of wiki-spam patterns, retrieved from external web site

Users on the BLACKLIST and BANLIST will have every page access delayed by one minute and will get an error message.

The registration form can also be protected from improper use.

To fight Wiki-spam, the Plugin can also add a rel="nofollow" parameter to external URLs. Search engines will not follow links that have this parameter, taking away the incentive to add spam to TWiki.

Plugin Settings

Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%, i.e. %INTERWIKIPLUGIN_SHORTDESCRIPTION%

General settings

  • One line description, is shown in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Utility to keep malicious users away from a public TWiki site

  • Debug plugin: (See output in data/debug.txt)
    • Set DEBUG = 0

  • Log access of blacklist and spam list activities: (0 or 1)
    • Set LOGACCESS = 1

WHITELIST, BLACKLIST and BANLIST settings

  • WHITELIST: Comma delimited list of IP addresses; possible to use partial addresses ending in a dot
    • Set WHITELIST = 127.0.0.1, 205.166.143.9, 205.166.143.23, 205.166.143.9, 205.166.143.23, 70.174.81.11, 70.174.82.215, 70.177.223.128, 68.225.180.102, 98.140.58.188, 192.168.144.

  • BLACKLIST: Comma delimited list of IP addresses; possible to use partial addresses ending in a dot
    • Set BLACKLIST = 91.201.66., 109.230.246., 188.143.232., 194.8.74., 194.8.75., 203.88.152., 203.88.155., 212.235.92., 212.235.107., 219.65.75.

  • BANLIST: Automatically updated list of IP addresses based on BANLIST configuration
    • Action: IP address(es)
    • Current list: 85.17.103.104, 82.78.149.130, 219.147.15.90, 211.144.126.3, 210.212.248.99, 59.145.117.2, 67.15.207.27, 59.151.47.170, 204.11.237.116, 221.128.125.133, 216.133.248.228, 202.45.119.37, 222.216.2.178, 210.212.95.103, 203.28.159.167, 69.88.144.162, 203.144.144.164, 216.133.248.226, 212.45.32.211, 84.246.176.66, 203.113.15.246, 195.175.37.71, 200.88.125.9, 80.191.216.50, 203.144.144.163, 201.32.150.16, 216.139.217.135, 82.141.146.20, 84.205.252.218, 203.113.15.234, 217.195.219.92, 200.131.218.3, 84.19.176.62, 211.94.164.210, 203.144.160.248, 80.58.205.41, 195.175.37.70, 85.183.246.2, 85.38.191.67, 201.32.133.23, 81.169.129.3, 216.133.248.229, 216.163.188.209, 216.163.188.207, 216.133.248.227, 212.119.45.138, 84.16.240.239, 200.24.117.98, 211.99.196.117, 220.226.63.254, 196.11.241.194, 201.50.233.228, 199.203.55.3, 201.64.249.130, 69.86.220.66, 201.32.133.40, 201.57.66.2, 84.205.252.163, 216.133.248.230, 210.212.102.68, 202.106.62.117, 69.88.144.163, 211.48.62.49, 62.141.38.229, 65.98.118.234, 217.153.134.78, 218.188.1.54, 41.222.70.190, 89.223.1.72, 61.95.148.3, 142.165.3.43, 125.244.76.130, 212.158.159.210, 220.225.32.93, 211.140.192.186, 84.148.118.40, 221.143.23.93, 220.225.146.132, 213.74.28.150, 218.93.113.58, 217.107.228.234, 203.28.159.170, 58.26.9.158, 218.7.48.22, 85.25.141.66, 201.38.189.178, 86.39.156.91, 125.244.72.2, 201.36.165.130, 125.243.246.130, 81.17.202.81, 87.97.64.196, 125.248.244.131, 218.28.86.97, 61.55.135.167, 69.88.144.161, 200.41.60.134, 125.243.69.102, 125.244.73.194, 80.58.205.36, 217.66.22.86, 67.68.6.38, 62.133.177.48, 195.225.177.136, 217.141.108.200, 62.231.243.137, 68.157.143.2, 90.189.173.98, 69.72.122.73, 83.237.56.35, 83.237.59.67, 78.47.78.82, 83.237.57.219, 83.237.59.190, 222.127.228.6, 68.196.211.62, 67.182.199.214, 83.237.57.231, 200.88.223.99, 148.233.159.58, 217.218.36.1, 200.76.240.39, 203.162.2.137, 83.231.136.9, 212.116.219.108, 205.209.188.226, 212.116.219.211, 92.48.84.209, 67.68.7.243, 82.201.5.55, 97.116.53.135, 205.209.188.250, 12.206.28.46, 82.120.240.167, 66.231.188.54, 97.88.137.51, 24.182.45.28, 68.192.9.221, 85.196.112.110, 206.74.10.235, 205.209.170.3, 205.209.170.19, 200.6.122.50, 94.102.60.77, 91.121.144.185, 65.39.172.203, 97.114.209.163, 76.122.35.166, 194.8.74.37, 222.237.78.10, 217.20.115.88, 79.111.166.12, 212.235.92.141, 70.177.231.68, 190.2.53.2, 150.254.175.15, 144.53.226.17, 60.242.109.71, 200.122.177.3, 194.8.75.96, 92.48.193.55, 76.65.80.198, 212.117.188.207, 67.189.132.153, 87.82.193.2, 98.126.44.106, 92.112.217.241, 75.127.177.114, 88.113.0.59, 91.205.124.7, 94.102.51.22, 118.175.255.10, 69.253.39.207, 95.215.1.13, 213.155.25.194, 89.149.241.118, 212.117.176.186, 212.235.107.101, 58.51.90.249, 8.9.209.2, 66.96.251.88, 64.83.16.75, 195.39.210.202, 72.32.122.8, 88.217.61.196, 88.217.48.225, 88.217.57.18, 94.76.226.70, 66.229.221.39, 195.88.33.108, 173.66.178.246, 88.217.57.81, 93.104.36.219, 217.77.223.20, 93.104.18.21, 77.88.31.247, 95.215.1.15, 64.79.72.114, 122.49.210.50, 119.111.124.194, 78.96.117.90, 85.25.124.132, 93.104.50.37, 89.46.32.198, 71.194.95.244, 93.104.102.213, 217.23.8.168, 195.39.210.207, 213.222.161.169, 188.4.114.13, 120.60.7.43, 41.196.114.252, 203.218.79.59, 69.172.100.50, 121.97.219.188, 208.118.60.157, 67.23.4.54, 120.61.130.55, 122.2.127.116, 91.8.35.201, 91.8.5.95, 188.92.75.36, 173.192.34.95, 178.67.192.2, 79.24.68.58, 60.53.201.114, 41.98.9.66, 190.206.21.117, 70.45.223.225, 217.11.179.39, 98.165.73.131, 197.0.215.46, 81.248.218.12, 92.81.91.45, 91.201.66.56, 91.8.32.63, 91.8.41.94, 91.8.40.77, 98.165.94.209, 173.193.219.168, 91.8.41.140, 91.8.13.71, 113.53.172.2, 82.154.7.130, 62.169.67.134, 178.187.240.91, 212.113.36.56, 98.165.92.90, 91.8.20.166, 178.187.59.49, 213.5.71.157, 109.230.220.241, 60.172.229.90, 77.47.193.55, 178.126.201.209, 74.118.193.84, 208.77.221.210, 195.42.102.21, 91.8.27.249, 91.8.41.32, 173.45.107.170, 209.190.3.218, 46.4.77.106, 62.75.182.85, 109.104.184.136, 208.43.81.144, 207.182.146.234, 212.113.37.105, 212.113.35.162, 109.230.217.88, 188.143.232.10, 89.238.159.185, 78.60.164.191, 95.84.178.221, 85.206.70.236, 80.245.85.51, 209.190.3.210, 46.4.23.198, 213.186.120.196, 212.117.174.33, 109.230.223.95, 95.64.12.13, 95.64.12.34, 188.163.66.141, 213.108.21.46, 91.206.14.112, 85.17.84.82, 84.23.34.227, 157.55.116.58, 178.63.46.166, 81.83.51.184, 109.73.68.18, 46.4.122.91, 95.111.51.89, 86.58.17.118, 89.102.97.156, 122.3.171.14, 180.190.169.139, 174.133.5.250, 193.238.66.17, 176.74.192.87, 31.192.104.163, 118.173.90.86, 83.149.126.98, 46.165.197.142, 209.131.51.16, 108.59.8.80, 88.198.9.123, 118.173.71.184, 222.186.55.189, 180.180.65.123, 118.173.65.84, 89.238.182.244, 46.165.197.141, 62.212.73.211, 184.154.48.82, 108.59.8.70, 173.242.125.196, 109.123.117.146, 173.242.125.206, 159.253.145.142, 159.253.143.53, 107.20.69.233, 46.4.68.104, 79.143.177.176, 66.249.68.113, 173.242.125.191, 129.170.192.96, 188.138.118.180, 62.219.8.230, 88.198.5.172, 46.236.95.177, 66.249.73.184, 66.249.73.46, 188.138.104.208, 207.180.175.2, 99.69.29.190, 109.14.90.22, 173.208.150.250, 69.30.238.26, 204.12.198.106, 204.12.208.218, 5.9.82.194, 176.9.51.142, 209.222.102.194, 204.12.214.162, 199.58.86.206, 69.197.129.42, 94.23.23.127, 77.7.212.246

  • BANLIST configuration, comma delimited list of:
    1. Points for registration
    2. Points for each save and upload
    3. Points for view and other actions
    4. Points for view raw
    5. Threshold to add to BANLIST
    6. Measured over time (in seconds)
    • Set BANLISTCONFIG = 20, 5, 1, 20, 180, 300
    • Your current score: N/A for IP address 192.168.144.108

  • Message for users on BLACKLIST and BANLIST:
    • Set BLACKLISTMESSAGE = Your IP address 192.168.144.108 is black listed at the wiki.fini web site due to excessive access or suspicious activities. Please contact site administrator wikimaster@fini.net if you got on the list by mistake.

Wiki-spam filtering settings

  • Filter wiki-spam on topic save and HTML file uploads based on SPAMLIST: (0 or 1)
    • Set FILTERWIKISPAM = 1

  • Comma separated list of Web.Topics to exclude from wiki-spam filtering on topic save:
    • Set SPAMEXCLUDETOPICS =

  • Local SPAMLIST: Manually maintained list of spam patterns (NOTE: Must be RegularExpression patterns)
    • Action: wiki-spam regex pattern(s) http://.*?
    • Current list: http://\S*informe\.com, -clomid, premarin, prilosec, flomax, tryptophan, shine\.yahoo\.com/channel/none/, betnovate, voltaren, corticosteroids, diclofenac, topamax, acdcvan\.ning\.com/profiles, norvasc, bactrim, www\.worldkidneyday\.org, pariet, cefixime, levitra, lasix, without.prescription, aciphex, prozac, celexa, proscar, finasteride, onlinejobs, -rx-, hydrochlorothiazide, avapro, blackdub\.ning\.com, paxil, www\.ammazzatecitutti\.org, paroxetine, nexium, -generic-, -cheap-, avelox, moxifloxacin, flashvillage\.com, lamictal, augmentin, amoxicillin, advair, pulse\.yahoo\.com/, www\.streetballtalk\.com, -dating-site, adult-dating, online-dating, /trig\.com/, cheapestvoip

  • Cache refresh time (in minutes) for public wiki-merge pattern list:
    • Set SPAMLISTREFRESH = 60

  • Cache refresh time (in minutes) for internal wiki-spam regular expression cache:
    • Set SPAMREGEXREFRESH = 10

  • Message for users trying to save text with wiki-spam:
    • Set WIKISPAMMESSAGE = Wiki-spam detected: "%WIKISPAMWORD%" is a banned word and cannot be saved. Your IP address 192.168.144.108 is black listed at the wiki.fini web site due to suspicious activities. Please contact site administrator wikimaster@fini.net if you got on the list by mistake.

Registration protection settings

  • Protect registration: (number of minutes to expire, 15 minutes is recommended, 0 to disable)
    • Set REGEXPIRE = 0
    • If enabled, a magic number is protecting the registration process. TWiki expects a form field with a magic number. An error message is shown if not valid or if expired. This makes it harder to register a user by a script. A hidden field needs to be added to the registration form:
      <input type="hidden" name="rx" value="%BLACKLISTPLUGIN{ action="magic" }%" />

  • Message shown when using registration form incorrectly: (this message is deliberately vague)
    • Set REGMESSAGE = Registration failed, please try again.

Nofollow link setting

  • Add a rel="nofollow" parameter to external URLs. Use this is to fight Wiki-spam. Search engines will not follow the link if a URL has a nofollow parameter, such as <a href="http://spammer.com/" rel="nofollow">. Specify topic age in hours for which the nofollow parameter should appear (set it to a value that gives you enough time to remove spam); set it to -1 to add the nofollow parameter unconditionally to external URLs; or 0 to disable: (-1, 0, 1...N)
    • Set NOFOLLOWAGE = -1

Plugin Installation Instructions

Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.

  • Download the ZIP file from the Plugin web (see below)
  • Unzip BlackListPlugin.zip in your twiki installation directory. Content:
    File: Description:
    data/TWiki/BlackListPlugin.txt Plugin topic
    data/TWiki/BlackListPlugin.txt,v Plugin topic repository
    lib/TWiki/Plugins/BlackListPlugin.pm Plugin Perl module
    pub/TWiki/BlackListPlugin/.htaccess Apache access control to protect pub dir
    templates/oopsblacklist.tmpl Generic oops message
  • Write protect this Plugin topic (if not already done)
  • Make sure pub/TWiki/BlackListPlugin/ is writable by the CGI user (typically nobody)
  • Add the hidden form field to the registration form as described in the "Registration protection settings" section (this is already in TWiki 4.0)
  • From TWiki 4.0 release on: Run the configure utility in your browser to enable the Plugin
  • Test if the installation was successful:
    1. Using above form, add the IP address of one of your workstations to the BANLIST
    2. Access TWiki from that workstation
      • if you look at a TWiki topic (with the view script) you should see the BLACKLISTMESSAGE (defined above) after a one minute timeout
      • else, you should get an 500 Internal Server Error for other scripts
    3. On a different workstation, remove the IP address of the test workstation from the BANLIST

Known Issues and Limitations

  • Wiki-spam filtering for HTML attachments works in TWiki 01-Sep-2004 and later.
  • With TWiki 4.0.2 on some platforms, notably Solaris, attached files are uploaded with a zero file size. This is because there is a bug in how TWiki 4.0.2 handles the beforeAttachmentSaveHandler. If affected, upgrade TWiki or apply bug fix Item2390

Plugin Info

Plugin Author: TWiki:Main/PeterThoeny
Plugin Version: 02 Jun 2006 (r10442)
Change History:  
02 Jun 2006: Added wiki-spam filtering for HTML attachments to combat TWiki:Codev.HtmlAttachmentSpam
29 Apr 2006: Added %BLACKLISTPLUGIN{ action="spam_show_n" }% that shows the local spam list in a shareable format with newline separator
07 Feb 2006: TWiki Release 4.0 fix to allow registration with e-mail verification, reset password and approve
03 Jan 2006: Filter lines with space from spam list; fixed bug that inproperly filtered HTML from spam list; Dakar Release fix (end/postRenderingHandler issue)
08 Nov 2005: Doc fixes; code warning fixes; allow empty local SPAMLIST and public spam list
04 Nov 2005: Added registration protection with magic number
30 Oct 2005: Dakar Release compatibility: Work around Dakar preferencs bug
29 Oct 2005: Added wiki-spam filtering to prevent topic save with wiki-spam
27 Oct 2005: For BANLIST, add/remove multiple IP addresses at once, contributed by TWiki:Main.MichaelDaum
22 Jan 2005: Added NOFOLLOWAGE handling
19 Jan 2005: Added score for "view raw" to address e-mail harvester issue
05 Apr 2004: Fixed bug in event log (requiring update of earlier Plugin versions); doc updates
04 Apr 2004: Added WHITELIST and BANLIST
21 Mar 2004: Initial version
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
License: GPL (GNU General Public License)
TWiki:Plugins/Benchmark: GoodStyle 99%, FormattedSearch 99%, BlackListPlugin 97%
Plugin Home: http://TWiki.org/cgi-bin/view/Plugins/BlackListPlugin
Feedback: http://TWiki.org/cgi-bin/view/Plugins/BlackListPluginDev
Appraisal: http://TWiki.org/cgi-bin/view/Plugins/BlackListPluginAppraisal

Related Topics: TWikiPreferences, TWikiPlugins, Google wiki spam directory

-- TWiki:Main/PeterThoeny - 02 Jun 2006

This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding wiki.fini? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.BlackListPlugin