Skip to content

An API which allows Matrix user directory searches to be recursively federated for corporate use.

License

Notifications You must be signed in to change notification settings

cameronwickes/ma1sd-extender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

matrix logo
MA1SD-Extender

Supported Platforms Language License

An API, built with Docker and FastAPI, that allows Matrix user directory searches to be recursively federated for corporate use.


MA1SD-Extender performs the following sequence of actions in order to recursively federate directory lookups:

  • Checks the validity of API supplied credentials
  • Checks the validity of a user specified authorisation token against all federation domains
  • Returns previously cached responses for faster lookups
  • Searches within local directory for users
  • Recursively searches other federation domains for users
  • Returns pooled responses masquerading as the local MA1SD server

MA1SD-Extender is available from this repository, and can also be found on the Docker Hub.

⚙️ Configuration Variables

The following environment variables are required by MA1SD-Extender:

  • MA1SD_EXTENDER_USERNAME: The username for MA1SD-Extender access.
  • MA1SD_EXTENDER_PASSWORD: The password for MA1SD-Extender access.
  • MA1SD_EXTENDER_MATRIX_DOMAIN: The domain that Synapse and MA1SD are running on.
  • MA1SD_EXTENDER_FEDERATED_DOMAINS: Any domains to be recursively federated.

MA1SD-Extender needs a valid account on the local Synapse homeserver and both MA1SD and Synapse need to be running the host that the extender runs on.

🐍 Running With Python

MA1SD-Extender can be run with Python, Poetry and FastAP with the following commands

export MA1SD_EXTENDER_USERNAME="X" \
MA1SD_EXTENDER_PASSWORD="X" \
MA1SD_EXTENDER_MATRIX_DOMAIN="X" \
MA1SD_EXTENDER_FEDERATED_DOMAINS="['X']"
poetry install
uvicorn --reload --host='0.0.0.0' --port=8060 ma1sd-extender.main:app

📦 Running With Docker/Podman

MA1SD-Extender can also be run with Docker/Podman with the following commands:

docker pull cameronwickes/ma1sd-extender:latest
docker run --name ma1sd \
-e MA1SD_EXTENDER_USERNAME="X" \
-e MA1SD_EXTENDER_PASSWORD="X" \
-e MA1SD_EXTENDER_MATRIX_DOMAIN="X" \
-e MA1SD_EXTENDER_FEDERATED_DOMAINS="['X']" \
ma1sd-extender:latest

💻 NGINX Proxy Setup

Once MA1SD-Extender is running, an NGINX proxy can be configured to pass requests to and from the API. The following section should be placed within the NGINX configuration file.

location /_matrix/client/r0/user_directory {
    proxy_pass http://0.0.0.0:8060/_matrix/client/r0/user_directory;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $remote_addr;
}

⚖️ License

MA1SD-Extender is free and open-source software licensed under the Apache 2.0 License.