A moderation tool for Matrix. Visit #mjolnir:matrix.org for more information.
As an all-in-one moderation tool, it can protect your server from malicious invites, spam messages, and whatever else you don't want. In addition to server-level protection, Mjolnir is great for communities wanting to protect their rooms without having to use their personal accounts for moderation.
The bot by default includes support for bans, redactions, anti-spam, server ACLs, room directory changes, room alias transfers, account deactivation, room shutdown, and more.
A Synapse module is also available to apply the same rulesets the bot uses across an entire homeserver.
See the setup documentation for first-time setup documentation.
See the configuration sample with documentation for detailed information about Mjolnir's configuration.
See the synapse module documentation for information on how to setup Mjolnir's accompanying Synapse Module.
After your bot is up and running, you'll want to run a couple commands to get everything set up:
!mjolnir list create COC code-of-conduct-ban-list- This will create a new ban list with the shortcodeCOCand an alias of#code-of-conduct-ban-list:example.org. You will be invited to the room it creates automatically where you can change settings such as the visibility of the room.!mjolnir default COC- This sets the default ban list to the list we just created to help with the ban commands later on.- Review the Moderator's Guide.
- Review
!mjolnir helpto see what else the bot can do.
Since version 1.2, Mjölnir offers the ability to replace the Matrix endpoint used to report abuse and display it into a room, instead of requiring you to request this data from an admin API.
This requires two configuration steps:
- In your Mjölnir configuration file, typically
/etc/mjolnir/config/production.yaml, copy and paste thewebsection fromdefault.yaml, if you don't have it yet (it appears with version 1.20) and setenabled: truefor bothwebandabuseReporting. - Setup a reverse proxy that will redirect requests from
^/_matrix/client/(r0|v3)/rooms/([^/]*)/report/(.*)$tohttp://host:port/api/1/report/$2/$3, wherehostis the host where you run Mjölnir, andportis the port you configured inproduction.yaml. For an example nginx configuration, seetest/nginx.conf. It's the confirmation we use during runtime testing.
This mechanism can extract some information from unencrypted rooms. We have taken precautions to ensure that this cannot be abused: the only case in which this feature will publish information from room foo is:
- If it is used by a member of room foo; AND
- If said member did witness the event; AND
- If the event was unencrypted; AND
- If the event was not redacted/removed/...
Essentially, this is a more restricted variant of the Admin APIs available on homeservers.
However, if you are uncomfortable with this, please do not activate this feature.
Also, you should probably setup your production.yaml to ensure that the web
server can only receive requests from your reverse proxy (e.g. localhost).
This fork includes an enterprise-ready HMA (Hasher-Matcher-Actioner) Plugin for detecting illegal content like CSAM in Matrix media content through hash-based matching.
- Real-time Media Scanning: Automatically processes all media uploads (images, videos, files, audio, stickers)
- Multi-Hash Support: Generates MD5, SHA1, SHA256, and PDQ hashes for comprehensive detection
- Enterprise-Grade Performance:
- Token bucket rate limiting (100 requests/minute default)
- Concurrent request management (5 simultaneous max)
- Comprehensive metrics and monitoring
- Sub-2 second response times
- Automatic Response: Quarantines detected CSAM and alerts administrators
- Privacy-First: Only sends hashes, never actual media content
- Production Ready: Extensive error handling, logging, and configuration options
-
Enable the plugin:
!mjolnir protections enable HMAPlugin -
Configure HMA service endpoint:
!mjolnir protections config HMAPlugin serviceUrl "https://your-hma-service.com/api/v1/hash-lookup" -
Start protection:
!mjolnir protections config HMAPlugin enabled true
- Facebook ThreatExchange HMA: Connects to NCMEC Hash Sharing API for authoritative CSAM detection
- Custom HMA Services: Integrates with any REST API following the HMA protocol
- Development Mode: Includes mock endpoints for testing and development
- Complete Setup Guide: Detailed configuration, troubleshooting, and API reference
- Integration Plans: Strategic roadmap for connecting to real CSAM detection services
- Development Journey: Technical implementation details and testing
🟢 ENTERPRISE READY - Production-tested with comprehensive monitoring, rate limiting, and security features.
See CONTRIBUTING.md.