• Stars
    star
    259
  • Rank 157,669 (Top 4 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 10 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sydent: Reference Matrix Identity Server

What is Sydent?

Sydent is an identity server for the Matrix communications protocol. It allows Matrix users to prove that they own an email address or phone number, and allows _other_ Matrix users to look them up using that email address or phone number.

Do I need to run Sydent to run my own homeserver?

Short answer: no.

Medium answer: probably not. Most homeservers and clients use the Sydent instance run by matrix.org, or use no identity server whatsoever.

Longer answer: if you want to allow user lookup via emails and phone numbers in a private federation of multiple homeservers, Sydent _might_ be useful for you. If you want your homeserver to be able to verify phone numbers via SMS and you have an API token for the OpenMarket HTTP SMS API, then Sydent might be useful for you.

Installation

Installing the system dependencies

To install Sydent's dependencies on a Debian-based system, run:

sudo apt-get install build-essential python3-dev libffi-dev \
                     sqlite3 libssl-dev python-virtualenv libxslt1-dev

From here, you can either install Sydent by using a PyPI release, or by recreating Sydent's locked runtime environment.

Installing the latest Sydent release from PyPI

To create the virtual environment in which Sydent will run:

virtualenv -p python3 ~/.sydent
source ~/.sydent/bin/activate
pip install --upgrade pip
pip install --upgrade setuptools

Sydent and its dependencies can be installed using pip by running:

pip install matrix-sydent

With the virtualenv activated, you can run Sydent using:

python -m sydent.sydent

Installing from source

Alternatively, Sydent can be installed using poetry from a local git checkout. First install poetry. See poetry's documentation for details; we recommend installing via pipx. Once that's done:

git clone https://github.com/matrix-org/sydent.git
cd sydent
poetry install --no-dev
# For development, pull in extra tools with
# poetry install

To start Sydent:

poetry run sydent

Running Sydent

When Sydent is first run, it will create a configuration file in sydent.conf with some defaults. If a setting is defined in both the [DEFAULT] section and another section in the configuration file, then the value in the other section is used.

You'll most likely want to change the server name (server.name) and specify an email server (look for the settings starting with email.).

By default, Sydent will listen on 0.0.0.0:8090. This can be changed by changing the values for the configuration settings clientapi.http.bind_address and clientapi.http.port.

Sydent uses SQLite as its database backend. By default, it will create the database as sydent.db in its working directory. The name can be overridden by modifying the db.file configuration option. Sydent is known to be working with SQLite version 3.16.2 and later.

Listening for HTTPS connections

Most homeservers and clients will expect identity servers to be reachable using HTTPS.

Sydent does not currently support listening for HTTPS connection by itself. Instead, it is recommended to use a reverse proxy to proxy requests from homeservers and clients to Sydent. It is then possible to have this reverse proxy serve Sydent's API over HTTPS.

When using a reverse proxy, it is recommended to limit the requests proxied to Sydent to ones which paths start with /_matrix/identity for security reasons.

An exception to this is Sydent's internal replication API, see docs/replication.md.

SMS originators

Defaults for SMS originators will not be added to the generated config file, these should be added to the [sms] section of that config file in the form:

originators.<country code> = <long|short|alpha>:<originator>

Where country code is the numeric country code, or default to specify the originator used for countries not listed. For example, to use a selection of long codes for the US/Canada, a short code for the UK and an alphanumertic originator for everywhere else:

originators.1 = long:12125552368,long:12125552369
originators.44 = short:12345
originators.default = alpha:Matrix

Docker

A Dockerfile is provided for sydent. To use it, run docker build -t sydent . in a sydent checkout. To run it, use docker run --env=SYDENT_SERVER_NAME=my-sydent-server -p 8090:8090 sydent.

Persistent data

By default, all data is stored in /data. To persist this to disk, bind /data to a Docker volume.

docker volume create sydent-data
docker run ... --mount type=volume,source=sydent-data,destination=/data sydent

But you can also bind a local directory to the container. However, you then have to pay attention to the file permissions.

mkdir /path/to/sydent-data
chown 993:993 /path/to/sydent-data
docker run ... --mount type=bind,source=/path/to/sydent-data,destination=/data sydent

Environment variables

Warning

These variables are only taken into account at first start and are written to the configuration file.

Variable Name Sydent default Dockerfile default
SYDENT_SERVER_NAME empty empty
SYDENT_CONF sydent.conf /data/sydent.conf
SYDENT_PID_FILE sydent.pid /data/sydent.pid
SYDENT_DB_PATH sydent.db /data/sydent.db

Internal bind and unbind API

It is possible to enable an internal API which allows for binding and unbinding between identifiers and matrix IDs without any validation. This is open to abuse, so is disabled by default, and when it is enabled, is available only on a separate socket which is bound to localhost by default.

To enable it, configure the port in the config file. For example:

[http]
internalapi.http.port = 8091

To change the address to which that API is bound, set the internalapi.http.bind_address configuration setting in the [http] section, for example:

[http]
internalapi.http.port = 8091
internalapi.http.bind_address = 192.168.0.18

As already mentioned above, this is open to abuse, so make sure this address is not publicly accessible.

To use bind:

curl -XPOST 'http://localhost:8091/_matrix/identity/internal/bind' -H "Content-Type: application/json" -d '{"address": "[email protected]", "medium": "email", "mxid": "@matthew:matrix.org"}'

The response has the same format as /_matrix/identity/api/v1/3pid/bind.

To use unbind:

curl -XPOST 'http://localhost:8091/_matrix/identity/internal/unbind' -H "Content-Type: application/json" -d '{"address": "[email protected]", "medium": "email", "mxid": "@matthew:matrix.org"}'

The response has the same format as /_matrix/identity/api/v1/3pid/unbind.

Replication

It is possible to configure a mesh of Sydent instances which replicate identity bindings between each other. See docs/replication.md.

Discussion

Matrix room: #sydent:matrix.org.

More Repositories

1

synapse

Synapse: Matrix homeserver written in Python/Twisted.
Python
11,791
star
2

dendrite

Dendrite is a second-generation Matrix homeserver written in Go!
Go
4,696
star
3

matrix-js-sdk

Matrix Client-Server SDK for JavaScript
TypeScript
1,505
star
4

matrix-rust-sdk

Matrix Client-Server SDK for Rust
Rust
1,151
star
5

matrix-react-sdk

Matrix SDK for React Javascript
TypeScript
1,095
star
6

matrix-spec-proposals

Proposals for changes to the matrix specification
889
star
7

matrix-appservice-discord

A bridge between Matrix and Discord.
TypeScript
803
star
8

matrix.to

A simple stateless privacy-protecting URL redirecting service for Matrix
JavaScript
766
star
9

thirdroom

Open, decentralised, immersive worlds built on Matrix
C
599
star
10

matrix-appservice-irc

Node.js IRC bridge for Matrix
TypeScript
457
star
11

matrix-ios-sdk

The Matrix SDK for iOS
Objective-C
433
star
12

pinecone

Peer-to-peer overlay routing for the Matrix ecosystem
Go
428
star
13

matrix.org

matrix.org public website
JavaScript
413
star
14

matrix-android-sdk

The Matrix SDK for Android - DEPRECATED
Java
376
star
15

mjolnir

A moderation tool for Matrix
TypeScript
325
star
16

go-neb

Extensible matrix bot written in Go
Go
281
star
17

pantalaimon

E2EE aware proxy daemon for matrix clients.
Python
279
star
18

matrix-appservice-slack

A Matrix <--> Slack bridge
TypeScript
271
star
19

gomatrix

A Golang Matrix client
Go
269
star
20

matrix-python-sdk

Matrix Client-Server SDK for Python 2 and 3
Python
256
star
21

sliding-sync

Proxy implementation of MSC3575's sync protocol.
Go
250
star
22

purple-matrix

Libpurple protocol plugin for matrix
C
224
star
23

matrix-ircd

An IRCd implementation backed by Matrix.
Rust
224
star
24

matrix-android-sdk2

Matrix SDK for Android, extracted from the Element Android application
Kotlin
189
star
25

matrix-spec

The Matrix protocol specification
HTML
188
star
26

matrix-hookshot

A bridge between Matrix and multiple project management services, such as GitHub, GitLab and JIRA.
TypeScript
185
star
27

vodozemac

An implementation of Olm and Megolm in pure Rust.
Rust
171
star
28

matrix-bifrost

General purpose bridging with a variety of backends including libpurple and xmpp.js
TypeScript
162
star
29

rust-synapse-compress-state

A tool to compress some state in a Synapse instance's database
Rust
147
star
30

matrix-appservice-bridge

Bridging infrastructure for Application Services
TypeScript
141
star
31

matrix-ios-kit

Reusable UI interfaces to ease building of Matrix client apps
Objective-C
128
star
32

sygnal

Sygnal: reference Push Gateway for Matrix
Python
128
star
33

matrix-authentication-service

OAuth2.0 + OpenID Provider for Matrix Homeservers
Rust
111
star
34

matrix-synapse-ldap3

An LDAP3 auth provider for Synapse
Python
107
star
35

cerulean

An experimental Matrix client for playing with freestyle public threaded conversations
JavaScript
103
star
36

waterfall

A cascading stream forwarding unit for scalable, distributed voice and video conferencing over Matrix
Go
98
star
37

synapse-s3-storage-provider

Synapse storage provider to fetch and store media in Amazon S3
Python
92
star
38

matrix-rich-text-editor

Matrix Rich Text Editor
Rust
92
star
39

meshsim

Matrix mesh simulator
Python
90
star
40

matrix-static

A static golang generated preview of public world readable Matrix rooms.
Go
87
star
41

seshat

A Matrix message database/indexer
Rust
86
star
42

matrix-viewer

View the history of public and world readable Matrix rooms
JavaScript
74
star
43

matrix-appservice-node

Matrix Application Service framework in Node.js
TypeScript
71
star
44

sytest

Black-box integration testing for Matrix homeservers
Perl
66
star
45

matrix-federation-tester

Tester for matrix federation written in golang.
Go
61
star
46

complement

Matrix compliance test suite
Go
61
star
47

docker-jitsi

Docker files for building images and running jitsi-meet in Docker containers
Lua
58
star
48

matrix-widget-api

JavaScript/TypeScript API for widgets & web clients to communicate
TypeScript
57
star
49

gomatrixserverlib

Go library for matrix federation.
Go
56
star
50

olm

An implementation of the Double Ratchet cryptographic ratchet in C++/C
54
star
51

Matrix-NEB

N E Bot: Generic bot for Matrix with plugin support
Python
49
star
52

rust-opa-wasm

Open Policy Agent WebAssembly Rust SDK
Rust
46
star
53

naffka

Single in-process implementation of the sarama golang kafka APIs
Go
45
star
54

matrix-ios-console

The sample Matrix client for iOS
Objective-C
45
star
55

conference-bot

The conductor for your orchestra^Wconference
TypeScript
44
star
56

gsoc

JavaScript
43
star
57

matrix-appservice-gitter

Matrix <-> Gitter bridge
JavaScript
40
star
58

coap-proxy

HTTP<->CoAP proxy
Go
39
star
59

matrix-appservice-tg

Matrix<->Telegram user-puppeting portal
JavaScript
37
star
60

dendron

Dendron was an experimental Matrix homeserver, succeeded by Dendrite.
Go
35
star
61

matrix-vr-demo

Matrix.org Virtual Reality Demo
JavaScript
31
star
62

python-canonicaljson

Canonical JSON
Python
31
star
63

bullettime

An experimental golang Matrix homeserver
Go
31
star
64

matrix-angular-sdk

JavaScript
28
star
65

matrix-rust-components-swift

Swift package providing components from the matrix-rust-sdk
Swift
27
star
66

rageshake

Bug report server
Go
27
star
67

matrix-android-console

Java
26
star
68

matrix-android-sdk2-sample

Example project for using the android sdk
Kotlin
26
star
69

fed-tester-ui

UI for the matrix federation tester (forked from https://git.lain.haus/f0x/fed-tester)
JavaScript
26
star
70

lb

MSC3079 Low Bandwidth library for servers and clients
Go
25
star
71

prosody-mod-auth-matrix-user-verification

Matrix user verification auth for Prosody
Lua
24
star
72

voip-tester

Tests VoIP
JavaScript
23
star
73

thirdroom-unity-exporter

C#
23
star
74

matrix-user-verification-service

Service to verify details of a user based on a Open ID token.
JavaScript
23
star
75

matrix-search

A generic search engine daemon
Go
22
star
76

tardis

Time Agnostic Room DAG Inspection Service
JavaScript
21
star
77

synapse-auto-accept-invite

Synapse module to automatically accept invites
Python
18
star
78

libp2p-proxy

A p2p transport shim for p2p matrix.
Go
18
star
79

patience

Full stack integration testing for Matrix clients and servers
TypeScript
18
star
80

matrix-sentry-webhooks

Sentry webhooks integration bot for Matrix.
JavaScript
17
star
81

matrix-appservice-verto

A Matrix <--> Verto bridge, designed for conferencing
JavaScript
16
star
82

go-sqlite3-js

Go SQL driver for sqlite3 in browser (sql.js) from go-wasm
Go
15
star
83

matrix-appservice-rocketchat

JavaScript
15
star
84

matrix-content-scanner

[DEPRECATED] A web service for scanning media hosted by a Matrix media repository. Replaced by https://github.com/vector-im/matrix-content-scanner-python
JavaScript
13
star
85

synapse-user-restrictions

This module allows restricting users from performing actions such as creating rooms or sending invites.
Python
13
star
86

docker-dehydrated

A docker image we use internally for managing certificates.
Shell
13
star
87

matrix-rust-components-kotlin

Kotlin
12
star
88

matrix-rust-sdk-crypto-wasm

Rust
12
star
89

matrix-websockets-proxy

Websockets wrapper for matrix.org homeservers
Go
12
star
90

panopticon

panopticon records usage metrics from homeservers
Go
11
star
91

matrix-files-sdk

JS/TS SDK for working with files and folders in Matrix
TypeScript
11
star
92

remember-this-rs

A simple Rust crate to cache data both in-memory and on disk
Rust
11
star
93

complement-crypto

Go
10
star
94

allchange

A multi-project changelog generator
TypeScript
10
star
95

python-unpaddedbase64

Unpadded Base64
Python
10
star
96

synapse-email-account-validity

Account validity plugin for Synapse using email
Python
10
star
97

matrixmon

A small end-to-end prober and Prometheus stats exporter for a Matrix homeserver
Perl
10
star
98

matrix-synapse-saml-mozilla

Mozilla flavour of a Synapse SAML mapping provider
Python
9
star
99

vodozemac-bindings

Language bindings for vodozemac
Rust
9
star
100

synapse-config-generator

A web based synapse config generator
JavaScript
9
star