Help us understand the problem. What is going on with this article?

MediaWikiのスパム対策

More than 5 years have passed since last update.

編集履歴

  • 初版作成:2013/03/31

概要

MediaWikiでは、WordPressのakismetのようなソーシャルフィルタリングによる優れたスパムブロックのプラグイン(拡張機能)がありません。

ConfirmEdit拡張機能とQuestyCaptchaによるキャプチャ認証で日本語による質問をいくつか用意してランダムに提示することにより、英語圏のスパムbot対策を行います。

拡張機能のインストール

cd extensions
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/AntiBot.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SimpleAntiSpam.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/TorBlock.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/ConfirmEdit.git
# svn checkout http://svn.sourceforge.jp/svnroot/macwiki/tatyana/MacWikiCaptcha
# git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/TitleBlacklist.git

LocalSettings.phpの設定

require_once( "$IP/extensions/AntiBot/AntiBot.php" );
require_once( "$IP/extensions/SimpleAntiSpam/SimpleAntiSpam.php" );
require_once( "$IP/extensions/TorBlock/TorBlock.php" );
require_once( "$IP/extensions/ConfirmEdit/ConfirmEdit.php" );
require_once( "$IP/extensions/ConfirmEdit/QuestyCaptcha.php");
# require_once( "$IP/extensions/MacWikiCaptcha/MacWikiCaptcha.php" );
# require_once( "$IP/extensions/TitleBlacklist/TitleBlacklist.php" );

$wgGroupPermissions['*'            ]['skipcaptcha'] = false;
$wgGroupPermissions['user'         ]['skipcaptcha'] = false;
$wgGroupPermissions['autoconfirmed']['skipcaptcha'] = false;
$wgGroupPermissions['bot'          ]['skipcaptcha'] = false; // registered bots
$wgGroupPermissions['sysop'        ]['skipcaptcha'] = true;
$wgCaptchaTriggers['edit']          = true; // Would check on every edit
$wgCaptchaTriggers['create']        = true; // Check on page creation.
$wgCaptchaTriggers['sendemail']     = true; // Special:Emailuser
$wgCaptchaTriggers['addurl']        = true;  // Check on edits that add URLs
$wgCaptchaTriggers['createaccount'] = true;  // Special:Userlogin&type=signup
$wgCaptchaTriggers['badlogin']      = true;  // Special:Userlogin after failure

# $wgCaptchaClass = 'MacWikiCaptcha2';

# for ConfirmEdit and QuestyCapcha

$wgCaptchaClass = 'QuestyCaptcha';
$arr = array (
        "しつもんいち" => "こたえいち",
        "しつもんに" => "こたえに",
        "しつもんさん" => "こたえさん",
);
foreach ( $arr as $key => $value ) {
        $wgCaptchaQuestions[] = array( 'question' => $key, 'answer' => $value );
}

メモ:

  • MacWikiCaptchaは、日本語によりキャプチャの質問を記述できるが固定の質問を1つしか定義できないため、スパム対策の効果は限定的と思われます。
  • TitleBlacklistの拡張機能は、他の拡張機能とコンフリクトを起こすので組み込めませんでした。
  • sysopグループ(管理者グループ)以外のユーザーの全ての操作でキャプチャ認証を実行するように指定しています。

参考

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away