synapse-invite-checker/README.md

50 lines
1.8 KiB
Markdown
Raw Normal View History

2024-09-14 17:17:15 +00:00
# Synapse Invite Checker Module
2024-09-14 18:17:43 +00:00
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.
2024-09-14 17:17:15 +00:00
## Features
2024-09-14 18:17:43 +00:00
- **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.
2024-09-14 17:17:15 +00:00
- **Fallback on Failure**: If the JSON file cannot be fetched (e.g., network error), the module automatically allows all invites to prevent disruptions.
## Configuration
Add this module to your Synapse's `homeserver.yaml` under the `modules` section. Heres an example configuration:
```yaml
modules:
- module: synapse_invite_checker.InviteChecker
2024-09-14 17:12:42 +00:00
config:
2024-09-14 18:17:43 +00:00
# URL to fetch the JSON file containing the allowlist and blocklist
blocklist_allowlist_url: "https://example.com/invite-checker-lists.json"
# 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
]
}
```