Home Explore Blog Models CI



nixpkgs

1st chunk of `nixos/modules/services/matrix/mjolnir.md`
37bb9154ef1b48afe63f8e4cfd5fe0a14778378ae46c277a000000010000091d
# Mjolnir (Matrix Moderation Tool) {#module-services-mjolnir}

This chapter will show you how to set up your own, self-hosted
[Mjolnir](https://github.com/matrix-org/mjolnir) instance.

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.

See the [README](https://github.com/matrix-org/mjolnir#readme)
page and the [Moderator's guide](https://github.com/matrix-org/mjolnir/blob/main/docs/moderators.md)
for additional instructions on how to setup and use Mjolnir.

For [additional settings](#opt-services.mjolnir.settings)
see [the default configuration](https://github.com/matrix-org/mjolnir/blob/main/config/default.yaml).

## Mjolnir Setup {#module-services-mjolnir-setup}

First create a new Room which will be used as a management room for Mjolnir. In
this room, Mjolnir will log possible errors and debugging information. You'll
need to set this Room-ID in [services.mjolnir.managementRoom](#opt-services.mjolnir.managementRoom).

Next, create a new user for Mjolnir on your homeserver, if not present already.

The Mjolnir Matrix user expects to be free of any rate limiting.
See [Synapse #6286](https://github.com/matrix-org/synapse/issues/6286)
for an example on how to achieve this.

If you want Mjolnir to be able to deactivate users, move room aliases, shutdown rooms, etc.
you'll need to make the Mjolnir user a Matrix server admin.

Now invite the Mjolnir user to the management room.

It is recommended to use [Pantalaimon](https://github.com/matrix-org/pantalaimon),
so your management room can be encrypted. This also applies if you are looking to moderate an encrypted room.

To enable the Pantalaimon E2E Proxy for mjolnir, enable
[services.mjolnir.pantalaimon](#opt-services.mjolnir.pantalaimon.enable). This will
autoconfigure a new Pantalaimon instance, which will connect to the homeserver
set in [services.mjolnir.homeserverUrl](#opt-services.mjolnir.homeserverUrl) and Mjolnir itself

Title: Mjolnir: Matrix Moderation Tool Setup
Summary
This chapter introduces Mjolnir, a self-hosted all-in-one moderation tool for Matrix servers and communities, designed to protect against malicious invites, spam, and other unwanted content. It offers features like bans, redactions, anti-spam, server ACLs, and room management. The setup process involves creating a dedicated management room and a new user for Mjolnir on your homeserver, ensuring the user is free from rate limiting and, if necessary, granted server admin privileges. It also recommends using Pantalaimon for encrypted management rooms and moderation of encrypted rooms, with an option to enable and autoconfigure it for Mjolnir.