"A module to prevent invites to Matrix rooms based on the invitee's domain."
Project description
Synapse Domain Rule Checker
A module to prevent invites and joins to Matrix rooms by checking the involved server(s)' domain.
Installation
From the virtual environment that you use for Synapse, install this module with:
pip install synapse-domain-rule-checker
(If you run into issues, you may need to upgrade pip
first, e.g. by running
pip install --upgrade pip
)
Then alter your homeserver configuration, adding to your modules
configuration:
modules:
- module: synapse_domain_rule_checker.DomainRuleChecker
config:
# A mapping describing which servers a server can invite into a room.
# Default is any server can invite any other server.
domain_mapping:
"inviter_domain": [ "invitee_domain_permitted", "other_domain_permitted" ]
"other_inviter_domain": [ "invitee_domain_permitted" ]
# Whether an invite should be allowed through if the inviting server doesn't appear
# in the domain_mapping.
# Required.
can_invite_if_not_in_domain_mapping: false
# Whether a user on this server needs to be invited to be allowed into a room,
# regardless of the room's settings.
# Defaults to false.
can_only_join_rooms_with_invite: false
# Whether a user on this server can only invite when creating a room.
# Default is false.
can_only_invite_during_room_creation: false
# List of servers that can't be invited to rooms that have been published to the
# public room directory. This setting only really works in a closed federation in
# which every server agrees on the list.
# Defaults to all servers being allowed.
domains_prevented_from_being_invited_to_published_rooms: []
# Whether a local user can invite another user using a third-party identifier (e.g.
# an email address).
# Defaults to true.
can_invite_by_third_party_id: true
Note that you need to consider invites between two local users when defining values for
domain_mapping
and domains_prevented_from_being_invited_to_published_rooms
.
Development
In a virtual environment with pip ≥ 21.1, run
pip install -e .[dev]
To run the unit tests, you can either use:
tox -e py
or
trial tests
To run the linters and mypy
type checker, use ./scripts-dev/lint.sh
.
Releasing
The exact steps for releasing will vary; but this is an approach taken by the Synapse developers (assuming a Unix-like shell):
-
Set a shell variable to the version you are releasing (this just makes subsequent steps easier):
version=X.Y.Z
-
Update
setup.cfg
so that theversion
is correct. -
Stage the changed files and commit.
git add -u git commit -m v$version -n
-
Push your changes.
git push
-
When ready, create a signed tag for the release:
git tag -s v$version
Base the tag message on the changelog.
-
Push the tag.
git push origin tag v$version
-
Create a source distribution and upload it to PyPI:
python -m build twine upload dist/synapse_domain_rule_checker-$version*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file synapse_domain_rule_checker-1.0.0.tar.gz
.
File metadata
- Download URL: synapse_domain_rule_checker-1.0.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.8.1 pkginfo/1.7.0 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 553b392c01ca1cc168e8ad0f79c6d58933f533f833edf4e18f2656e52c03f8ed |
|
MD5 | 37e94c9434d6921282ccccdf5e008921 |
|
BLAKE2b-256 | a06d7ac41e68d6cca97ca9f0b55ed631aef2d60cab2a22378f3dfcdab71902ca |
File details
Details for the file synapse_domain_rule_checker-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: synapse_domain_rule_checker-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.8.1 pkginfo/1.7.0 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cb8b2bf8a82c5fc193b7d0866c5889e956f2da74bdf468e233621b01463cef2 |
|
MD5 | ac8eebcdc85a63227ccbc27b65280d3e |
|
BLAKE2b-256 | eba2805dbbe10d4e29046d92f944c16240d4e0d241c3fb30d78b71d14bdb35fb |