How to block domains with Pleroma

And why is this so hard to find such a simple information ?

As the administrator of Bdx.town, it’s my responsibility to protect our users from being in contact with undesirable people (such as straight up nazis).

If being able to block them one by one is a great feature, blocking whole domains is way more efficient (since they tend to gather into real shit holes). If the Mastodon admin interface allows that in a really clear way, it’s absolutely not the case of Pleroma. For months, I resolved their domains and blocked their IPs via our firewall. That approach does the job for a short period of time, however, their server just has to change its IP to be able to contact us again (and it can happen, even without them willing to do so).

After some reading, I am finally able to block whole domains by their name thanks to what Pleroma call MRF for Message Rewrite Facility (Yeah, with that name, not easy to link that to any “Domain block Pleroma” search).

MRF allows to add certain behaviors to incoming/outgoing activities. There is a bunch of them, but the one who get our interest here is the SimplePolicy (again, a very clear name). That policy allows to reject some activities or to modify their content following their origin instance.

So yup, the Simple MRF Policy allows to block domains from federating with you.

To activate it (and if you enabled the “database configuration” mode of Pleroma), you can go on the Pleroma Admin FE, click on Settings/MRF on the left panel.

MRF

Then add “SimplePolicy” in the “Policies” field and click “Submit”.

MRF2

And now you can block the unwanted domains by filling the “Reject” field ! (Aaaand clicking on “Submit”)

MRF3

Source: https://docs.pleroma.social/backend/configuration/cheatsheet/#mrf_simple