Synapse module to handle TIM contact management and invite permissions
Project description
Synapse Invite Checker
Synapse Invite Checker is a synapse module to restrict invites on a homeserver according to the rules required by Gematik in a TIM federation.
Table of Contents
Installation
pip install synapse-invite-checker
Configuration
Here are the available configuration options:
# the outer modules section is just provided for completeness, the config block is the actual module config.
modules:
- module: "synapse_invite_checker.InviteChecker"
config:
title: "TIM Contact API by Famedly", # Title for the info endpoint, optional
description: "Custom description for the endpoint", # Description for the info endpoint, optional
contact: "random@example.com", # Contact information for the info endpoint, optional
federation_list_url: "https://localhost:8080", # Full url where to fetch the federation list from, required
federation_list_client_cert: "tests/certs/client.pem", # path to a pem encoded client certificate for mtls, required if federation list url is https and federation_list_require_mtls is true
federation_list_require_mtls: true or false, # Whether to require mTLS for HTTPS federation list URLs. Defaults to true for backwards compatibility
gematik_ca_baseurl: "https://download-ref.tsl.ti-dienste.de/", # the baseurl to the ca to use for the federation list, required
tim-type: "epa" or "pro", # Patient/Insurance or Professional mode, defaults to "pro" mode. Optional currently, but will be required in a later release
default_permissions: # see 'default_permissions' below. The server defaults for new users or existing users with no permissions already set. Other than the noted default for 'defaultSetting', no other defaults are established
defaultSetting: "allow all" or "block all" # Default "allow all"
serverExceptions:
"<server_name>": # The server names to include. Note the ':' on the end and that double quotes are needed around server names
"@LOCAL_SERVER@": # A special option to template the local server into without having to know its name. Note that the double quotes are required for this special case.
userExceptions:
"<mxid>": # Any users that should be an exception to the 'defaultSetting'.
"@user:some_server.com": # An example. Note the ':' on the end and that double quotes are needed around user names
groupException:
- groupName: "isInsuredPerson" # For the moment, the only option. Note the double quotes and the hyphen at the start of the line
allowed_room_versions: # The list(as strings) of allowed room versions. Currently optional, defaults are listed
- "9"
- "10"
room_scan_run_interval: see 'Duration Parsing' below, # How often to scan for rooms that are eligible for deletion. Defaults to "1h". Setting to "0" completely disables all room scanning
insured_only_room_scan:
enabled: true or false # optional switch to disable the insured-only room scan from running. The scan is enabled by default, but only runs in EPA mode, otherwise this option is ignored and the scan is disabled.
grace_period: see 'Duration Parsing' below, # Length of time a room with only EPA members is allowed to exist before deletion. Ignored if `enabled` is false. Defaults to "1w"
invites_grace_period: see 'Duration Parsing' below, # Optional, a separate grace period just for invites, after which an invite will be considered stale and ignored. Otherwise invited "Pro" users are considered joined and will prevent purging the room. Ignored if `enabled` is false. Defaults to "0", which will never consider an invite stale.
inactive_room_scan:
enabled: true or false # optional switch to disable the room scan for inactive rooms, defaults to true
grace_period: see 'Duration Parsing' below # Length of time a room is allowed to have no message activity before it is eligible for deletion. Ignored if 'enabled' is false. Defaults to "26w" which is 6 months
override_public_room_federation: true or false, # Forces the `m.federate` flag to be set to False when creating a public room to prevent it from federating. Default is "true", disable with "false"
prohibit_world_readable_rooms: true or false, # Prevent setting any rooms history visibility as 'world_readable'. Defaults to "true"
block_invites_into_dms: true or false, # Prevent invites into existing DM chats. Defaults to true
default_permissions
For establishing the default permissions for the users on this server. As the simplest example:
default_permissions:
defaultSetting: "allow all"
This is what the default will be if no setting is entered for this section.
an example to allow all communication except for insured users
default_permissions:
defaultSetting: "allow all"
groupException:
- groupName: "isInsuredPerson"
and an example of blocking all communication except for users on the local server
default_permissions:
defaultSetting: "block all"
serverExceptions:
"@LOCAL_SERVER@":
Duration Parsing
Settings labeled as 'duration_parsing' allow for a string representation of the value
that is converted to milliseconds. Suffixes with 's', 'm', 'h', 'd', 'w', or 'y' may be used. For example:
1h
would translate to 3600000
milliseconds
Testing
The tests uses twisted's testing framework trial, with the development environment managed by hatch. Running the tests and generating a coverage report can be done like this:
hatch run cov
License
synapse-invite-checker
is distributed under the terms of the
AGPL-3.0 license.
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_invite_checker-0.4.5.tar.gz
.
File metadata
- Download URL: synapse_invite_checker-0.4.5.tar.gz
- Upload date:
- Size: 133.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
bcadf3c0cd5f6bdd4e7894285a4079301aa737ec894f29fed6774b988d51abc6
|
|
MD5 |
7e8b801b3608d7b6fdc171aacbbba37b
|
|
BLAKE2b-256 |
73b2bff1db6e285db7d758bd2a9675f71ddcdbbe80cd3314e7fbfc3a3cd31476
|
Provenance
The following attestation bundles were made for synapse_invite_checker-0.4.5.tar.gz
:
Publisher:
publish.yml
on famedly/synapse-invite-checker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
synapse_invite_checker-0.4.5.tar.gz
-
Subject digest:
bcadf3c0cd5f6bdd4e7894285a4079301aa737ec894f29fed6774b988d51abc6
- Sigstore transparency entry: 220037316
- Sigstore integration time:
-
Permalink:
famedly/synapse-invite-checker@5608f40ffeaef1320edef8554cb432fa2c881fdd
-
Branch / Tag:
refs/tags/v0.4.5
- Owner: https://github.com/famedly
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
publish.yml@5608f40ffeaef1320edef8554cb432fa2c881fdd
-
Trigger Event:
release
-
Statement type:
File details
Details for the file synapse_invite_checker-0.4.5-py3-none-any.whl
.
File metadata
- Download URL: synapse_invite_checker-0.4.5-py3-none-any.whl
- Upload date:
- Size: 39.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
99ebf11e070890938839060e7dbab99f1a20656fde9664c31d19eca7697fd391
|
|
MD5 |
43c12846c3fabc630e2bb30fcb3014bf
|
|
BLAKE2b-256 |
14ebef541b79d1ed96bd8098bf9990d4c6c28d8f466c6757ea3aa2c7ac0eba0a
|
Provenance
The following attestation bundles were made for synapse_invite_checker-0.4.5-py3-none-any.whl
:
Publisher:
publish.yml
on famedly/synapse-invite-checker
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
synapse_invite_checker-0.4.5-py3-none-any.whl
-
Subject digest:
99ebf11e070890938839060e7dbab99f1a20656fde9664c31d19eca7697fd391
- Sigstore transparency entry: 220037317
- Sigstore integration time:
-
Permalink:
famedly/synapse-invite-checker@5608f40ffeaef1320edef8554cb432fa2c881fdd
-
Branch / Tag:
refs/tags/v0.4.5
- Owner: https://github.com/famedly
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
publish.yml@5608f40ffeaef1320edef8554cb432fa2c881fdd
-
Trigger Event:
release
-
Statement type: