<buttonid="sidebar-toggle"class="icon-button"type="button"title="Toggle Table of Contents"aria-label="Toggle Table of Contents"aria-controls="sidebar">
<ahref="https://github.com/matrix-org/synapse/edit/develop/docs/upgrading/README.md"title="Suggest an edit"aria-label="Suggest an edit">
<iid="git-edit-button"class="fa fa-edit"></i>
</a>
</div>
</div>
<divid="search-wrapper"class="hidden">
<formid="searchbar-outer"class="searchbar-outer">
<inputtype="search"id="searchbar"name="searchbar"placeholder="Search this book ..."aria-controls="searchresults-outer"aria-describedby="searchresults-header">
<h1id="replace-130-and-stretch-accordingly"><aclass="header"href="#replace-130-and-stretch-accordingly">replace <code>1.3.0</code> and <code>stretch</code> accordingly:</a></h1>
<p>The <code>room_invite_state_types</code> configuration setting has been deprecated and
replaced with <code>room_prejoin_state</code>. See the <code>sample configuration file <https://github.com/matrix-org/synapse/blob/v1.34.0/docs/sample_config.yaml#L1515></code>_.</p>
<p>If you have set <code>room_invite_state_types</code> to the default value you should simply
remove it from your configuration file. The default value used to be:</p>
<p>.. code:: yaml</p>
<p>room_invite_state_types:
- "m.room.join_rules"
- "m.room.canonical_alias"
- "m.room.avatar"
- "m.room.encryption"
- "m.room.name"</p>
<p>If you have customised this value, you should remove <code>room_invite_state_types</code> and
<h1id="upgrading-to-v1330"><aclass="header"href="#upgrading-to-v1330">Upgrading to v1.33.0</a></h1>
<h2id="account-validity-html-templates-can-now-display-a-users-expiration-date"><aclass="header"href="#account-validity-html-templates-can-now-display-a-users-expiration-date">Account Validity HTML templates can now display a user's expiration date</a></h2>
<p>This may affect you if you have enabled the account validity feature, and have made use of a
custom HTML template specified by the <code>account_validity.template_dir</code> or <code>account_validity.account_renewed_html_path</code>
Synapse config options.</p>
<p>The template can now accept an <code>expiration_ts</code> variable, which represents the unix timestamp in milliseconds for the
future date of which their account has been renewed until. See the
and can also accept an <code>expiration_ts</code> variable. This template replaces the error message users would previously see
upon attempting to use a valid renewal token more than once.</p>
<h1id="upgrading-to-v1320"><aclass="header"href="#upgrading-to-v1320">Upgrading to v1.32.0</a></h1>
<h2id="regression-causing-connected-prometheus-instances-to-become-overwhelmed"><aclass="header"href="#regression-causing-connected-prometheus-instances-to-become-overwhelmed">Regression causing connected Prometheus instances to become overwhelmed</a></h2>
<h2id="dropping-support-for-old-python-postgres-and-sqlite-versions"><aclass="header"href="#dropping-support-for-old-python-postgres-and-sqlite-versions">Dropping support for old Python, Postgres and SQLite versions</a></h2>
<p>In line with our <code>deprecation policy <https://github.com/matrix-org/synapse/blob/release-v1.32.0/docs/deprecation_policy.md></code>_,
we've dropped support for Python 3.5 and PostgreSQL 9.5, as they are no longer supported upstream.</p>
<p>This release of Synapse requires Python 3.6+ and PostgresSQL 9.6+ or SQLite 3.22+.</p>
<h2id="removal-of-old-list-accounts-admin-api"><aclass="header"href="#removal-of-old-list-accounts-admin-api">Removal of old List Accounts Admin API</a></h2>
<p>The deprecated v1 "list accounts" admin API (<code>GET /_synapse/admin/v1/users/<user_id></code>) has been removed in this version.</p>
<p>The <code>v2 list accounts API <https://github.com/matrix-org/synapse/blob/master/docs/admin_api/user_admin_api.rst#list-accounts></code>_
has been available since Synapse 1.7.0 (2019-12-13), and is accessible under <code>GET /_synapse/admin/v2/users</code>.</p>
<p>The deprecation of the old endpoint was announced with Synapse 1.28.0 (released on 2021-02-25).</p>
<h2id="application-services-must-use-type-mloginapplication_service-when-registering-users"><aclass="header"href="#application-services-must-use-type-mloginapplication_service-when-registering-users">Application Services must use type <code>m.login.application_service</code> when registering users</a></h2>
<p>In compliance with the
<code>Application Service spec <https://matrix.org/docs/spec/application_service/r0.1.2#server-admin-style-permissions></code>_,
Application Services are now required to use the <code>m.login.application_service</code> type when registering users via the
<code>/_matrix/client/r0/register</code> endpoint. This behaviour was deprecated in Synapse v1.30.0.</p>
<p>Please ensure your Application Services are up to date.</p>
<h1id="upgrading-to-v1290"><aclass="header"href="#upgrading-to-v1290">Upgrading to v1.29.0</a></h1>
<h2id="requirement-for-x-forwarded-proto-header"><aclass="header"href="#requirement-for-x-forwarded-proto-header">Requirement for X-Forwarded-Proto header</a></h2>
<p>When using Synapse with a reverse proxy (in particular, when using the
<code>x_forwarded</code> option on an HTTP listener), Synapse now expects to receive an
<code>X-Forwarded-Proto</code> header on incoming HTTP requests. If it is not set, Synapse
will log a warning on each received request.</p>
<p>To avoid the warning, administrators using a reverse proxy should ensure that
the reverse proxy sets <code>X-Forwarded-Proto</code> header to <code>https</code> or <code>http</code> to
indicate the protocol used by the client.</p>
<p>Synapse also requires the <code>Host</code> header to be preserved.</p>
<p>See the <code>reverse proxy documentation <docs/reverse_proxy.md></code>_, where the
example configurations have been updated to show how to set these headers.</p>
<p>(Users of <code>Caddy <https://caddyserver.com/></code>_ are unaffected, since we believe it
sets <code>X-Forwarded-Proto</code> by default.)</p>
<h1id="upgrading-to-v1270"><aclass="header"href="#upgrading-to-v1270">Upgrading to v1.27.0</a></h1>
<h2id="changes-to-callback-uri-for-oauth2--openid-connect-and-saml2"><aclass="header"href="#changes-to-callback-uri-for-oauth2--openid-connect-and-saml2">Changes to callback URI for OAuth2 / OpenID Connect and SAML2</a></h2>
<p>This version changes the URI used for callbacks from OAuth2 and SAML2 identity providers:</p>
<ul>
<li>
<p>If your server is configured for single sign-on via an OpenID Connect or OAuth2 identity
provider, you will need to add <code>[synapse public baseurl]/_synapse/client/oidc/callback</code>
to the list of permitted "redirect URIs" at the identity provider.</p>
<p>See <code>docs/openid.md <docs/openid.md></code>_ for more information on setting up OpenID
Connect.</p>
</li>
<li>
<p>If your server is configured for single sign-on via a SAML2 identity provider, you will
need to add <code>[synapse public baseurl]/_synapse/client/saml2/authn_response</code> as a permitted
"ACS location" (also known as "allowed callback URLs") at the identity provider.</p>
<p>The "Issuer" in the "AuthnRequest" to the SAML2 identity provider is also updated to
<code>[synapse public baseurl]/_synapse/client/saml2/metadata.xml</code>. If your SAML2 identity
provider uses this property to validate or otherwise identify Synapse, its configuration
will need to be updated to use the new URL. Alternatively you could create a new, separate
"EntityDescriptor" in your SAML2 identity provider with the new URLs and leave the URLs in
the existing "EntityDescriptor" as they were.</p>
</li>
</ul>
<h2id="changes-to-html-templates"><aclass="header"href="#changes-to-html-templates">Changes to HTML templates</a></h2>
<p>The HTML templates for SSO and email notifications now have <code>Jinja2's autoescape <https://jinja.palletsprojects.com/en/2.11.x/api/#autoescaping></code>_
enabled for files ending in <code>.html</code>, <code>.htm</code>, and <code>.xml</code>. If you have customised
these templates and see issues when viewing them you might need to update them.
It is expected that most configurations will need no changes.</p>
<p>If you have customised the templates <em>names</em> for these templates, it is recommended
to verify they end in <code>.html</code> to ensure autoescape is enabled.</p>
<p>The above applies to the following templates:</p>
<ul>
<li><code>add_threepid.html</code></li>
<li><code>add_threepid_failure.html</code></li>
<li><code>add_threepid_success.html</code></li>
<li><code>notice_expiry.html</code></li>
<li><code>notice_expiry.html</code></li>
<li><code>notif_mail.html</code> (which, by default, includes <code>room.html</code> and <code>notif.html</code>)</li>
<h1id="upgrading-to-v1260"><aclass="header"href="#upgrading-to-v1260">Upgrading to v1.26.0</a></h1>
<h2id="rolling-back-to-v1250-after-a-failed-upgrade"><aclass="header"href="#rolling-back-to-v1250-after-a-failed-upgrade">Rolling back to v1.25.0 after a failed upgrade</a></h2>
<p>v1.26.0 includes a lot of large changes. If something problematic occurs, you
may want to roll-back to a previous version of Synapse. Because v1.26.0 also
includes a new database schema version, reverting that version is also required
alongside the generic rollback instructions mentioned above. In short, to roll
back to v1.25.0 you need to:</p>
<ol>
<li>
<p>Stop the server</p>
</li>
<li>
<p>Decrease the schema version in the database:</p>
<p>.. code:: sql</p>
<p>UPDATE schema_version SET version = 58;</p>
</li>
<li>
<p>Delete the ignored users & chain cover data:</p>
<p>.. code:: sql</p>
<p>DROP TABLE IF EXISTS ignored_users;
UPDATE rooms SET has_auth_chain_index = false;</p>
<p>For PostgreSQL run:</p>
<p>.. code:: sql</p>
<p>TRUNCATE event_auth_chain_links;
TRUNCATE event_auth_chains;</p>
<p>For SQLite run:</p>
<p>.. code:: sql</p>
<p>DELETE FROM event_auth_chain_links;
DELETE FROM event_auth_chains;</p>
</li>
<li>
<p>Mark the deltas as not run (so they will re-run on upgrade).</p>
<p>.. code:: sql</p>
<p>DELETE FROM applied_schema_deltas WHERE version = 59 AND file = "59/01ignored_user.py";
DELETE FROM applied_schema_deltas WHERE version = 59 AND file = "59/06chain_cover_index.sql";</p>
</li>
<li>
<p>Downgrade Synapse by following the instructions for your installation method
in the "Rolling back to older versions" section above.</p>
</li>
</ol>
<h1id="upgrading-to-v1250"><aclass="header"href="#upgrading-to-v1250">Upgrading to v1.25.0</a></h1>
<p>The endpoints with <code>/_matrix/client/*</code> prefixes have been removed as of v1.24.0.
The Admin API is now only accessible under:</p>
<ul>
<li><code>/_synapse/admin/v1</code></li>
</ul>
<p>The only exception is the <code>/admin/whois</code> endpoint, which is
<code>also available via the client-server API <https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-admin-whois-userid></code>_.</p>
<p>The deprecation of the old endpoints was announced with Synapse 1.20.0 (released
on 2020-09-22) and makes it easier for homeserver admins to lock down external
access to the Admin API endpoints.</p>
<h1id="upgrading-to-v1230"><aclass="header"href="#upgrading-to-v1230">Upgrading to v1.23.0</a></h1>
<p>This release deprecates use of the <code>structured: true</code> logging configuration for
structured logging. If your logging configuration contains <code>structured: true</code>
then it should be modified based on the <code>structured logging documentation <https://github.com/matrix-org/synapse/blob/master/docs/structured_logging.md></code>_.</p>
<p>The <code>structured</code> and <code>drains</code> logging options are now deprecated and should
be replaced by standard logging configuration of <code>handlers</code> and <code>formatters</code>.</p>
<p>A future will release of Synapse will make using <code>structured: true</code> an error.</p>
<h1id="upgrading-to-v1220"><aclass="header"href="#upgrading-to-v1220">Upgrading to v1.22.0</a></h1>
<p>This release introduces a backwards-incompatible change to modules making use of
<code>ThirdPartyEventRules</code> in Synapse. If you make use of a module defined under the
<code>third_party_event_rules</code> config option, please make sure it is updated to handle
the below change:</p>
<p>The <code>http_client</code> argument is no longer passed to modules as they are initialised. Instead,
modules are expected to make use of the <code>http_client</code> property on the <code>ModuleApi</code> class.
Modules are now passed a <code>module_api</code> argument during initialisation, which is an instance of
<code>ModuleApi</code>. <code>ModuleApi</code> instances have a <code>http_client</code> property which acts the same as
the <code>http_client</code> argument previously passed to <code>ThirdPartyEventRules</code> modules.</p>
<h1id="upgrading-to-v1210"><aclass="header"href="#upgrading-to-v1210">Upgrading to v1.21.0</a></h1>
<h2id="forwarding-_synapseclient-through-your-reverse-proxy"><aclass="header"href="#forwarding-_synapseclient-through-your-reverse-proxy">Forwarding <code>/_synapse/client</code> through your reverse proxy</a></h2>
<p>The <code>reverse proxy documentation <https://github.com/matrix-org/synapse/blob/develop/docs/reverse_proxy.md></code>_ has been updated
to include reverse proxy directives for <code>/_synapse/client/*</code> endpoints. As the user password
reset flow now uses endpoints under this prefix, <strong>you must update your reverse proxy
configurations for user password reset to work</strong>.</p>
<p>Additionally, note that the <code>Synapse worker documentation <https://github.com/matrix-org/synapse/blob/develop/docs/workers.md></code>_ has been updated to
state that the <code>/_synapse/client/password_reset/email/submit_token</code> endpoint can be handled
by all workers. If you make use of Synapse's worker feature, please update your reverse proxy
configuration to reflect this change.</p>
<h2id="new-html-templates"><aclass="header"href="#new-html-templates">New HTML templates</a></h2>
with the query parameters from the original link, presented as a URL-encoded form. See the file
itself for more details.</p>
<h2id="updated-single-sign-on-html-templates"><aclass="header"href="#updated-single-sign-on-html-templates">Updated Single Sign-on HTML Templates</a></h2>
<p>The <code>saml_error.html</code> template was removed from Synapse and replaced with the
<code>sso_error.html</code> template. If your Synapse is configured to use SAML and a
custom <code>sso_redirect_confirm_template_dir</code> configuration then any customisations
of the <code>saml_error.html</code> template will need to be merged into the <code>sso_error.html</code>
template. These templates are similar, but the parameters are slightly different:</p>
<ul>
<li>The <code>msg</code> parameter should be renamed to <code>error_description</code>.</li>
<li>There is no longer a <code>code</code> parameter for the response code.</li>
<li>A string <code>error</code> parameter is available that includes a short hint of why a
user is seeing the error page.</li>
</ul>
<h1id="upgrading-to-v1180"><aclass="header"href="#upgrading-to-v1180">Upgrading to v1.18.0</a></h1>
<h2id="docker--py3-suffix-will-be-removed-in-future-versions"><aclass="header"href="#docker--py3-suffix-will-be-removed-in-future-versions">Docker <code>-py3</code> suffix will be removed in future versions</a></h2>
<p>From 10th August 2020, we will no longer publish Docker images with the <code>-py3</code> tag suffix. The images tagged with the <code>-py3</code> suffix have been identical to the non-suffixed tags since release 0.99.0, and the suffix is obsolete.</p>
<p>On 10th August, we will remove the <code>latest-py3</code> tag. Existing per-release tags (such as <code>v1.18.0-py3</code>) will not be removed, but no new <code>-py3</code> tags will be added.</p>
<p>Scripts relying on the <code>-py3</code> suffix will need to be updated.</p>
<h2id="redis-replication-is-now-recommended-in-lieu-of-tcp-replication"><aclass="header"href="#redis-replication-is-now-recommended-in-lieu-of-tcp-replication">Redis replication is now recommended in lieu of TCP replication</a></h2>
<p>When setting up worker processes, we now recommend the use of a Redis server for replication. <strong>The old direct TCP connection method is deprecated and will be removed in a future release.</strong>
See <code>docs/workers.md <docs/workers.md></code>_ for more details.</p>
<h1id="upgrading-to-v1140"><aclass="header"href="#upgrading-to-v1140">Upgrading to v1.14.0</a></h1>
<p>This version includes a database update which is run as part of the upgrade,
and which may take a couple of minutes in the case of a large server. Synapse
will not respond to HTTP requests while this update is taking place.</p>
<h1id="upgrading-to-v1130"><aclass="header"href="#upgrading-to-v1130">Upgrading to v1.13.0</a></h1>
<h2id="incorrect-database-migration-in-old-synapse-versions"><aclass="header"href="#incorrect-database-migration-in-old-synapse-versions">Incorrect database migration in old synapse versions</a></h2>
<p>A bug was introduced in Synapse 1.4.0 which could cause the room directory to
be incomplete or empty if Synapse was upgraded directly from v1.2.1 or
earlier, to versions between v1.4.0 and v1.12.x.</p>
<p>This will <em>not</em> be a problem for Synapse installations which were:</p>
<ul>
<li>created at v1.4.0 or later,</li>
<li>upgraded via v1.3.x, or</li>
<li>upgraded straight from v1.2.1 or earlier to v1.13.0 or later.</li>
</ul>
<p>If completeness of the room directory is a concern, installations which are
affected can be repaired as follows:</p>
<ol>
<li>
<p>Run the following sql from a <code>psql</code> or <code>sqlite3</code> console:</p>
<p>.. code:: sql</p>
<p>INSERT INTO background_updates (update_name, progress_json, depends_on) VALUES
<p>Plugins using the <code>complete_sso_login</code> method of
<code>synapse.module_api.ModuleApi</code> should update to using the async/await
version <code>complete_sso_login_async</code> which includes additional checks. The
non-async version is considered deprecated.</p>
<h2id="rolling-back-to-v1124-after-a-failed-upgrade"><aclass="header"href="#rolling-back-to-v1124-after-a-failed-upgrade">Rolling back to v1.12.4 after a failed upgrade</a></h2>
<p>v1.13.0 includes a lot of large changes. If something problematic occurs, you
may want to roll-back to a previous version of Synapse. Because v1.13.0 also
includes a new database schema version, reverting that version is also required
alongside the generic rollback instructions mentioned above. In short, to roll
back to v1.12.4 you need to:</p>
<ol>
<li>
<p>Stop the server</p>
</li>
<li>
<p>Decrease the schema version in the database:</p>
<p>.. code:: sql</p>
<p>UPDATE schema_version SET version = 57;</p>
</li>
<li>
<p>Downgrade Synapse by following the instructions for your installation method
in the "Rolling back to older versions" section above.</p>
</li>
</ol>
<h1id="upgrading-to-v1120"><aclass="header"href="#upgrading-to-v1120">Upgrading to v1.12.0</a></h1>
<p>This version includes a database update which is run as part of the upgrade,
and which may take some time (several hours in the case of a large
server). Synapse will not respond to HTTP requests while this update is taking
place.</p>
<p>This is only likely to be a problem in the case of a server which is
participating in many rooms.</p>
<olstart="0">
<li>
<p>As with all upgrades, it is recommended that you have a recent backup of
your database which can be used for recovery in the event of any problems.</p>
</li>
<li>
<p>As an initial check to see if you will be affected, you can try running the
following query from the <code>psql</code> or <code>sqlite3</code> console. It is safe to run it
while Synapse is still running.</p>
<p>.. code:: sql</p>
<p>SELECT MAX(q.v) FROM (
SELECT (
SELECT ej.json AS v
FROM state_events se INNER JOIN event_json ej USING (event_id)
WHERE se.room_id=rooms.room_id AND se.type='m.room.create' AND se.state_key=''
LIMIT 1
) FROM rooms WHERE rooms.room_version IS NULL
) q;</p>
<p>This query will take about the same amount of time as the upgrade process: ie,
if it takes 5 minutes, then it is likely that Synapse will be unresponsive for
5 minutes during the upgrade.</p>
<p>If you consider an outage of this duration to be acceptable, no further
action is necessary and you can simply start Synapse 1.12.0.</p>
<p>If you would prefer to reduce the downtime, continue with the steps below.</p>
</li>
<li>
<p>The easiest workaround for this issue is to manually
create a new index before upgrading. On PostgreSQL, his can be done as follows:</p>
<p>.. code:: sql</p>
<p>CREATE INDEX CONCURRENTLY tmp_upgrade_1_12_0_index
ON state_events(room_id) WHERE type = 'm.room.create';</p>
<p>The above query may take some time, but is also safe to run while Synapse is
running.</p>
<p>We assume that no SQLite users have databases large enough to be
affected. If you <em>are</em> affected, you can run a similar query, omitting the
<code>CONCURRENTLY</code> keyword. Note however that this operation may in itself cause
Synapse to stop running for some time. Synapse admins are reminded that
<code>SQLite is not recommended for use outside a test environment <https://github.com/matrix-org/synapse/blob/master/README.rst#using-postgresql></code>_.</p>
</li>
<li>
<p>Once the index has been created, the <code>SELECT</code> query in step 1 above should
complete quickly. It is therefore safe to upgrade to Synapse 1.12.0.</p>
</li>
<li>
<p>Once Synapse 1.12.0 has successfully started and is responding to HTTP
requests, the temporary index can be removed:</p>
<p>.. code:: sql</p>
<p>DROP INDEX tmp_upgrade_1_12_0_index;</p>
</li>
</ol>
<h1id="upgrading-to-v1100"><aclass="header"href="#upgrading-to-v1100">Upgrading to v1.10.0</a></h1>
<p>Synapse will now log a warning on start up if used with a PostgreSQL database
that has a non-recommended locale set.</p>
<p>See <code>docs/postgres.md <docs/postgres.md></code>_ for details.</p>
<h1id="upgrading-to-v180"><aclass="header"href="#upgrading-to-v180">Upgrading to v1.8.0</a></h1>
<p>Specifying a <code>log_file</code> config option will now cause Synapse to refuse to
start, and should be replaced by with the <code>log_config</code> option. Support for
the <code>log_file</code> option was removed in v1.3.0 and has since had no effect.</p>
<h1id="upgrading-to-v170"><aclass="header"href="#upgrading-to-v170">Upgrading to v1.7.0</a></h1>
<p>In an attempt to configure Synapse in a privacy preserving way, the default
behaviours of <code>allow_public_rooms_without_auth</code> and
<code>allow_public_rooms_over_federation</code> have been inverted. This means that by
default, only authenticated users querying the Client/Server API will be able
to query the room directory, and relatedly that the server will not share
room directory information with other servers over federation.</p>
<p>If your installation does not explicitly set these settings one way or the other
and you want either setting to be <code>true</code> then it will necessary to update
your homeserver configuration file accordingly.</p>
<p>For more details on the surrounding context see our <code>explainer <https://matrix.org/blog/2019/11/09/avoiding-unwelcome-visitors-on-private-matrix-servers></code>_.</p>
<h1id="upgrading-to-v150"><aclass="header"href="#upgrading-to-v150">Upgrading to v1.5.0</a></h1>
<p>This release includes a database migration which may take several minutes to
complete if there are a large number (more than a million or so) of entries in
the <code>devices</code> table. This is only likely to a be a problem on very large
installations.</p>
<h1id="upgrading-to-v140"><aclass="header"href="#upgrading-to-v140">Upgrading to v1.4.0</a></h1>
<p>If you have configured a custom template directory with the
<code>email.template_dir</code> option, be aware that there are new templates regarding
registration and threepid management (see below) that must be included.</p>
<ul>
<li><code>registration.html</code> and <code>registration.txt</code></li>
<li><code>registration_success.html</code> and <code>registration_failure.html</code></li>
<li><code>add_threepid.html</code> and <code>add_threepid.txt</code></li>
<li><code>add_threepid_failure.html</code> and <code>add_threepid_success.html</code></li>
</ul>
<p>Synapse will expect these files to exist inside the configured template
directory, and <strong>will fail to start</strong> if they are absent.
To view the default templates, see <code>synapse/res/templates <https://github.com/matrix-org/synapse/tree/master/synapse/res/templates></code>_.</p>
will follow some time after that once SMS verification support lands in
Synapse.</p>
<p>Once delegated 3pid verification support has been disabled in the <code>vector.im</code> and
<code>matrix.org</code> identity servers, all Synapse versions that depend on those
instances will be unable to verify email and phone numbers through them. There
are no imminent plans to remove delegated 3pid verification from Sydent
generally. (Sydent is the identity server project that backs the <code>vector.im</code> and
<code>matrix.org</code> instances).</p>
<p>Email</p>
<pre><code>Following upgrade, to continue verifying email (e.g. as part of the
registration process), admins can either:-
* Configure Synapse to use an email server.
* Run or choose an identity server which allows delegated email verification
and delegate to it.
Configure SMTP in Synapse
+++++++++++++++++++++++++
To configure an SMTP server for Synapse, modify the configuration section
headed ``email``, and be sure to have at least the ``smtp_host, smtp_port``
and ``notif_from`` fields filled out.
You may also need to set ``smtp_user``, ``smtp_pass``, and
``require_transport_security``.
See the `sample configuration file <docs/sample_config.yaml>`_ for more details
on these settings.
Delegate email to an identity server
++++++++++++++++++++++++++++++++++++
Some admins will wish to continue using email verification as part of the
registration process, but will not immediately have an appropriate SMTP server
at hand.
To this end, we will continue to support email verification delegation via the
``vector.im`` and ``matrix.org`` identity servers for two months. Support for
delegated email verification will be disabled on Monday 2nd December.
The ``account_threepid_delegates`` dictionary defines whether the homeserver
should delegate an external server (typically an `identity server
<https://matrix.org/docs/spec/identity_service/r0.2.1>`_) to handle sending
confirmation messages via email and SMS.
So to delegate email verification, in ``homeserver.yaml``, set
``account_threepid_delegates.email`` to the base URL of an identity server. For
example:
.. code:: yaml
account_threepid_delegates:
email: https://example.com # Delegate email sending to example.com
Note that ``account_threepid_delegates.email`` replaces the deprecated
``email.trust_identity_server_for_password_resets``: if
``email.trust_identity_server_for_password_resets`` is set to ``true``, and
``account_threepid_delegates.email`` is not set, then the first entry in
``trusted_third_party_id_servers`` will be used as the
``account_threepid_delegate`` for email. This is to ensure compatibility with
existing Synapse installs that set up external server handling for these tasks
before v1.4.0. If ``email.trust_identity_server_for_password_resets`` is
``true`` and no trusted identity server domains are configured, Synapse will
report an error and refuse to start.
If ``email.trust_identity_server_for_password_resets`` is ``false`` or absent
and no ``email`` delegate is configured in ``account_threepid_delegates``,
then Synapse will send email verification messages itself, using the configured
SMTP server (see above).
that type.
Phone numbers
</code></pre>
<p>Synapse does not support phone-number verification itself, so the only way to
maintain the ability for users to add phone numbers to their accounts will be
by continuing to delegate phone number verification to the <code>matrix.org</code> and
<code>vector.im</code> identity servers (or another identity server that supports SMS
sending).</p>
<p>The <code>account_threepid_delegates</code> dictionary defines whether the homeserver
should delegate an external server (typically an <code>identity server <https://matrix.org/docs/spec/identity_service/r0.2.1></code>_) to handle sending
confirmation messages via email and SMS.</p>
<p>So to delegate phone number verification, in <code>homeserver.yaml</code>, set
<code>account_threepid_delegates.msisdn</code> to the base URL of an identity
server. For example:</p>
<p>.. code:: yaml</p>
<p>account_threepid_delegates:
msisdn: https://example.com # Delegate sms sending to example.com</p>
<p>The <code>matrix.org</code> and <code>vector.im</code> identity servers will continue to support
delegated phone number verification via SMS until such time as it is possible
for admins to configure their servers to perform phone number verification
directly. More details will follow in a future release.</p>
<h2id="rolling-back-to-v131"><aclass="header"href="#rolling-back-to-v131">Rolling back to v1.3.1</a></h2>
<p>If you encounter problems with v1.4.0, it should be possible to roll back to
v1.3.1, subject to the following:</p>
<ul>
<li>
<p>The 'room statistics' engine was heavily reworked in this release (see
<code>#5971 <https://github.com/matrix-org/synapse/pull/5971></code>_), including
significant changes to the database schema, which are not easily
reverted. This will cause the room statistics engine to stop updating when
you downgrade.</p>
<p>The room statistics are essentially unused in v1.3.1 (in future versions of
Synapse, they will be used to populate the room directory), so there should
be no loss of functionality. However, the statistics engine will write errors
to the logs, which can be avoided by setting the following in
<code>homeserver.yaml</code>:</p>
<p>.. code:: yaml</p>
<p>stats:
enabled: false</p>
<p>Don't forget to re-enable it when you upgrade again, in preparation for its
use in the room directory!</p>
</li>
</ul>
<h1id="upgrading-to-v120"><aclass="header"href="#upgrading-to-v120">Upgrading to v1.2.0</a></h1>
<p>Some counter metrics have been renamed, with the old names deprecated. See
<h1id="upgrading-to-v10"><aclass="header"href="#upgrading-to-v10">Upgrading to v1.0</a></h1>
<h2id="validation-of-tls-certificates"><aclass="header"href="#validation-of-tls-certificates">Validation of TLS certificates</a></h2>
<p>Synapse v1.0 is the first release to enforce
validation of TLS certificates for the federation API. It is therefore
essential that your certificates are correctly configured. See the <code>FAQ <docs/MSC1711_certificates_FAQ.md></code>_ for more information.</p>
<p>Note, v1.0 installations will also no longer be able to federate with servers
that have not correctly configured their certificates.</p>
<p>In rare cases, it may be desirable to disable certificate checking: for
example, it might be essential to be able to federate with a given legacy
server in a closed federation. This can be done in one of two ways:-</p>
<ul>
<li>Configure the global switch <code>federation_verify_certificates</code> to <code>false</code>.</li>
<li>Configure a whitelist of server domains to trust via <code>federation_certificate_verification_whitelist</code>.</li>
</ul>
<p>See the <code>sample configuration file <docs/sample_config.yaml></code>_
<p>Some new templates have been added to the default template directory for the purpose of the
homeserver sending its own password reset emails. If you have configured a custom
<code>template_dir</code> in your Synapse config, these files will need to be added.</p>
<p><code>password_reset.html</code> and <code>password_reset.txt</code> are HTML and plain text templates
respectively that contain the contents of what will be emailed to the user upon attempting to
reset their password via email. <code>password_reset_success.html</code> and
<code>password_reset_failure.html</code> are HTML files that the content of which (assuming no redirect
URL is set) will be shown to the user after they attempt to click the link in the email sent
to them.</p>
<h1id="upgrading-to-v0990"><aclass="header"href="#upgrading-to-v0990">Upgrading to v0.99.0</a></h1>
<p>Please be aware that, before Synapse v1.0 is released around March 2019, you
will need to replace any self-signed certificates with those verified by a
root CA. Information on how to do so can be found at <code>the ACME docs <docs/ACME.md></code>_.</p>
<p>For more information on configuring TLS certificates see the <code>FAQ <docs/MSC1711_certificates_FAQ.md></code>_.</p>
<h1id="upgrading-to-v0340"><aclass="header"href="#upgrading-to-v0340">Upgrading to v0.34.0</a></h1>
<ol>
<li>
<p>This release is the first to fully support Python 3. Synapse will now run on
Python versions 3.5, or 3.6 (as well as 2.7). We recommend switching to
Python 3, as it has been shown to give performance improvements.</p>
<p>For users who have installed Synapse into a virtualenv, we recommend doing
this by creating a new virtualenv. For example::</p>
<pre><code>virtualenv -p python3 ~/synapse/env3
source ~/synapse/env3/bin/activate
pip install matrix-synapse
</code></pre>
<p>You can then start synapse as normal, having activated the new virtualenv::</p>
<pre><code>cd ~/synapse
source env3/bin/activate
synctl start
</code></pre>
<p>Users who have installed from distribution packages should see the relevant
package documentation. See below for notes on Debian packages.</p>
<ul>
<li>
<p>When upgrading to Python 3, you <strong>must</strong> make sure that your log files are
configured as UTF-8, by adding <code>encoding: utf8</code> to the
<code>RotatingFileHandler</code> configuration (if you have one) in your
<code><server>.log.config</code> file. For example, if your <code>log.config</code> file
contains::</p>
<p>handlers:
file:
class: logging.handlers.RotatingFileHandler
formatter: precise
filename: homeserver.log
maxBytes: 104857600
backupCount: 10
filters: [context]
console:
class: logging.StreamHandler
formatter: precise
filters: [context]</p>
<p>Then you should update this to be::</p>
<p>handlers:
file:
class: logging.handlers.RotatingFileHandler
formatter: precise
filename: homeserver.log
maxBytes: 104857600
backupCount: 10
filters: [context]
encoding: utf8
console:
class: logging.StreamHandler
formatter: precise
filters: [context]</p>
<p>There is no need to revert this change if downgrading to Python 2.</p>
</li>
</ul>
<p>We are also making available Debian packages which will run Synapse on
Python 3. You can switch to these packages with <code>apt-get install matrix-synapse-py3</code>, however, please read <code>debian/NEWS <https://github.com/matrix-org/synapse/blob/release-v0.34.0/debian/NEWS></code>_
before doing so. The existing <code>matrix-synapse</code> packages will continue to
use Python 2 for the time being.</p>
</li>
<li>
<p>This release removes the <code>riot.im</code> from the default list of trusted
identity servers.</p>
<p>If <code>riot.im</code> is in your homeserver's list of
<code>trusted_third_party_id_servers</code>, you should remove it. It was added in
case a hypothetical future identity server was put there. If you don't
remove it, users may be unable to deactivate their accounts.</p>
</li>
<li>
<p>This release no longer installs the (unmaintained) Matrix Console web client
as part of the default installation. It is possible to re-enable it by
installing it separately and setting the <code>web_client_location</code> config
option, but please consider switching to another client.</p>
</li>
</ol>
<h1id="upgrading-to-v0337"><aclass="header"href="#upgrading-to-v0337">Upgrading to v0.33.7</a></h1>
<p>This release removes the example email notification templates from
<code>res/templates</code> (they are now internal to the python package). This should
only affect you if you (a) deploy your Synapse instance from a git checkout or
a github snapshot URL, and (b) have email notifications enabled.</p>
<p>If you have email notifications enabled, you should ensure that
<code>email.template_dir</code> is either configured to point at a directory where you
have installed customised templates, or leave it unset to use the default
templates.</p>
<h1id="upgrading-to-v0273"><aclass="header"href="#upgrading-to-v0273">Upgrading to v0.27.3</a></h1>
<p>This release expands the anonymous usage stats sent if the opt-in
<code>report_stats</code> configuration is set to <code>true</code>. We now capture RSS memory
and cpu use at a very coarse level. This requires administrators to install
the optional <code>psutil</code> python module.</p>
<p>We would appreciate it if you could assist by ensuring this module is available
and <code>report_stats</code> is enabled. This will let us see if performance changes to
synapse are having an impact to the general community.</p>
<h1id="upgrading-to-v0150"><aclass="header"href="#upgrading-to-v0150">Upgrading to v0.15.0</a></h1>
<p>If you want to use the new URL previewing API (/_matrix/media/r0/preview_url)
then you have to explicitly enable it in the config and update your dependencies
dependencies. See README.rst for details.</p>
<h1id="upgrading-to-v0110"><aclass="header"href="#upgrading-to-v0110">Upgrading to v0.11.0</a></h1>
<p>This release includes the option to send anonymous usage stats to matrix.org,
and requires that administrators explictly opt in or out by setting the
<code>report_stats</code> option to either <code>true</code> or <code>false</code>.</p>
<p>We would really appreciate it if you could help our project out by reporting
anonymized usage statistics from your homeserver. Only very basic aggregate
data (e.g. number of users) will be reported, but it helps us to track the
growth of the Matrix community, and helps us to make Matrix a success, as well
as to convince other networks that they should peer with us.</p>
<h1id="upgrading-to-v090"><aclass="header"href="#upgrading-to-v090">Upgrading to v0.9.0</a></h1>
<p>Application services have had a breaking API change in this version.</p>
<p>They can no longer register themselves with a home server using the AS HTTP API. This
decision was made because a compromised application service with free reign to register
any regex in effect grants full read/write access to the home server if a regex of <code>.*</code>
is used. An attack where a compromised AS re-registers itself with <code>.*</code> was deemed too
big of a security risk to ignore, and so the ability to register with the HS remotely has
been removed.</p>
<p>It has been replaced by specifying a list of application service registrations in