Skip to main content

Synapse Matrix Registration System

This is a user registration system for a Matrix server using Django and the Synapse Admin API. It handles user sign-ups, admin approvals, and account management.

Features

  • User Registration Workflow: A step-by-step registration process, including username checking, email verification, and submission of a reason for registration.
  • Admin Approval: Registrations require admin approval before activation.
  • User Notifications: Email notifications are sent throughout the registration process to ensure users and admins remain informed.
  • Admin Portal: Admins can manage registrations directly from the Django admin interface, approving or denying requests.

Installation

  1. Clone the Repository:
git clone https://git.private.coffee/PrivateCoffee/synapse-registration.git
cd synapse-registration
python3 -m venv venv
source venv/bin/activate
pip install .
  1. Create configuration file:
cp config.dist.yaml config.yaml
  1. Edit configuration file:

Edit the config.yaml file to match your Matrix server and email settings.

The following settings are available:

  • debug: Set to true to enable Django debug mode. Do not enable in production.
  • secret_key: Django secret key. If not set, a random key will be generated on startup.
  • synapse: Synapse server settings.
    • admin_token: Access token of an admin user.
    • server: Synapse server URL (e.g. https://matrix.example.com).
    • domain: Matrix server domain (e.g. example.com).
    • verify_cert: If your Synapse server uses a self-signed certificate, set this to false, or provide the path to your CA bundle.
  • hosts: List of domains that the registration system will be accessible at. At least one domain is required.
  • email: Email server settings.
    • host: SMTP server hostname. Required.
    • port: SMTP server port. Required.
    • username: SMTP username. Required.
    • password: SMTP password. Required.
    • tls: Set to true to enable STARTTLS.
    • ssl: Set to true to enable SSL.
    • from: Email address to send notifications from. Defaults to the username setting.
  • admin: Admin user settings.
    • email: Email address to send admin notifications to. Required.
  • trust_proxy: Set to true if the registration system is behind a reverse proxy. This ensures the correct IP address is logged.
  • auto_join: Optional list of rooms to automatically join users to after registration. The admin user must be in these rooms and have invite permissions.
  • legal: Optional list of legal documents to link to in the registration form. Each item must have a title and url.
  • retention: Optional retention periods for registrations.
    • started: Days to keep unverified registrations. Default is 2 days.
    • completed: Days to keep completed/denied registrations. Default is 30 days.
  • database: Optional database settings.
    • path: Path to the SQLite database file. Defaults to db.sqlite3 in the current directory.
  1. Run migrations:
synapse_registration migrate
  1. Create superuser:
synapse_registration createsuperuser
  1. Run the server:

For development:

synapse_registration runserver

For production, use a WSGI server such as uWSGI, behind a reverse proxy such as Caddy.

Usage

  1. Access the registration system:

Navigate to the domain you set in the config.yaml file. You should see the registration form.

  1. Register a new user:

The registration process is as follows:

  • Step 1: Enter a username. The system will check if the username is available.
  • Step 2: Enter an email address. A verification email will be sent.
  • Step 3: Enter a password and reason for registration. The password will be stored in Synapse, the reason will be stored in the admin interface.
  • Step 4: Wait for an admin to approve the registration. You will receive an email when this happens.
  1. Approve a registration:
  • Step 1: Log in to the Django admin interface.
  • Step 2: Navigate to the User registrations section.
  • Step 3: Review the registration request and set the status to Approved or Denied. This will enable the Matrix account and send an email to the user.
  1. Clean up registrations:

Note: This is no longer necessary. Old registrations are automatically cleaned up.

You can use the synapse_registration cleanup command to remove old registration requests.

  • Unverified registrations are removed after 48 hours.
  • Denied and approved registrations are removed after 30 days.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for synapse-registration 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for synapse-registration 0.1.5
File Size Uploaded Provenance Actions
synapse_registration-0.1.5.tar.gz 39.7 kB Without provenance Details for synapse_registration-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for synapse-registration 0.1.5
File Interpreter ABI Platform Actions
synapse_registration-0.1.5-py3-none-any.whl Python 3 none any Details for synapse_registration-0.1.5-py3-none-any.whl

Total release size: 108.6 kB

Release files / synapse_registration-0.1.5.tar.gz

Download URL synapse_registration-0.1.5.tar.gz
Size 39.7 kB
Tags Source
SHA-256 checksum
How to use checksums
35ecd591f35988379eaaafbe1737c1649a4dd44b417f32c29c6d218950a0cf4d
BLAKE2b-256 checksum
How to use checksums
60cab109f5b528fd213895934a4576b9f460c86bc4f8fe618355eb71a3abec70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.2

Release files / synapse_registration-0.1.5-py3-none-any.whl

Download URL synapse_registration-0.1.5-py3-none-any.whl
Size 69.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef5bfd1aafff22cd6253878cf158c2b077974052686776789b533053f16e12c7
BLAKE2b-256 checksum
How to use checksums
abeffc9805a61e06a9e4b769348af5eb26b67fda5f4c40d8f878e53d10b7c8e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.2

Security for synapse-registration 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page