No description
Find a file
2024-09-15 00:19:00 +02:00
synapse_invite_checker cache policy lists and increase general cache time 2024-09-15 00:19:00 +02:00
.gitignore initial 2024-09-14 19:12:42 +02:00
pyproject.toml support blocking rooms to be invited to 2024-09-14 21:44:46 +02:00
README.md support policy rooms 2024-09-14 23:16:32 +02:00

Synapse Invite Checker Module

This is a Synapse module that checks incoming invites based on allowlist and blocklist rules. The module allows or blocks invites from certain homeservers depending on whether they appear in a dynamically fetched allowlist or blocklist JSON file.

Features

  • Allowlist and Blocklist: Allows invites from homeservers in the allowlist, blocks invites from homeservers in the blocklist.
  • Dynamic Fetching: The allowlist and blocklist are fetched dynamically from a provided URL, and cached.
  • Support for MSC2313 Policy Rooms: This module now supports fetching blocklists from MSC2313 policy rooms to block invites

Configuration

Add this module to your Synapse's homeserver.yaml under the modules section. Heres an example configuration:

modules:
  - module: synapse_invite_checker.InviteChecker
    config:
      # URL to fetch the JSON file containing the allowlist and blocklist
      blocklist_allowlist_url: "https://example.com/invite-checker-lists.json"
      # Optionally specify policy rooms for dynamic blocklist fetching via MSC2313
      policy_rooms:
        - "!policy-room-1:matrix.org"
        - "!policy-room-2:matrix.org"
      # Whether to use the allowlist to allow certain homeservers (default: true)
      use_allowlist: true
      # Whether to use the blocklist to block certain homeservers (default: true)
      use_blocklist: true
      blocklist_rooms:
        - "#test:matrix.org"
        - "!dkgsemSiSMrGfxEwCb:ubuntu.com"

Example for the contents of the URL with the JSON data:

```json
{
  "use_allowlist": true,
  "use_blocklist": true,
  "allowlist": [
    "trusted-homeserver.com",
    "another-trusted-server.org"
  ],
  "blocklist": [
    "malicious-homeserver.com",
    "blocked-server.org"
  ],
  "blocklist_rooms": [
    "#test:matrix.org",  // Room alias to be resolved to room_id
    "#private-room:example.org",  // Another room alias
    "!abc123:matrix.org"  // Direct room ID
  ]
}