Go to file
Jona Abdinghoff db7aab3dbf
Update docker.nix
2023-01-11 17:53:50 +01:00
.github Update docker.yml 2023-01-11 17:51:43 +01:00
alembic clean up config processing 2023-01-11 16:52:17 +01:00
matrix_registration update tests 2023-01-11 16:21:40 +00:00
resources fix docker setup 2023-01-11 16:54:39 +01:00
tests update tests 2023-01-11 16:21:40 +00:00
.coveragerc v0.9.0 (#62) 2021-04-09 19:37:49 +02:00
.gitignore build everything with nix (#52) 2020-12-30 01:11:48 +01:00
.travis.yml v0.9.0 (#62) 2021-04-09 19:37:49 +02:00
CODE_OF_CONDUCT.md Update CODE_OF_CONDUCT.md 2019-04-16 02:28:46 +02:00
CONTRIBUTING.md add weblate to README and CONTRIBUTING 2020-12-16 14:29:42 +01:00
LICENSE Create LICENSE 2018-05-14 02:13:11 +02:00
README.md fix: Support IP logging behind a reverse proxy (#85) 2021-12-28 05:12:05 +01:00
SECURITY.md Create SECURITY.md (#69) 2021-07-18 01:58:36 +02:00
alembic.ini v0.9.0 (#62) 2021-04-09 19:37:49 +02:00
config.sample.yaml clean up config processing 2023-01-11 16:52:17 +01:00
default.nix update tests 2023-01-11 16:21:40 +00:00
docker.nix Update docker.nix 2023-01-11 17:53:50 +01:00
setup.py update tests 2023-01-11 16:21:40 +00:00
shell.nix update tests 2023-01-11 16:21:40 +00:00
tox.ini v0.9.0 (#62) 2021-04-09 19:37:49 +02:00

README.md

Build Status Coverage Status Translation status PyPI - Python Version PyPI Docker Pulls Matrix

matrix-registration

A simple Python application enabling token-based registration for matrix servers.

You may have, like me, encountered the situation where you want to invite your friends to create an account on your homeserver, but neither want to open up public registration nor create accounts for every individual user yourself. This project aims to solve this problem.

With matrix-registration, you can quickly generate tokens on the fly and share them with your friends to allow them to register on your homeserver.

Setup

Install using pip:

pip3 install matrix-registration

or check the docker guide

First start

To start, execute matrix-registration.

A configuration file should be generated for you on first start.

Note: For server_location it is recommended to use a local connect, e.g. localhost:8008 (or whatever port synapse listens to). It is possible however to connect over the internet, but you will need to make sure /_synapse/admin/v1/register is accessible.

If the configuration file is not automatically discovered...

you can create a configuration by copying config.sample.yaml to your server and editing it:

wget https://raw.githubusercontent.com/ZerataX/matrix-registration/master/config.sample.yaml
cp config.sample.yaml config.yaml
nano config.yaml

Then pass the path to this configuration to the application on startup using --config-path /path/to/config.yaml.

INFO:

  • This only asks you for the most important options. You should definitely take a look at the actual configuration file. The path to the file will be printed by matrix-registration the first time it runs.

Usage

$ matrix-registration -h
Usage: matrix-registration [OPTIONS] COMMAND [ARGS]...

  a token based matrix registration app

Options:
  --config-path TEXT  specifies the config file to be used
  --version           Show the flask version
  -h, --help          Show this message and exit.

Commands:
  generate  generate new token
  serve     start api server
  status    view status or disable

After you've started the API server and generated a token you can register an account either:

  • with a simple post request, e.g.:
curl -X POST \
     -F 'username=test' \
     -F 'password=verysecure' \
     -F 'confirm=verysecure' \
     -F 'token=DoubleWizardSki' \
     http://localhost:5000/register

Further Resources

Nginx reverse-proxy

If you'd like to run matrix-registration behind a reverse-proxy, here is an example nginx setup:

location  ~ ^/(static|register) {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://localhost:5000;
}

If you'll be using the web API, you'll also need to forward that endpoint. More information on reverse proxying here

Custom registration page

If you want to write your own registration page, you can take a look at the sample in resources/example.html

The html page looks for the query paramater token and sets the token input field to it's value. this would allow you to directly share links with the token included, e.g.:

https://homeserver.tld/register.html?token=DoubleWizardSki

If you already have a website and want to use your own register page, the wiki describes a more advanced nginx setup.

bot

if you're looking for a bot to interface with matrix-registration and manage your tokens, take a look at:

maubot-invite

Similar projects

For more info check the wiki

Artwork attribution