2020-09-01 10:46:05 +00:00
# Setting up matrix-registration (optional)
The playbook can install and configure [matrix-registration ](https://github.com/ZerataX/matrix-registration ) for you.
2022-06-01 06:36:48 +00:00
**WARNING**: this is a poorly maintained and buggy project. It's better to avoid using it.
2022-12-12 14:18:05 +00:00
**WARNING**: this is not related to [matrix-registration-bot ](configuring-playbook-bot-matrix-registration-bot.md )
2020-09-01 10:46:05 +00:00
> matrix-registration is a simple python application to have a token based matrix registration.
Use matrix-registration to **create unique registration links** , which people can use to register on your Matrix server. It allows you to **keep your server's registration closed (private)** , but still allow certain people (these having a special link) to register a user account.
**matrix-registration** provides 2 things:
- **an API for creating registration tokens** (unique registration links). This API can be used via `curl` or via the playbook (see [Usage ](#usage ) below)
2021-01-12 20:43:28 +00:00
- **a user registration page**, where people can use these registration tokens. By default, exposed at `https://matrix.DOMAIN/matrix-registration`
2020-09-01 10:46:05 +00:00
2024-10-12 18:03:46 +00:00
## Adjusting the playbook configuration
2020-09-01 10:46:05 +00:00
2024-10-12 18:03:46 +00:00
Add the following configuration to your `inventory/host_vars/matrix.DOMAIN/vars.yml` file:
2020-09-01 10:46:05 +00:00
```yaml
matrix_registration_enabled: true
2024-10-11 12:18:03 +00:00
# Generate a strong secret here. Consider generating it with `pwgen -s 64 1`
2020-09-01 10:46:05 +00:00
matrix_registration_admin_secret: "ENTER_SOME_SECRET_HERE"
```
2024-10-12 18:03:46 +00:00
## Installing
After configuring the playbook, run the [installation ](installing.md ) command:
2020-09-01 10:46:05 +00:00
```
ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start
```
## Usage
2021-01-12 20:44:55 +00:00
**matrix-registration** gets exposed at `https://matrix.DOMAIN/matrix-registration`
2020-09-01 10:46:05 +00:00
It provides various [APIs ](https://github.com/ZerataX/matrix-registration/wiki/api ) - for creating registration tokens, listing tokens, disabling tokens, etc. To make use of all of its capabilities, consider using `curl` .
2021-01-10 08:33:36 +00:00
We make the most common APIs easy to use via the playbook (see below).
2020-09-01 10:46:05 +00:00
2021-01-10 08:33:36 +00:00
### Creating registration tokens
To **create a new user registration token (link)** , use this command:
```bash
2020-09-01 10:46:05 +00:00
ansible-playbook -i inventory/hosts setup.yml \
--tags=generate-matrix-registration-token \
--extra-vars="one_time=yes ex_date=2021-12-31"
```
The above command creates and returns a **one-time use** token, which **expires** on the 31st of December 2021.
Adjust the `one_time` and `ex_date` variables as you see fit.
Share the unique registration link (generated by the command above) with users to let them register on your Matrix server.
2021-01-10 08:33:36 +00:00
### Listing registration tokens
To **list the existing user registration tokens** , use this command:
```bash
ansible-playbook -i inventory/hosts setup.yml \
--tags=list-matrix-registration-tokens
```