A collection of spam checker modules for Synapse.
Go to file
Joe 4f75421532
bump version
2023-04-25 11:27:48 -05:00
synapse_simple_antispam import Union type 2023-04-25 11:27:35 -05:00
LICENSE Create LICENSE 2022-07-14 11:24:36 -06:00
README.md update readme example config 2022-07-14 04:44:43 -05:00
setup.py bump version 2023-04-25 11:27:48 -05:00

README.md

synapse-simple-antispam

A collection of spam checker modules for Synapse.

Installation

In your Synapse python environment:

pip install git+https://github.com/t2bot/synapse-simple-antispam#egg=synapse-simple-antispam

Then add to your homeserver.yaml:

modules:
  # Module to block invites from listed homeservers
  - module: "synapse_simple_antispam.AntiSpamInvites"
    config:
      # A list of homeservers to block invites from.
      blocked_homeservers:
        - badcorp.example.org
        - evil.example.com
  # Module to block messages from listed homeservers
  - module: "synapse_simple_antispam.AntiSpamHomeserverMessages"
    config:
      # If true, the blocked messages will be soft failed by synapse.
      # Soft failing can help prevent messages from going down sync streams.
      soft_fail: false
      # A list of homeservers to block messages from.
      blocked_homeservers:
        - badcorp.example.org
        - evil.example.com
  # Module to block messages with the given text
  - module: "synapse_simple_antispam.AntiSpamText"
    config:
      # If true, the blocked messages will be soft failed by synapse.
      # Soft failing can help prevent messages from going down sync streams.
      soft_fail: false
      blocked_messages:
        - "This is spam. Spammy spam spam."
  # Module to block messages with the given text regexes
  - module: "synapse_simple_antispam.AntiSpamRegex"
    config:
      # If true, the blocked messages will be soft failed by synapse.
      # Soft failing can help prevent messages from going down sync streams.
      soft_fail: false
      blocked_messages:
        - "spam"  # "spam" anywhere in the message
        - "sp[am]+" # "spammmm", "spaaaammmmm", etc
  # Module to block registration for usernames with the given text regexes
  - module: "synapse_simple_antispam.AntiSpamRegistrationRegex"
    config:
      blocked_usernames:
        - "spambot" # identical regex handling to the AntiSpamRegex module
        - "naughtyword"

Synapse will need to be restarted to apply the changes. To modify the list of homeservers, update the config and restart Synapse.