Gatekeeper bot for the Unimore Informatica unofficial Matrix space, successor to Thor Bot.
This bot monitors a pre-configured public Matrix space for join events, sending a welcome message to every new joiner.
The welcome message contains a link, which when clicked starts the user verification process:
- a page describing the bot is opened, and it allows users to login with a pre-configured OpenID Connect Identity Provider;
- the claims of the OIDC IdP are verified, and the user's email address is checked to verify that its domain matches a pre-configured RegEx with specific email requirements;
- if the email address fullfils all the requirements, an invitation to a different, pre-configured private Matrix space is sent to the user.
Additionally, the bot monitors for leave events from both spaces, deleting user data if no longer needed to protect the user's privacy.
This project uses Poetry to manage the dependencies.
To install all dependencies in a venv, run:
$ poetry install
TIP: For easier venv management, you may want to set:
$ poetry config virtualenvs.in-project true
To activate the venv, run:
$ poetry shell
To run something in the venv without activating it, run:
$ poetry run <COMMAND>
Loki requires a lot of environment variables to be set, therefore it makes use of cfig to simplify the setup.
To view the current configuration, followed by a description of each variable, run:
$ poetry run python -m lokiunimore.config
Use the pre-built Docker image, or build it from the provided Dockerfile.
Run the image without any command to view and validate the current configuration.
Run the image with the gunicorn -b 0.0.0.0:80 lokiunimore.web.app:rp_app
command to launch the production web server on local port 80, expecting to be behind a reverse proxy.
Run the image with the lokiunimore.matrix
command to launch the Matrix bot.