MediaWiki Spam Prevention

From Linux Delta
Jump to: navigation, search

The basics of protecting Media Wiki from SPAM, using account confirmation feature and the Moderation extension.

These changes have been tested against MediaWiki v1.34

Download and install the Moderation Extension[edit]

mv mediawiki-moderation-1.4.20/ /srv/mediawiki/extensions/Moderation

Update the MediaWiki database schema[edit]

php /srv/mediawiki/maintenance/update.php

Update the MediaWiki settings file[edit]

Patch the following into LocalSettings.php:

$wgEnableEmail = true;
$wgEmergencyContact = '';	# judging by the docs, this is misnomered and 
							# in most situations should be the same as 
							# $wgPasswordSender
$wgPasswordSender = '';

Append the following into LocalSettings.php

# Filter out changes containing certain key words
$wgSpamRegex = "/".

# Block spam edits from black listed IP addresses
$wgEnableDnsBlacklist = true;
$wgDnsBlacklistUrls = array( '', '' );

$wgEmailConfirmToEdit = true; 	# Unfortunately you can't force users to 
				# provide an email address when they create 
				# an account, but this should ensure they
				# have a confirmed email address before they 
				# can edit

# You need to specify a mail server for sending confirmation email
$wgSMTP = [
    'host'     => 'submission.someserver.somewhere',
    'IDHost'   => 'mediawiki.domain.somwhere',
    'port'     => 587,
    'auth'     => true,
    'username' => 'username',
    'password' => 'password'

wfLoadExtension( 'Moderation' );

Now test your changes.

Further Reading[edit]$wgSMTP