Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' of github.com:matrix-org/synapse into anoa/asy…
Browse files Browse the repository at this point in the history
…nc_is_server_admin_user_can_delete_alias

* 'develop' of github.com:matrix-org/synapse: (382 commits)
  Convert http.HTTPStatus objects to their int equivalent (#7188)
  Reduce the number of calls to `resource.getrusage` (#7183)
  Remove some `run_in_background` calls in replication code (#7203)
  Revert "Revert "Merge pull request #7153 from matrix-org/babolivier/sso_whitelist_login_fallback""
  Revert "Revert "Improve the UX of the login fallback when using SSO (#7152)""
  Revert "Merge pull request #7153 from matrix-org/babolivier/sso_whitelist_login_fallback"
  Revert "Improve the UX of the login fallback when using SSO (#7152)"
  tweak changelog
  1.12.3
  Update docstring per review comments
  Fix device list update stream ids going backward (#7158)
  Fix the debian build in a better way. (#7212)
  Fix changelog wording
  1.12.2
  Pin Pillow>=4.3.0,<7.1.0 to fix dep issue
  1.12.1
  review comment
  1.12.1
  Support SAML in the user interactive authentication workflow. (#7102)
  Allow admins to create aliases when they are not in the room (#7191)
  ...
  • Loading branch information
anoadragon453 committed Apr 3, 2020
2 parents dd03599 + 07b88c5 commit 4294ed1
Show file tree
Hide file tree
Showing 361 changed files with 12,863 additions and 7,815 deletions.
13 changes: 13 additions & 0 deletions .buildkite/scripts/test_old_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# this script is run by buildkite in a plain `xenial` container; it installs the
# minimal requirements for tox and hands over to the py35-old tox environment.

set -ex

apt-get update
apt-get install -y python3.5 python3.5-dev python3-pip libxml2-dev libxslt-dev zlib1g-dev tox

export LANG="C.UTF-8"

exec tox -e py35-old,combine
2 changes: 2 additions & 0 deletions .buildkite/worker-blacklist
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ Server correctly handles incoming m.device_list_update

# this fails reliably with a torture level of 100 due to https://github.com/matrix-org/synapse/issues/6536
Outbound federation requests missing prev_events and then asks for /state_ids and resolves the state

Can get rooms/{roomId}/members at a given point
339 changes: 337 additions & 2 deletions CHANGES.md

Large diffs are not rendered by default.

16 changes: 15 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ python 3.6 and to install each tool:

```
# Install the dependencies
pip install -U black flake8 isort
pip install -U black flake8 flake8-comprehensions isort
# Run the linter script
./scripts-dev/lint.sh
Expand Down Expand Up @@ -200,6 +200,20 @@ Git allows you to add this signoff automatically when using the `-s`
flag to `git commit`, which uses the name and email set in your
`user.name` and `user.email` git configs.

## Merge Strategy

We use the commit history of develop/master extensively to identify
when regressions were introduced and what changes have been made.

We aim to have a clean merge history, which means we normally squash-merge
changes into develop. For small changes this means there is no need to rebase
to clean up your PR before merging. Larger changes with an organised set of
commits may be merged as-is, if the history is judged to be useful.

This use of squash-merging will mean PRs built on each other will be hard to
merge. We suggest avoiding these where possible, and if required, ensuring
each PR has a tidy set of commits to ease merging.

## Conclusion

That's it! Matrix is a very open and collaborative project as you might expect
Expand Down
142 changes: 68 additions & 74 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
- [Installing Synapse](#installing-synapse)
- [Installing from source](#installing-from-source)
- [Platform-Specific Instructions](#platform-specific-instructions)
- [Troubleshooting Installation](#troubleshooting-installation)
- [Prebuilt packages](#prebuilt-packages)
- [Setting up Synapse](#setting-up-synapse)
- [TLS certificates](#tls-certificates)
- [Email](#email)
- [Registering a user](#registering-a-user)
- [Setting up a TURN server](#setting-up-a-turn-server)
- [URL previews](#url-previews)
- [Troubleshooting Installation](#troubleshooting-installation)

# Choosing your server name

Expand All @@ -36,7 +36,7 @@ that your email address is probably `user@example.com` rather than
System requirements:

- POSIX-compliant system (tested on Linux & OS X)
- Python 3.5, 3.6, 3.7 or 3.8.
- Python 3.5.2 or later, up to Python 3.8.
- At least 1GB of free RAM if you want to join large public rooms like #matrix:matrix.org

Synapse is written in Python but some of the libraries it uses are written in
Expand Down Expand Up @@ -70,7 +70,7 @@ pip install -U matrix-synapse
```

Before you can start Synapse, you will need to generate a configuration
file. To do this, run (in your virtualenv, as before)::
file. To do this, run (in your virtualenv, as before):

```
cd ~/synapse
Expand All @@ -84,22 +84,24 @@ python -m synapse.app.homeserver \
... substituting an appropriate value for `--server-name`.

This command will generate you a config file that you can then customise, but it will
also generate a set of keys for you. These keys will allow your Home Server to
identify itself to other Home Servers, so don't lose or delete them. It would be
also generate a set of keys for you. These keys will allow your homeserver to
identify itself to other homeserver, so don't lose or delete them. It would be
wise to back them up somewhere safe. (If, for whatever reason, you do need to
change your Home Server's keys, you may find that other Home Servers have the
change your homeserver's keys, you may find that other homeserver have the
old key cached. If you update the signing key, you should change the name of the
key in the `<server name>.signing.key` file (the second word) to something
different. See the
[spec](https://matrix.org/docs/spec/server_server/latest.html#retrieving-server-keys)
for more information on key management.)
for more information on key management).

To actually run your new homeserver, pick a working directory for Synapse to
run (e.g. `~/synapse`), and::
run (e.g. `~/synapse`), and:

cd ~/synapse
source env/bin/activate
synctl start
```
cd ~/synapse
source env/bin/activate
synctl start
```

### Platform-Specific Instructions

Expand All @@ -110,7 +112,7 @@ Installing prerequisites on Ubuntu or Debian:
```
sudo apt-get install build-essential python3-dev libffi-dev \
python3-pip python3-setuptools sqlite3 \
libssl-dev python3-virtualenv libjpeg-dev libxslt1-dev
libssl-dev virtualenv libjpeg-dev libxslt1-dev
```

#### ArchLinux
Expand All @@ -124,12 +126,21 @@ sudo pacman -S base-devel python python-pip \

#### CentOS/Fedora

Installing prerequisites on CentOS 7 or Fedora 25:
Installing prerequisites on CentOS 8 or Fedora>26:

```
sudo dnf install libtiff-devel libjpeg-devel libzip-devel freetype-devel \
libwebp-devel tk-devel redhat-rpm-config \
python3-virtualenv libffi-devel openssl-devel
sudo dnf groupinstall "Development Tools"
```

Installing prerequisites on CentOS 7 or Fedora<=25:

```
sudo yum install libtiff-devel libjpeg-devel libzip-devel freetype-devel \
lcms2-devel libwebp-devel tcl-devel tk-devel redhat-rpm-config \
python-virtualenv libffi-devel openssl-devel
python3-virtualenv libffi-devel openssl-devel
sudo yum groupinstall "Development Tools"
```

Expand Down Expand Up @@ -179,15 +190,15 @@ doas pkg_add python libffi py-pip py-setuptools sqlite3 py-virtualenv \
There is currently no port for OpenBSD. Additionally, OpenBSD's security
settings require a slightly more difficult installation process.

XXX: I suspect this is out of date.
(XXX: I suspect this is out of date)

1. Create a new directory in `/usr/local` called `_synapse`. Also, create a
new user called `_synapse` and set that directory as the new user's home.
This is required because, by default, OpenBSD only allows binaries which need
write and execute permissions on the same memory space to be run from
`/usr/local`.
2. `su` to the new `_synapse` user and change to their home directory.
3. Create a new virtualenv: `virtualenv -p python2.7 ~/.synapse`
3. Create a new virtualenv: `virtualenv -p python3 ~/.synapse`
4. Source the virtualenv configuration located at
`/usr/local/_synapse/.synapse/bin/activate`. This is done in `ksh` by
using the `.` command, rather than `bash`'s `source`.
Expand All @@ -208,45 +219,6 @@ be found at https://docs.microsoft.com/en-us/windows/wsl/install-win10 for
Windows 10 and https://docs.microsoft.com/en-us/windows/wsl/install-on-server
for Windows Server.

### Troubleshooting Installation

XXX a bunch of this is no longer relevant.

Synapse requires pip 8 or later, so if your OS provides too old a version you
may need to manually upgrade it::

sudo pip install --upgrade pip

Installing may fail with `Could not find any downloads that satisfy the requirement pymacaroons-pynacl (from matrix-synapse==0.12.0)`.
You can fix this by manually upgrading pip and virtualenv::

sudo pip install --upgrade virtualenv

You can next rerun `virtualenv -p python3 synapse` to update the virtual env.

Installing may fail during installing virtualenv with `InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.`
You can fix this by manually installing ndg-httpsclient::

pip install --upgrade ndg-httpsclient

Installing may fail with `mock requires setuptools>=17.1. Aborting installation`.
You can fix this by upgrading setuptools::

pip install --upgrade setuptools

If pip crashes mid-installation for reason (e.g. lost terminal), pip may
refuse to run until you remove the temporary installation directory it
created. To reset the installation::

rm -rf /tmp/pip_install_matrix

pip seems to leak *lots* of memory during installation. For instance, a Linux
host with 512MB of RAM may run out of memory whilst installing Twisted. If this
happens, you will have to individually install the dependencies which are
failing, e.g.::

pip install twisted

## Prebuilt packages

As an alternative to installing from source, prebuilt packages are available
Expand Down Expand Up @@ -305,7 +277,7 @@ For `buster` and `sid`, Synapse is available in the Debian repositories and
it should be possible to install it with simply:

```
sudo apt install matrix-synapse
sudo apt install matrix-synapse
```

There is also a version of `matrix-synapse` in `stretch-backports`. Please see
Expand Down Expand Up @@ -366,15 +338,17 @@ sudo pip install py-bcrypt

Synapse can be found in the void repositories as 'synapse':

xbps-install -Su
xbps-install -S synapse
```
xbps-install -Su
xbps-install -S synapse
```

### FreeBSD

Synapse can be installed via FreeBSD Ports or Packages contributed by Brendan Molloy from:

- Ports: `cd /usr/ports/net-im/py-matrix-synapse && make install clean`
- Packages: `pkg install py27-matrix-synapse`
- Packages: `pkg install py37-matrix-synapse`


### NixOS
Expand All @@ -388,15 +362,17 @@ Once you have installed synapse as above, you will need to configure it.

## TLS certificates

The default configuration exposes a single HTTP port: http://localhost:8008. It
is suitable for local testing, but for any practical use, you will either need
to enable a reverse proxy, or configure Synapse to expose an HTTPS port.
The default configuration exposes a single HTTP port on the local
interface: `http://localhost:8008`. It is suitable for local testing,
but for any practical use, you will need Synapse's APIs to be served
over HTTPS.

For information on using a reverse proxy, see
The recommended way to do so is to set up a reverse proxy on port
`8448`. You can find documentation on doing so in
[docs/reverse_proxy.md](docs/reverse_proxy.md).

To configure Synapse to expose an HTTPS port, you will need to edit
`homeserver.yaml`, as follows:
Alternatively, you can configure Synapse to expose an HTTPS port. To do
so, you will need to edit `homeserver.yaml`, as follows:

* First, under the `listeners` section, uncomment the configuration for the
TLS-enabled listener. (Remove the hash sign (`#`) at the start of
Expand All @@ -409,19 +385,23 @@ To configure Synapse to expose an HTTPS port, you will need to edit
resources:
- names: [client, federation]
```

* You will also need to uncomment the `tls_certificate_path` and
`tls_private_key_path` lines under the `TLS` section. You can either
point these settings at an existing certificate and key, or you can
enable Synapse's built-in ACME (Let's Encrypt) support. Instructions
for having Synapse automatically provision and renew federation
certificates through ACME can be found at [ACME.md](docs/ACME.md). If you
are using your own certificate, be sure to use a `.pem` file that includes
the full certificate chain including any intermediate certificates (for
instance, if using certbot, use `fullchain.pem` as your certificate, not
certificates through ACME can be found at [ACME.md](docs/ACME.md).
Note that, as pointed out in that document, this feature will not
work with installs set up after November 2019.

If you are using your own certificate, be sure to use a `.pem` file that
includes the full certificate chain including any intermediate certificates
(for instance, if using certbot, use `fullchain.pem` as your certificate, not
`cert.pem`).

For a more detailed guide to configuring your server for federation, see
[federate.md](docs/federate.md)
[federate.md](docs/federate.md).


## Email
Expand Down Expand Up @@ -468,7 +448,7 @@ on your server even if `enable_registration` is `false`.
## Setting up a TURN server

For reliable VoIP calls to be routed via this homeserver, you MUST configure
a TURN server. See [docs/turn-howto.md](docs/turn-howto.md) for details.
a TURN server. See [docs/turn-howto.md](docs/turn-howto.md) for details.

## URL previews

Expand All @@ -477,10 +457,24 @@ turn it on you must enable the `url_preview_enabled: True` config parameter
and explicitly specify the IP ranges that Synapse is not allowed to spider for
previewing in the `url_preview_ip_range_blacklist` configuration parameter.
This is critical from a security perspective to stop arbitrary Matrix users
spidering 'internal' URLs on your network. At the very least we recommend that
spidering 'internal' URLs on your network. At the very least we recommend that
your loopback and RFC1918 IP addresses are blacklisted.

This also requires the optional lxml and netaddr python dependencies to be
installed. This in turn requires the libxml2 library to be available - on
This also requires the optional `lxml` and `netaddr` python dependencies to be
installed. This in turn requires the `libxml2` library to be available - on
Debian/Ubuntu this means `apt-get install libxml2-dev`, or equivalent for
your OS.

# Troubleshooting Installation

`pip` seems to leak *lots* of memory during installation. For instance, a Linux
host with 512MB of RAM may run out of memory whilst installing Twisted. If this
happens, you will have to individually install the dependencies which are
failing, e.g.:

```
pip install twisted
```

If you have any other problems, feel free to ask in
[#synapse:matrix.org](https://matrix.to/#/#synapse:matrix.org).
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ to install using pip and a virtualenv::

virtualenv -p python3 env
source env/bin/activate
python -m pip install --no-use-pep517 -e .[all]
python -m pip install --no-use-pep517 -e ".[all]"

This will run a process of downloading and installing all the needed
dependencies into a virtual env.
Expand Down
1 change: 1 addition & 0 deletions changelog.d/6573.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Don't attempt to use an invalid sqlite config if no database configuration is provided. Contributed by @nekatak.
1 change: 1 addition & 0 deletions changelog.d/6634.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix single-sign on with CAS systems: pass the same service URL when requesting the CAS ticket and when calling the `proxyValidate` URL. Contributed by @Naugrimm.
1 change: 1 addition & 0 deletions changelog.d/6639.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix missing field `default` when fetching user-defined push rules.
1 change: 0 additions & 1 deletion changelog.d/6825.bugfix

This file was deleted.

1 change: 0 additions & 1 deletion changelog.d/6827.misc

This file was deleted.

1 change: 1 addition & 0 deletions changelog.d/6892.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update Debian installation instructions to recommend installing the `virtualenv` package instead of `python3-virtualenv`.
1 change: 1 addition & 0 deletions changelog.d/6946.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Transfer alias mappings on room upgrade.
1 change: 1 addition & 0 deletions changelog.d/6988.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve the documentation for database configuration.
1 change: 1 addition & 0 deletions changelog.d/7009.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Set `Referrer-Policy` header to `no-referrer` on media downloads.
1 change: 1 addition & 0 deletions changelog.d/7010.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change device list streams to have one row per ID.
1 change: 1 addition & 0 deletions changelog.d/7011.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove concept of a non-limited stream.
1 change: 1 addition & 0 deletions changelog.d/7024.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Move catchup of replication streams logic to worker.
1 change: 1 addition & 0 deletions changelog.d/7051.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Admin API `POST /_synapse/admin/v1/join/<roomIdOrAlias>` to join users to a room like `auto_join_rooms` for creation of users.
1 change: 1 addition & 0 deletions changelog.d/7068.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ensure that a user inteactive authentication session is tied to a single request.
1 change: 1 addition & 0 deletions changelog.d/7089.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug in the federation API which could cause occasional "Failed to get PDU" errors.
1 change: 1 addition & 0 deletions changelog.d/7096.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add options to prevent users from changing their profile or associated 3PIDs.
1 change: 1 addition & 0 deletions changelog.d/7102.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support SSO in the user interactive authentication workflow.
1 change: 1 addition & 0 deletions changelog.d/7107.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update pre-built package name for FreeBSD.
1 change: 1 addition & 0 deletions changelog.d/7109.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Return the proper error (M_BAD_ALIAS) when a non-existant canonical alias is provided.
1 change: 1 addition & 0 deletions changelog.d/7110.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Convert some of synapse.rest.media to async/await.
1 change: 1 addition & 0 deletions changelog.d/7115.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
De-duplicate / remove unused REST code for login and auth.
1 change: 1 addition & 0 deletions changelog.d/7116.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Convert `*StreamRow` classes to inner classes.
1 change: 1 addition & 0 deletions changelog.d/7117.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug which meant that groups updates were not correctly replicated between workers.
1 change: 1 addition & 0 deletions changelog.d/7118.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow server admins to define and enforce a password policy (MSC2000).
1 change: 1 addition & 0 deletions changelog.d/7119.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update postgres docs with login troubleshooting information.
Loading

0 comments on commit 4294ed1

Please sign in to comment.