Jump to content

Extension:CrowdSec

From mediawiki.org
MediaWiki extensions manual
CrowdSec
Release status: experimental
Implementation Page action
Description Bouncer Integration with CrowdSec for anti-spam.
Author(s) MPThLeetalk
Latest version 0.20.0
MediaWiki 1.39+
License GNU General Public License 2.0 or later
Download

  • $wgCrowdSecEnable
  • $wgCrowdSecAPIUrl
  • $wgCrowdSecAPIKey
  • $wgCrowdSecCache
  • $wgCrowdSecCacheTTL
  • $wgCrowdSecFallback
  • $wgCrowdSecRestrictRead
  • $wgCrowdSecTreatTypesAsBan
  • $wgCrowdSecReportOnly

  • crowdsec-bypass

This extension adds anti-spam integration with CrowdSec. It works as a bouncer, so it is mandatory to set up the CrowdSec Agent as well.

Installation

[edit]

Configuration

[edit]

Step 1: Setup CrowdSec Agent

[edit]

Follow this documentation from CrowdSec. You may need to set up collections, logs, and more.

Then, you need to get a bouncer API token.

sudo cscli bouncers add mediawiki-bouncer

Remember the token key. It needs to be added to the extension configuration.

It is highly recommended to register with the Central API to pull blocklists from remote sources.

sudo cscli capi register

Step 2: Setup Extension

[edit]
wfLoadExtension( 'CrowdSec' );
$wgCrowdSecAPIKey = ""; // Put LAPI key here.

This is the basic configuration. More configurations are documented in the README.

Notes

[edit]

This extension is highly experimental. Use at your own risk.

[edit]
  • There is no challenge method implemented. You can treat captcha decisions as bans using $wgCrowdSecTreatTypesAsBan.
  • This extension has been tested on MediaWiki 1.43. The minimum required version is 1.39+. It may work on older versions.

AbuseFilter Integration

[edit]

This extension integrates with AbuseFilter. The variable crowdsec_decision represents the CrowdSec decision:

  • ok: The user is allowed to proceed.
  • ban: The user is banned according to LAPI.
  • error: The LAPI request failed.
  • unknown: Failed to retrieve the user's IP.
  • ... and various (custom) types from CrowdSec, including captcha.

User rights

[edit]
  • crowdsec-bypass - Allows users to bypass the CrowdSec check.

See also

[edit]