Skip to main content

Matrix room gatekeeper bot for the unofficial Unimore space

Project description

Loki Bot

Gatekeeper bot for the Unimore Informatica unofficial Matrix space, successor to Thor Bot.

WebsiteOn PyPIChat

Functionality

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:

  1. a page describing the bot is opened, and it allows users to login with a pre-configured OpenID Connect Identity Provider;
  2. 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;
  3. 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.

Setting up a development environment

Dependencies

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>

Environment

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

Deploying in production

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lokiunimore-0.7.1.tar.gz (260.8 kB view hashes)

Uploaded Source

Built Distribution

lokiunimore-0.7.1-py3-none-any.whl (269.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page