lokiunimore


Namelokiunimore JSON
Version 0.7.1 PyPI version JSON
download
home_pagehttps://loki.steffo.eu/
SummaryMatrix room gatekeeper bot for the unofficial Unimore space
upload_time2023-05-20 17:41:19
maintainerStefano Pigozzi
docs_urlNone
authorStefano Pigozzi
requires_python>=3.10,<4.0
licenseAGPL-3.0-or-later
keywords bot matrix authentication unimore oauth2
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Loki Bot

Gatekeeper bot for the Unimore Informatica unofficial Matrix space, successor to [Thor Bot](https://github.com/Steffo99/thorunimore).

[![Website](https://img.shields.io/website?url=https%3A%2F%2Floki.steffo.eu%2F)](https://loki.steffo.eu/)
 
[![On PyPI](https://img.shields.io/pypi/v/lokiunimore)](https://pypi.org/project/lokiunimore/)
 
[![Chat](https://img.shields.io/matrix/loki-bot:ryg.one?server_fqdn=matrix.ryg.one)](https://matrix.to/#/#loki-bot:ryg.one)

![](lokiunimore/web/static/opengraph.png)

## Functionality

This bot monitors a [pre-configured *public* Matrix space][config-public-space] for join events, sending a [welcome message][welcome-msg] to every new joiner.

The [welcome message][welcome-msg] 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][config-oidc-idp];
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][config-email-regex]
 with specific email requirements;
3. if the email address fullfils all the requirements, an invitation to a different, [pre-configured *private* Matrix space][config-private-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.

[welcome-msg]: https://github.com/Steffo99/lokiunimore/blob/99f7101abc3f68472844cd2f1bac5119e41c1682/lokiunimore/matrix/templates/messages.py#L3-L23
[config-public-space]: https://github.com/Steffo99/lokiunimore/blob/main/lokiunimore/config/config.py#L50-L60
[config-oidc-idp]: https://github.com/Steffo99/lokiunimore/blob/main/lokiunimore/config/config.py#L147-L202
[config-email-regex]: https://github.com/Steffo99/lokiunimore/blob/main/lokiunimore/config/config.py#L194-L202
[config-private-space]: https://github.com/Steffo99/lokiunimore/blob/99f7101abc3f68472844cd2f1bac5119e41c1682/lokiunimore/config/config.py#L76-L86

## Setting up a development environment

### Dependencies

This project uses [Poetry](https://python-poetry.org/) to manage the dependencies.

To install all dependencies in a venv, run:

```console
$ poetry install
```

> TIP: For easier venv management, you may want to set:
> 
> ```console
> $ poetry config virtualenvs.in-project true
> ```

To activate the venv, run:

```console
$ poetry shell
```

To run something in the venv without activating it, run:

```console
$ poetry run <COMMAND>
```

### Environment

Loki requires a lot of environment variables to be set, therefore it makes use of [cfig](https://cfig.readthedocs.io/en/latest/) to simplify the setup.

To view the current configuration, followed by a description of each variable, run:

```console
$ poetry run python -m lokiunimore.config
```

## Deploying in production

Use the [pre-built Docker image](https://github.com/Steffo99/lokiunimore/pkgs/container/lokiunimore), or build it from the [provided Dockerfile](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.


            

Raw data

            {
    "_id": null,
    "home_page": "https://loki.steffo.eu/",
    "name": "lokiunimore",
    "maintainer": "Stefano Pigozzi",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "me@steffo.eu",
    "keywords": "bot,matrix,authentication,unimore,oauth2",
    "author": "Stefano Pigozzi",
    "author_email": "me@steffo.eu",
    "download_url": "https://files.pythonhosted.org/packages/f3/82/32d3c30ac67243e04fe85cfc20feb6cb3933308d4f0b17375732609d31aa/lokiunimore-0.7.1.tar.gz",
    "platform": null,
    "description": "# Loki Bot\n\nGatekeeper bot for the Unimore Informatica unofficial Matrix space, successor to [Thor Bot](https://github.com/Steffo99/thorunimore).\n\n[![Website](https://img.shields.io/website?url=https%3A%2F%2Floki.steffo.eu%2F)](https://loki.steffo.eu/)\n\u2002\n[![On PyPI](https://img.shields.io/pypi/v/lokiunimore)](https://pypi.org/project/lokiunimore/)\n\u2002\n[![Chat](https://img.shields.io/matrix/loki-bot:ryg.one?server_fqdn=matrix.ryg.one)](https://matrix.to/#/#loki-bot:ryg.one)\n\n![](lokiunimore/web/static/opengraph.png)\n\n## Functionality\n\nThis bot monitors a [pre-configured *public* Matrix space][config-public-space] for join events, sending a [welcome message][welcome-msg] to every new joiner.\n\nThe [welcome message][welcome-msg] contains a link, which when clicked starts the user verification process:\n\n1. a page describing the bot is opened, and it allows users to login with a [pre-configured OpenID Connect Identity Provider][config-oidc-idp];\n2. 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][config-email-regex]\n with specific email requirements;\n3. if the email address fullfils all the requirements, an invitation to a different, [pre-configured *private* Matrix space][config-private-space] is sent to the user.\n\nAdditionally, the bot monitors for leave events from both spaces, deleting user data if no longer needed to protect the user's privacy.\n\n[welcome-msg]: https://github.com/Steffo99/lokiunimore/blob/99f7101abc3f68472844cd2f1bac5119e41c1682/lokiunimore/matrix/templates/messages.py#L3-L23\n[config-public-space]: https://github.com/Steffo99/lokiunimore/blob/main/lokiunimore/config/config.py#L50-L60\n[config-oidc-idp]: https://github.com/Steffo99/lokiunimore/blob/main/lokiunimore/config/config.py#L147-L202\n[config-email-regex]: https://github.com/Steffo99/lokiunimore/blob/main/lokiunimore/config/config.py#L194-L202\n[config-private-space]: https://github.com/Steffo99/lokiunimore/blob/99f7101abc3f68472844cd2f1bac5119e41c1682/lokiunimore/config/config.py#L76-L86\n\n## Setting up a development environment\n\n### Dependencies\n\nThis project uses [Poetry](https://python-poetry.org/) to manage the dependencies.\n\nTo install all dependencies in a venv, run:\n\n```console\n$ poetry install\n```\n\n> TIP: For easier venv management, you may want to set:\n> \n> ```console\n> $ poetry config virtualenvs.in-project true\n> ```\n\nTo activate the venv, run:\n\n```console\n$ poetry shell\n```\n\nTo run something in the venv without activating it, run:\n\n```console\n$ poetry run <COMMAND>\n```\n\n### Environment\n\nLoki requires a lot of environment variables to be set, therefore it makes use of [cfig](https://cfig.readthedocs.io/en/latest/) to simplify the setup.\n\nTo view the current configuration, followed by a description of each variable, run:\n\n```console\n$ poetry run python -m lokiunimore.config\n```\n\n## Deploying in production\n\nUse the [pre-built Docker image](https://github.com/Steffo99/lokiunimore/pkgs/container/lokiunimore), or build it from the [provided Dockerfile](Dockerfile).\n\nRun the image without any command to view and validate the current configuration.\n\nRun 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.\n\nRun the image with the `lokiunimore.matrix` command to launch the Matrix bot.\n\n",
    "bugtrack_url": null,
    "license": "AGPL-3.0-or-later",
    "summary": "Matrix room gatekeeper bot for the unofficial Unimore space",
    "version": "0.7.1",
    "project_urls": {
        "Homepage": "https://loki.steffo.eu/",
        "Repository": "https://github.com/Steffo99/lokiunimore"
    },
    "split_keywords": [
        "bot",
        "matrix",
        "authentication",
        "unimore",
        "oauth2"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2a25b90f05a79335a3860c83dd8f1c8f5bd71629f513942dc772359daf165a39",
                "md5": "ef960248e3bcda0333be3b75da94c9cf",
                "sha256": "3c130683ae61ba4cb4a0f0a79db9b035d312a80d725c8642228ba6af3f1ea0bd"
            },
            "downloads": -1,
            "filename": "lokiunimore-0.7.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ef960248e3bcda0333be3b75da94c9cf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 269037,
            "upload_time": "2023-05-20T17:41:17",
            "upload_time_iso_8601": "2023-05-20T17:41:17.343629Z",
            "url": "https://files.pythonhosted.org/packages/2a/25/b90f05a79335a3860c83dd8f1c8f5bd71629f513942dc772359daf165a39/lokiunimore-0.7.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f38232d3c30ac67243e04fe85cfc20feb6cb3933308d4f0b17375732609d31aa",
                "md5": "8c4aa5fb23466789e28109edac6046e9",
                "sha256": "443c9cf34d59b3d81cb3fa17b4a03b9da6626f4a1625a368e097336e892f7c68"
            },
            "downloads": -1,
            "filename": "lokiunimore-0.7.1.tar.gz",
            "has_sig": false,
            "md5_digest": "8c4aa5fb23466789e28109edac6046e9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 260772,
            "upload_time": "2023-05-20T17:41:19",
            "upload_time_iso_8601": "2023-05-20T17:41:19.280784Z",
            "url": "https://files.pythonhosted.org/packages/f3/82/32d3c30ac67243e04fe85cfc20feb6cb3933308d4f0b17375732609d31aa/lokiunimore-0.7.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-20 17:41:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Steffo99",
    "github_project": "lokiunimore",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "lokiunimore"
}
        
Elapsed time: 0.18751s