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.
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:
- 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.
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
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 lokiunimore-0.7.1.tar.gz
.
File metadata
- Download URL: lokiunimore-0.7.1.tar.gz
- Upload date:
- Size: 260.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 443c9cf34d59b3d81cb3fa17b4a03b9da6626f4a1625a368e097336e892f7c68 |
|
MD5 | 8c4aa5fb23466789e28109edac6046e9 |
|
BLAKE2b-256 | f38232d3c30ac67243e04fe85cfc20feb6cb3933308d4f0b17375732609d31aa |
File details
Details for the file lokiunimore-0.7.1-py3-none-any.whl
.
File metadata
- Download URL: lokiunimore-0.7.1-py3-none-any.whl
- Upload date:
- Size: 269.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c130683ae61ba4cb4a0f0a79db9b035d312a80d725c8642228ba6af3f1ea0bd |
|
MD5 | ef960248e3bcda0333be3b75da94c9cf |
|
BLAKE2b-256 | 2a25b90f05a79335a3860c83dd8f1c8f5bd71629f513942dc772359daf165a39 |