25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1246 lines
48 KiB

  1. Upgrading Synapse
  2. =================
  3. Before upgrading check if any special steps are required to upgrade from the
  4. version you currently have installed to the current version of Synapse. The extra
  5. instructions that may be required are listed later in this document.
  6. * Check that your versions of Python and PostgreSQL are still supported.
  7. Synapse follows upstream lifecycles for `Python`_ and `PostgreSQL`_, and
  8. removes support for versions which are no longer maintained.
  9. The website https://endoflife.date also offers convenient summaries.
  10. .. _Python: https://devguide.python.org/devcycle/#end-of-life-branches
  11. .. _PostgreSQL: https://www.postgresql.org/support/versioning/
  12. * If Synapse was installed using `prebuilt packages
  13. <INSTALL.md#prebuilt-packages>`_, you will need to follow the normal process
  14. for upgrading those packages.
  15. * If Synapse was installed from source, then:
  16. 1. Activate the virtualenv before upgrading. For example, if Synapse is
  17. installed in a virtualenv in ``~/synapse/env`` then run:
  18. .. code:: bash
  19. source ~/synapse/env/bin/activate
  20. 2. If Synapse was installed using pip then upgrade to the latest version by
  21. running:
  22. .. code:: bash
  23. pip install --upgrade matrix-synapse
  24. If Synapse was installed using git then upgrade to the latest version by
  25. running:
  26. .. code:: bash
  27. git pull
  28. pip install --upgrade .
  29. 3. Restart Synapse:
  30. .. code:: bash
  31. ./synctl restart
  32. To check whether your update was successful, you can check the running server
  33. version with:
  34. .. code:: bash
  35. # you may need to replace 'localhost:8008' if synapse is not configured
  36. # to listen on port 8008.
  37. curl http://localhost:8008/_synapse/admin/v1/server_version
  38. Rolling back to older versions
  39. ------------------------------
  40. Rolling back to previous releases can be difficult, due to database schema
  41. changes between releases. Where we have been able to test the rollback process,
  42. this will be noted below.
  43. In general, you will need to undo any changes made during the upgrade process,
  44. for example:
  45. * pip:
  46. .. code:: bash
  47. source env/bin/activate
  48. # replace `1.3.0` accordingly:
  49. pip install matrix-synapse==1.3.0
  50. * Debian:
  51. .. code:: bash
  52. # replace `1.3.0` and `stretch` accordingly:
  53. wget https://packages.matrix.org/debian/pool/main/m/matrix-synapse-py3/matrix-synapse-py3_1.3.0+stretch1_amd64.deb
  54. dpkg -i matrix-synapse-py3_1.3.0+stretch1_amd64.deb
  55. Upgrading to v1.32.0
  56. ====================
  57. Removal of old List Accounts Admin API
  58. --------------------------------------
  59. The deprecated v1 "list accounts" admin API (``GET /_synapse/admin/v1/users/<user_id>``) has been removed in this version.
  60. The `v2 list accounts API <https://github.com/matrix-org/synapse/blob/master/docs/admin_api/user_admin_api.rst#list-accounts>`_
  61. has been available since Synapse 1.7.0 (2019-12-13), and is accessible under ``GET /_synapse/admin/v2/users``.
  62. The deprecation of the old endpoint was announced with Synapse 1.28.0 (released on 2021-02-25).
  63. Upgrading to v1.29.0
  64. ====================
  65. Requirement for X-Forwarded-Proto header
  66. ----------------------------------------
  67. When using Synapse with a reverse proxy (in particular, when using the
  68. `x_forwarded` option on an HTTP listener), Synapse now expects to receive an
  69. `X-Forwarded-Proto` header on incoming HTTP requests. If it is not set, Synapse
  70. will log a warning on each received request.
  71. To avoid the warning, administrators using a reverse proxy should ensure that
  72. the reverse proxy sets `X-Forwarded-Proto` header to `https` or `http` to
  73. indicate the protocol used by the client.
  74. Synapse also requires the `Host` header to be preserved.
  75. See the `reverse proxy documentation <docs/reverse_proxy.md>`_, where the
  76. example configurations have been updated to show how to set these headers.
  77. (Users of `Caddy <https://caddyserver.com/>`_ are unaffected, since we believe it
  78. sets `X-Forwarded-Proto` by default.)
  79. Upgrading to v1.27.0
  80. ====================
  81. Changes to callback URI for OAuth2 / OpenID Connect and SAML2
  82. -------------------------------------------------------------
  83. This version changes the URI used for callbacks from OAuth2 and SAML2 identity providers:
  84. * If your server is configured for single sign-on via an OpenID Connect or OAuth2 identity
  85. provider, you will need to add ``[synapse public baseurl]/_synapse/client/oidc/callback``
  86. to the list of permitted "redirect URIs" at the identity provider.
  87. See `docs/openid.md <docs/openid.md>`_ for more information on setting up OpenID
  88. Connect.
  89. * If your server is configured for single sign-on via a SAML2 identity provider, you will
  90. need to add ``[synapse public baseurl]/_synapse/client/saml2/authn_response`` as a permitted
  91. "ACS location" (also known as "allowed callback URLs") at the identity provider.
  92. The "Issuer" in the "AuthnRequest" to the SAML2 identity provider is also updated to
  93. ``[synapse public baseurl]/_synapse/client/saml2/metadata.xml``. If your SAML2 identity
  94. provider uses this property to validate or otherwise identify Synapse, its configuration
  95. will need to be updated to use the new URL. Alternatively you could create a new, separate
  96. "EntityDescriptor" in your SAML2 identity provider with the new URLs and leave the URLs in
  97. the existing "EntityDescriptor" as they were.
  98. Changes to HTML templates
  99. -------------------------
  100. The HTML templates for SSO and email notifications now have `Jinja2's autoescape <https://jinja.palletsprojects.com/en/2.11.x/api/#autoescaping>`_
  101. enabled for files ending in ``.html``, ``.htm``, and ``.xml``. If you have customised
  102. these templates and see issues when viewing them you might need to update them.
  103. It is expected that most configurations will need no changes.
  104. If you have customised the templates *names* for these templates, it is recommended
  105. to verify they end in ``.html`` to ensure autoescape is enabled.
  106. The above applies to the following templates:
  107. * ``add_threepid.html``
  108. * ``add_threepid_failure.html``
  109. * ``add_threepid_success.html``
  110. * ``notice_expiry.html``
  111. * ``notice_expiry.html``
  112. * ``notif_mail.html`` (which, by default, includes ``room.html`` and ``notif.html``)
  113. * ``password_reset.html``
  114. * ``password_reset_confirmation.html``
  115. * ``password_reset_failure.html``
  116. * ``password_reset_success.html``
  117. * ``registration.html``
  118. * ``registration_failure.html``
  119. * ``registration_success.html``
  120. * ``sso_account_deactivated.html``
  121. * ``sso_auth_bad_user.html``
  122. * ``sso_auth_confirm.html``
  123. * ``sso_auth_success.html``
  124. * ``sso_error.html``
  125. * ``sso_login_idp_picker.html``
  126. * ``sso_redirect_confirm.html``
  127. Upgrading to v1.26.0
  128. ====================
  129. Rolling back to v1.25.0 after a failed upgrade
  130. ----------------------------------------------
  131. v1.26.0 includes a lot of large changes. If something problematic occurs, you
  132. may want to roll-back to a previous version of Synapse. Because v1.26.0 also
  133. includes a new database schema version, reverting that version is also required
  134. alongside the generic rollback instructions mentioned above. In short, to roll
  135. back to v1.25.0 you need to:
  136. 1. Stop the server
  137. 2. Decrease the schema version in the database:
  138. .. code:: sql
  139. UPDATE schema_version SET version = 58;
  140. 3. Delete the ignored users & chain cover data:
  141. .. code:: sql
  142. DROP TABLE IF EXISTS ignored_users;
  143. UPDATE rooms SET has_auth_chain_index = false;
  144. For PostgreSQL run:
  145. .. code:: sql
  146. TRUNCATE event_auth_chain_links;
  147. TRUNCATE event_auth_chains;
  148. For SQLite run:
  149. .. code:: sql
  150. DELETE FROM event_auth_chain_links;
  151. DELETE FROM event_auth_chains;
  152. 4. Mark the deltas as not run (so they will re-run on upgrade).
  153. .. code:: sql
  154. DELETE FROM applied_schema_deltas WHERE version = 59 AND file = "59/01ignored_user.py";
  155. DELETE FROM applied_schema_deltas WHERE version = 59 AND file = "59/06chain_cover_index.sql";
  156. 5. Downgrade Synapse by following the instructions for your installation method
  157. in the "Rolling back to older versions" section above.
  158. Upgrading to v1.25.0
  159. ====================
  160. Last release supporting Python 3.5
  161. ----------------------------------
  162. This is the last release of Synapse which guarantees support with Python 3.5,
  163. which passed its upstream End of Life date several months ago.
  164. We will attempt to maintain support through March 2021, but without guarantees.
  165. In the future, Synapse will follow upstream schedules for ending support of
  166. older versions of Python and PostgreSQL. Please upgrade to at least Python 3.6
  167. and PostgreSQL 9.6 as soon as possible.
  168. Blacklisting IP ranges
  169. ----------------------
  170. Synapse v1.25.0 includes new settings, ``ip_range_blacklist`` and
  171. ``ip_range_whitelist``, for controlling outgoing requests from Synapse for federation,
  172. identity servers, push, and for checking key validity for third-party invite events.
  173. The previous setting, ``federation_ip_range_blacklist``, is deprecated. The new
  174. ``ip_range_blacklist`` defaults to private IP ranges if it is not defined.
  175. If you have never customised ``federation_ip_range_blacklist`` it is recommended
  176. that you remove that setting.
  177. If you have customised ``federation_ip_range_blacklist`` you should update the
  178. setting name to ``ip_range_blacklist``.
  179. If you have a custom push server that is reached via private IP space you may
  180. need to customise ``ip_range_blacklist`` or ``ip_range_whitelist``.
  181. Upgrading to v1.24.0
  182. ====================
  183. Custom OpenID Connect mapping provider breaking change
  184. ------------------------------------------------------
  185. This release allows the OpenID Connect mapping provider to perform normalisation
  186. of the localpart of the Matrix ID. This allows for the mapping provider to
  187. specify different algorithms, instead of the [default way](https://matrix.org/docs/spec/appendices#mapping-from-other-character-sets).
  188. If your Synapse configuration uses a custom mapping provider
  189. (`oidc_config.user_mapping_provider.module` is specified and not equal to
  190. `synapse.handlers.oidc_handler.JinjaOidcMappingProvider`) then you *must* ensure
  191. that `map_user_attributes` of the mapping provider performs some normalisation
  192. of the `localpart` returned. To match previous behaviour you can use the
  193. `map_username_to_mxid_localpart` function provided by Synapse. An example is
  194. shown below:
  195. .. code-block:: python
  196. from synapse.types import map_username_to_mxid_localpart
  197. class MyMappingProvider:
  198. def map_user_attributes(self, userinfo, token):
  199. # ... your custom logic ...
  200. sso_user_id = ...
  201. localpart = map_username_to_mxid_localpart(sso_user_id)
  202. return {"localpart": localpart}
  203. Removal historical Synapse Admin API
  204. ------------------------------------
  205. Historically, the Synapse Admin API has been accessible under:
  206. * ``/_matrix/client/api/v1/admin``
  207. * ``/_matrix/client/unstable/admin``
  208. * ``/_matrix/client/r0/admin``
  209. * ``/_synapse/admin/v1``
  210. The endpoints with ``/_matrix/client/*`` prefixes have been removed as of v1.24.0.
  211. The Admin API is now only accessible under:
  212. * ``/_synapse/admin/v1``
  213. The only exception is the `/admin/whois` endpoint, which is
  214. `also available via the client-server API <https://matrix.org/docs/spec/client_server/r0.6.1#get-matrix-client-r0-admin-whois-userid>`_.
  215. The deprecation of the old endpoints was announced with Synapse 1.20.0 (released
  216. on 2020-09-22) and makes it easier for homeserver admins to lock down external
  217. access to the Admin API endpoints.
  218. Upgrading to v1.23.0
  219. ====================
  220. Structured logging configuration breaking changes
  221. -------------------------------------------------
  222. This release deprecates use of the ``structured: true`` logging configuration for
  223. structured logging. If your logging configuration contains ``structured: true``
  224. then it should be modified based on the `structured logging documentation
  225. <https://github.com/matrix-org/synapse/blob/master/docs/structured_logging.md>`_.
  226. The ``structured`` and ``drains`` logging options are now deprecated and should
  227. be replaced by standard logging configuration of ``handlers`` and ``formatters``.
  228. A future will release of Synapse will make using ``structured: true`` an error.
  229. Upgrading to v1.22.0
  230. ====================
  231. ThirdPartyEventRules breaking changes
  232. -------------------------------------
  233. This release introduces a backwards-incompatible change to modules making use of
  234. ``ThirdPartyEventRules`` in Synapse. If you make use of a module defined under the
  235. ``third_party_event_rules`` config option, please make sure it is updated to handle
  236. the below change:
  237. The ``http_client`` argument is no longer passed to modules as they are initialised. Instead,
  238. modules are expected to make use of the ``http_client`` property on the ``ModuleApi`` class.
  239. Modules are now passed a ``module_api`` argument during initialisation, which is an instance of
  240. ``ModuleApi``. ``ModuleApi`` instances have a ``http_client`` property which acts the same as
  241. the ``http_client`` argument previously passed to ``ThirdPartyEventRules`` modules.
  242. Upgrading to v1.21.0
  243. ====================
  244. Forwarding ``/_synapse/client`` through your reverse proxy
  245. ----------------------------------------------------------
  246. The `reverse proxy documentation
  247. <https://github.com/matrix-org/synapse/blob/develop/docs/reverse_proxy.md>`_ has been updated
  248. to include reverse proxy directives for ``/_synapse/client/*`` endpoints. As the user password
  249. reset flow now uses endpoints under this prefix, **you must update your reverse proxy
  250. configurations for user password reset to work**.
  251. Additionally, note that the `Synapse worker documentation
  252. <https://github.com/matrix-org/synapse/blob/develop/docs/workers.md>`_ has been updated to
  253. state that the ``/_synapse/client/password_reset/email/submit_token`` endpoint can be handled
  254. by all workers. If you make use of Synapse's worker feature, please update your reverse proxy
  255. configuration to reflect this change.
  256. New HTML templates
  257. ------------------
  258. A new HTML template,
  259. `password_reset_confirmation.html <https://github.com/matrix-org/synapse/blob/develop/synapse/res/templates/password_reset_confirmation.html>`_,
  260. has been added to the ``synapse/res/templates`` directory. If you are using a
  261. custom template directory, you may want to copy the template over and modify it.
  262. Note that as of v1.20.0, templates do not need to be included in custom template
  263. directories for Synapse to start. The default templates will be used if a custom
  264. template cannot be found.
  265. This page will appear to the user after clicking a password reset link that has
  266. been emailed to them.
  267. To complete password reset, the page must include a way to make a `POST`
  268. request to
  269. ``/_synapse/client/password_reset/{medium}/submit_token``
  270. with the query parameters from the original link, presented as a URL-encoded form. See the file
  271. itself for more details.
  272. Updated Single Sign-on HTML Templates
  273. -------------------------------------
  274. The ``saml_error.html`` template was removed from Synapse and replaced with the
  275. ``sso_error.html`` template. If your Synapse is configured to use SAML and a
  276. custom ``sso_redirect_confirm_template_dir`` configuration then any customisations
  277. of the ``saml_error.html`` template will need to be merged into the ``sso_error.html``
  278. template. These templates are similar, but the parameters are slightly different:
  279. * The ``msg`` parameter should be renamed to ``error_description``.
  280. * There is no longer a ``code`` parameter for the response code.
  281. * A string ``error`` parameter is available that includes a short hint of why a
  282. user is seeing the error page.
  283. Upgrading to v1.18.0
  284. ====================
  285. Docker `-py3` suffix will be removed in future versions
  286. -------------------------------------------------------
  287. From 10th August 2020, we will no longer publish Docker images with the `-py3` tag suffix. The images tagged with the `-py3` suffix have been identical to the non-suffixed tags since release 0.99.0, and the suffix is obsolete.
  288. On 10th August, we will remove the `latest-py3` tag. Existing per-release tags (such as `v1.18.0-py3`) will not be removed, but no new `-py3` tags will be added.
  289. Scripts relying on the `-py3` suffix will need to be updated.
  290. Redis replication is now recommended in lieu of TCP replication
  291. ---------------------------------------------------------------
  292. When setting up worker processes, we now recommend the use of a Redis server for replication. **The old direct TCP connection method is deprecated and will be removed in a future release.**
  293. See `docs/workers.md <docs/workers.md>`_ for more details.
  294. Upgrading to v1.14.0
  295. ====================
  296. This version includes a database update which is run as part of the upgrade,
  297. and which may take a couple of minutes in the case of a large server. Synapse
  298. will not respond to HTTP requests while this update is taking place.
  299. Upgrading to v1.13.0
  300. ====================
  301. Incorrect database migration in old synapse versions
  302. ----------------------------------------------------
  303. A bug was introduced in Synapse 1.4.0 which could cause the room directory to
  304. be incomplete or empty if Synapse was upgraded directly from v1.2.1 or
  305. earlier, to versions between v1.4.0 and v1.12.x.
  306. This will *not* be a problem for Synapse installations which were:
  307. * created at v1.4.0 or later,
  308. * upgraded via v1.3.x, or
  309. * upgraded straight from v1.2.1 or earlier to v1.13.0 or later.
  310. If completeness of the room directory is a concern, installations which are
  311. affected can be repaired as follows:
  312. 1. Run the following sql from a `psql` or `sqlite3` console:
  313. .. code:: sql
  314. INSERT INTO background_updates (update_name, progress_json, depends_on) VALUES
  315. ('populate_stats_process_rooms', '{}', 'current_state_events_membership');
  316. INSERT INTO background_updates (update_name, progress_json, depends_on) VALUES
  317. ('populate_stats_process_users', '{}', 'populate_stats_process_rooms');
  318. 2. Restart synapse.
  319. New Single Sign-on HTML Templates
  320. ---------------------------------
  321. New templates (``sso_auth_confirm.html``, ``sso_auth_success.html``, and
  322. ``sso_account_deactivated.html``) were added to Synapse. If your Synapse is
  323. configured to use SSO and a custom ``sso_redirect_confirm_template_dir``
  324. configuration then these templates will need to be copied from
  325. `synapse/res/templates <synapse/res/templates>`_ into that directory.
  326. Synapse SSO Plugins Method Deprecation
  327. --------------------------------------
  328. Plugins using the ``complete_sso_login`` method of
  329. ``synapse.module_api.ModuleApi`` should update to using the async/await
  330. version ``complete_sso_login_async`` which includes additional checks. The
  331. non-async version is considered deprecated.
  332. Rolling back to v1.12.4 after a failed upgrade
  333. ----------------------------------------------
  334. v1.13.0 includes a lot of large changes. If something problematic occurs, you
  335. may want to roll-back to a previous version of Synapse. Because v1.13.0 also
  336. includes a new database schema version, reverting that version is also required
  337. alongside the generic rollback instructions mentioned above. In short, to roll
  338. back to v1.12.4 you need to:
  339. 1. Stop the server
  340. 2. Decrease the schema version in the database:
  341. .. code:: sql
  342. UPDATE schema_version SET version = 57;
  343. 3. Downgrade Synapse by following the instructions for your installation method
  344. in the "Rolling back to older versions" section above.
  345. Upgrading to v1.12.0
  346. ====================
  347. This version includes a database update which is run as part of the upgrade,
  348. and which may take some time (several hours in the case of a large
  349. server). Synapse will not respond to HTTP requests while this update is taking
  350. place.
  351. This is only likely to be a problem in the case of a server which is
  352. participating in many rooms.
  353. 0. As with all upgrades, it is recommended that you have a recent backup of
  354. your database which can be used for recovery in the event of any problems.
  355. 1. As an initial check to see if you will be affected, you can try running the
  356. following query from the `psql` or `sqlite3` console. It is safe to run it
  357. while Synapse is still running.
  358. .. code:: sql
  359. SELECT MAX(q.v) FROM (
  360. SELECT (
  361. SELECT ej.json AS v
  362. FROM state_events se INNER JOIN event_json ej USING (event_id)
  363. WHERE se.room_id=rooms.room_id AND se.type='m.room.create' AND se.state_key=''
  364. LIMIT 1
  365. ) FROM rooms WHERE rooms.room_version IS NULL
  366. ) q;
  367. This query will take about the same amount of time as the upgrade process: ie,
  368. if it takes 5 minutes, then it is likely that Synapse will be unresponsive for
  369. 5 minutes during the upgrade.
  370. If you consider an outage of this duration to be acceptable, no further
  371. action is necessary and you can simply start Synapse 1.12.0.
  372. If you would prefer to reduce the downtime, continue with the steps below.
  373. 2. The easiest workaround for this issue is to manually
  374. create a new index before upgrading. On PostgreSQL, his can be done as follows:
  375. .. code:: sql
  376. CREATE INDEX CONCURRENTLY tmp_upgrade_1_12_0_index
  377. ON state_events(room_id) WHERE type = 'm.room.create';
  378. The above query may take some time, but is also safe to run while Synapse is
  379. running.
  380. We assume that no SQLite users have databases large enough to be
  381. affected. If you *are* affected, you can run a similar query, omitting the
  382. ``CONCURRENTLY`` keyword. Note however that this operation may in itself cause
  383. Synapse to stop running for some time. Synapse admins are reminded that
  384. `SQLite is not recommended for use outside a test
  385. environment <https://github.com/matrix-org/synapse/blob/master/README.rst#using-postgresql>`_.
  386. 3. Once the index has been created, the ``SELECT`` query in step 1 above should
  387. complete quickly. It is therefore safe to upgrade to Synapse 1.12.0.
  388. 4. Once Synapse 1.12.0 has successfully started and is responding to HTTP
  389. requests, the temporary index can be removed:
  390. .. code:: sql
  391. DROP INDEX tmp_upgrade_1_12_0_index;
  392. Upgrading to v1.10.0
  393. ====================
  394. Synapse will now log a warning on start up if used with a PostgreSQL database
  395. that has a non-recommended locale set.
  396. See `docs/postgres.md <docs/postgres.md>`_ for details.
  397. Upgrading to v1.8.0
  398. ===================
  399. Specifying a ``log_file`` config option will now cause Synapse to refuse to
  400. start, and should be replaced by with the ``log_config`` option. Support for
  401. the ``log_file`` option was removed in v1.3.0 and has since had no effect.
  402. Upgrading to v1.7.0
  403. ===================
  404. In an attempt to configure Synapse in a privacy preserving way, the default
  405. behaviours of ``allow_public_rooms_without_auth`` and
  406. ``allow_public_rooms_over_federation`` have been inverted. This means that by
  407. default, only authenticated users querying the Client/Server API will be able
  408. to query the room directory, and relatedly that the server will not share
  409. room directory information with other servers over federation.
  410. If your installation does not explicitly set these settings one way or the other
  411. and you want either setting to be ``true`` then it will necessary to update
  412. your homeserver configuration file accordingly.
  413. For more details on the surrounding context see our `explainer
  414. <https://matrix.org/blog/2019/11/09/avoiding-unwelcome-visitors-on-private-matrix-servers>`_.
  415. Upgrading to v1.5.0
  416. ===================
  417. This release includes a database migration which may take several minutes to
  418. complete if there are a large number (more than a million or so) of entries in
  419. the ``devices`` table. This is only likely to a be a problem on very large
  420. installations.
  421. Upgrading to v1.4.0
  422. ===================
  423. New custom templates
  424. --------------------
  425. If you have configured a custom template directory with the
  426. ``email.template_dir`` option, be aware that there are new templates regarding
  427. registration and threepid management (see below) that must be included.
  428. * ``registration.html`` and ``registration.txt``
  429. * ``registration_success.html`` and ``registration_failure.html``
  430. * ``add_threepid.html`` and ``add_threepid.txt``
  431. * ``add_threepid_failure.html`` and ``add_threepid_success.html``
  432. Synapse will expect these files to exist inside the configured template
  433. directory, and **will fail to start** if they are absent.
  434. To view the default templates, see `synapse/res/templates
  435. <https://github.com/matrix-org/synapse/tree/master/synapse/res/templates>`_.
  436. 3pid verification changes
  437. -------------------------
  438. **Note: As of this release, users will be unable to add phone numbers or email
  439. addresses to their accounts, without changes to the Synapse configuration. This
  440. includes adding an email address during registration.**
  441. It is possible for a user to associate an email address or phone number
  442. with their account, for a number of reasons:
  443. * for use when logging in, as an alternative to the user id.
  444. * in the case of email, as an alternative contact to help with account recovery.
  445. * in the case of email, to receive notifications of missed messages.
  446. Before an email address or phone number can be added to a user's account,
  447. or before such an address is used to carry out a password-reset, Synapse must
  448. confirm the operation with the owner of the email address or phone number.
  449. It does this by sending an email or text giving the user a link or token to confirm
  450. receipt. This process is known as '3pid verification'. ('3pid', or 'threepid',
  451. stands for third-party identifier, and we use it to refer to external
  452. identifiers such as email addresses and phone numbers.)
  453. Previous versions of Synapse delegated the task of 3pid verification to an
  454. identity server by default. In most cases this server is ``vector.im`` or
  455. ``matrix.org``.
  456. In Synapse 1.4.0, for security and privacy reasons, the homeserver will no
  457. longer delegate this task to an identity server by default. Instead,
  458. the server administrator will need to explicitly decide how they would like the
  459. verification messages to be sent.
  460. In the medium term, the ``vector.im`` and ``matrix.org`` identity servers will
  461. disable support for delegated 3pid verification entirely. However, in order to
  462. ease the transition, they will retain the capability for a limited
  463. period. Delegated email verification will be disabled on Monday 2nd December
  464. 2019 (giving roughly 2 months notice). Disabling delegated SMS verification
  465. will follow some time after that once SMS verification support lands in
  466. Synapse.
  467. Once delegated 3pid verification support has been disabled in the ``vector.im`` and
  468. ``matrix.org`` identity servers, all Synapse versions that depend on those
  469. instances will be unable to verify email and phone numbers through them. There
  470. are no imminent plans to remove delegated 3pid verification from Sydent
  471. generally. (Sydent is the identity server project that backs the ``vector.im`` and
  472. ``matrix.org`` instances).
  473. Email
  474. ~~~~~
  475. Following upgrade, to continue verifying email (e.g. as part of the
  476. registration process), admins can either:-
  477. * Configure Synapse to use an email server.
  478. * Run or choose an identity server which allows delegated email verification
  479. and delegate to it.
  480. Configure SMTP in Synapse
  481. +++++++++++++++++++++++++
  482. To configure an SMTP server for Synapse, modify the configuration section
  483. headed ``email``, and be sure to have at least the ``smtp_host, smtp_port``
  484. and ``notif_from`` fields filled out.
  485. You may also need to set ``smtp_user``, ``smtp_pass``, and
  486. ``require_transport_security``.
  487. See the `sample configuration file <docs/sample_config.yaml>`_ for more details
  488. on these settings.
  489. Delegate email to an identity server
  490. ++++++++++++++++++++++++++++++++++++
  491. Some admins will wish to continue using email verification as part of the
  492. registration process, but will not immediately have an appropriate SMTP server
  493. at hand.
  494. To this end, we will continue to support email verification delegation via the
  495. ``vector.im`` and ``matrix.org`` identity servers for two months. Support for
  496. delegated email verification will be disabled on Monday 2nd December.
  497. The ``account_threepid_delegates`` dictionary defines whether the homeserver
  498. should delegate an external server (typically an `identity server
  499. <https://matrix.org/docs/spec/identity_service/r0.2.1>`_) to handle sending
  500. confirmation messages via email and SMS.
  501. So to delegate email verification, in ``homeserver.yaml``, set
  502. ``account_threepid_delegates.email`` to the base URL of an identity server. For
  503. example:
  504. .. code:: yaml
  505. account_threepid_delegates:
  506. email: https://example.com # Delegate email sending to example.com
  507. Note that ``account_threepid_delegates.email`` replaces the deprecated
  508. ``email.trust_identity_server_for_password_resets``: if
  509. ``email.trust_identity_server_for_password_resets`` is set to ``true``, and
  510. ``account_threepid_delegates.email`` is not set, then the first entry in
  511. ``trusted_third_party_id_servers`` will be used as the
  512. ``account_threepid_delegate`` for email. This is to ensure compatibility with
  513. existing Synapse installs that set up external server handling for these tasks
  514. before v1.4.0. If ``email.trust_identity_server_for_password_resets`` is
  515. ``true`` and no trusted identity server domains are configured, Synapse will
  516. report an error and refuse to start.
  517. If ``email.trust_identity_server_for_password_resets`` is ``false`` or absent
  518. and no ``email`` delegate is configured in ``account_threepid_delegates``,
  519. then Synapse will send email verification messages itself, using the configured
  520. SMTP server (see above).
  521. that type.
  522. Phone numbers
  523. ~~~~~~~~~~~~~
  524. Synapse does not support phone-number verification itself, so the only way to
  525. maintain the ability for users to add phone numbers to their accounts will be
  526. by continuing to delegate phone number verification to the ``matrix.org`` and
  527. ``vector.im`` identity servers (or another identity server that supports SMS
  528. sending).
  529. The ``account_threepid_delegates`` dictionary defines whether the homeserver
  530. should delegate an external server (typically an `identity server
  531. <https://matrix.org/docs/spec/identity_service/r0.2.1>`_) to handle sending
  532. confirmation messages via email and SMS.
  533. So to delegate phone number verification, in ``homeserver.yaml``, set
  534. ``account_threepid_delegates.msisdn`` to the base URL of an identity
  535. server. For example:
  536. .. code:: yaml
  537. account_threepid_delegates:
  538. msisdn: https://example.com # Delegate sms sending to example.com
  539. The ``matrix.org`` and ``vector.im`` identity servers will continue to support
  540. delegated phone number verification via SMS until such time as it is possible
  541. for admins to configure their servers to perform phone number verification
  542. directly. More details will follow in a future release.
  543. Rolling back to v1.3.1
  544. ----------------------
  545. If you encounter problems with v1.4.0, it should be possible to roll back to
  546. v1.3.1, subject to the following:
  547. * The 'room statistics' engine was heavily reworked in this release (see
  548. `#5971 <https://github.com/matrix-org/synapse/pull/5971>`_), including
  549. significant changes to the database schema, which are not easily
  550. reverted. This will cause the room statistics engine to stop updating when
  551. you downgrade.
  552. The room statistics are essentially unused in v1.3.1 (in future versions of
  553. Synapse, they will be used to populate the room directory), so there should
  554. be no loss of functionality. However, the statistics engine will write errors
  555. to the logs, which can be avoided by setting the following in
  556. `homeserver.yaml`:
  557. .. code:: yaml
  558. stats:
  559. enabled: false
  560. Don't forget to re-enable it when you upgrade again, in preparation for its
  561. use in the room directory!
  562. Upgrading to v1.2.0
  563. ===================
  564. Some counter metrics have been renamed, with the old names deprecated. See
  565. `the metrics documentation <docs/metrics-howto.md#renaming-of-metrics--deprecation-of-old-names-in-12>`_
  566. for details.
  567. Upgrading to v1.1.0
  568. ===================
  569. Synapse v1.1.0 removes support for older Python and PostgreSQL versions, as
  570. outlined in `our deprecation notice <https://matrix.org/blog/2019/04/08/synapse-deprecating-postgres-9-4-and-python-2-x>`_.
  571. Minimum Python Version
  572. ----------------------
  573. Synapse v1.1.0 has a minimum Python requirement of Python 3.5. Python 3.6 or
  574. Python 3.7 are recommended as they have improved internal string handling,
  575. significantly reducing memory usage.
  576. If you use current versions of the Matrix.org-distributed Debian packages or
  577. Docker images, action is not required.
  578. If you install Synapse in a Python virtual environment, please see "Upgrading to
  579. v0.34.0" for notes on setting up a new virtualenv under Python 3.
  580. Minimum PostgreSQL Version
  581. --------------------------
  582. If using PostgreSQL under Synapse, you will need to use PostgreSQL 9.5 or above.
  583. Please see the
  584. `PostgreSQL documentation <https://www.postgresql.org/docs/11/upgrading.html>`_
  585. for more details on upgrading your database.
  586. Upgrading to v1.0
  587. =================
  588. Validation of TLS certificates
  589. ------------------------------
  590. Synapse v1.0 is the first release to enforce
  591. validation of TLS certificates for the federation API. It is therefore
  592. essential that your certificates are correctly configured. See the `FAQ
  593. <docs/MSC1711_certificates_FAQ.md>`_ for more information.
  594. Note, v1.0 installations will also no longer be able to federate with servers
  595. that have not correctly configured their certificates.
  596. In rare cases, it may be desirable to disable certificate checking: for
  597. example, it might be essential to be able to federate with a given legacy
  598. server in a closed federation. This can be done in one of two ways:-
  599. * Configure the global switch ``federation_verify_certificates`` to ``false``.
  600. * Configure a whitelist of server domains to trust via ``federation_certificate_verification_whitelist``.
  601. See the `sample configuration file <docs/sample_config.yaml>`_
  602. for more details on these settings.
  603. Email
  604. -----
  605. When a user requests a password reset, Synapse will send an email to the
  606. user to confirm the request.
  607. Previous versions of Synapse delegated the job of sending this email to an
  608. identity server. If the identity server was somehow malicious or became
  609. compromised, it would be theoretically possible to hijack an account through
  610. this means.
  611. Therefore, by default, Synapse v1.0 will send the confirmation email itself. If
  612. Synapse is not configured with an SMTP server, password reset via email will be
  613. disabled.
  614. To configure an SMTP server for Synapse, modify the configuration section
  615. headed ``email``, and be sure to have at least the ``smtp_host``, ``smtp_port``
  616. and ``notif_from`` fields filled out. You may also need to set ``smtp_user``,
  617. ``smtp_pass``, and ``require_transport_security``.
  618. If you are absolutely certain that you wish to continue using an identity
  619. server for password resets, set ``trust_identity_server_for_password_resets`` to ``true``.
  620. See the `sample configuration file <docs/sample_config.yaml>`_
  621. for more details on these settings.
  622. New email templates
  623. ---------------
  624. Some new templates have been added to the default template directory for the purpose of the
  625. homeserver sending its own password reset emails. If you have configured a custom
  626. ``template_dir`` in your Synapse config, these files will need to be added.
  627. ``password_reset.html`` and ``password_reset.txt`` are HTML and plain text templates
  628. respectively that contain the contents of what will be emailed to the user upon attempting to
  629. reset their password via email. ``password_reset_success.html`` and
  630. ``password_reset_failure.html`` are HTML files that the content of which (assuming no redirect
  631. URL is set) will be shown to the user after they attempt to click the link in the email sent
  632. to them.
  633. Upgrading to v0.99.0
  634. ====================
  635. Please be aware that, before Synapse v1.0 is released around March 2019, you
  636. will need to replace any self-signed certificates with those verified by a
  637. root CA. Information on how to do so can be found at `the ACME docs
  638. <docs/ACME.md>`_.
  639. For more information on configuring TLS certificates see the `FAQ <docs/MSC1711_certificates_FAQ.md>`_.
  640. Upgrading to v0.34.0
  641. ====================
  642. 1. This release is the first to fully support Python 3. Synapse will now run on
  643. Python versions 3.5, or 3.6 (as well as 2.7). We recommend switching to
  644. Python 3, as it has been shown to give performance improvements.
  645. For users who have installed Synapse into a virtualenv, we recommend doing
  646. this by creating a new virtualenv. For example::
  647. virtualenv -p python3 ~/synapse/env3
  648. source ~/synapse/env3/bin/activate
  649. pip install matrix-synapse
  650. You can then start synapse as normal, having activated the new virtualenv::
  651. cd ~/synapse
  652. source env3/bin/activate
  653. synctl start
  654. Users who have installed from distribution packages should see the relevant
  655. package documentation. See below for notes on Debian packages.
  656. * When upgrading to Python 3, you **must** make sure that your log files are
  657. configured as UTF-8, by adding ``encoding: utf8`` to the
  658. ``RotatingFileHandler`` configuration (if you have one) in your
  659. ``<server>.log.config`` file. For example, if your ``log.config`` file
  660. contains::
  661. handlers:
  662. file:
  663. class: logging.handlers.RotatingFileHandler
  664. formatter: precise
  665. filename: homeserver.log
  666. maxBytes: 104857600
  667. backupCount: 10
  668. filters: [context]
  669. console:
  670. class: logging.StreamHandler
  671. formatter: precise
  672. filters: [context]
  673. Then you should update this to be::
  674. handlers:
  675. file:
  676. class: logging.handlers.RotatingFileHandler
  677. formatter: precise
  678. filename: homeserver.log
  679. maxBytes: 104857600
  680. backupCount: 10
  681. filters: [context]
  682. encoding: utf8
  683. console:
  684. class: logging.StreamHandler
  685. formatter: precise
  686. filters: [context]
  687. There is no need to revert this change if downgrading to Python 2.
  688. We are also making available Debian packages which will run Synapse on
  689. Python 3. You can switch to these packages with ``apt-get install
  690. matrix-synapse-py3``, however, please read `debian/NEWS
  691. <https://github.com/matrix-org/synapse/blob/release-v0.34.0/debian/NEWS>`_
  692. before doing so. The existing ``matrix-synapse`` packages will continue to
  693. use Python 2 for the time being.
  694. 2. This release removes the ``riot.im`` from the default list of trusted
  695. identity servers.
  696. If ``riot.im`` is in your homeserver's list of
  697. ``trusted_third_party_id_servers``, you should remove it. It was added in
  698. case a hypothetical future identity server was put there. If you don't
  699. remove it, users may be unable to deactivate their accounts.
  700. 3. This release no longer installs the (unmaintained) Matrix Console web client
  701. as part of the default installation. It is possible to re-enable it by
  702. installing it separately and setting the ``web_client_location`` config
  703. option, but please consider switching to another client.
  704. Upgrading to v0.33.7
  705. ====================
  706. This release removes the example email notification templates from
  707. ``res/templates`` (they are now internal to the python package). This should
  708. only affect you if you (a) deploy your Synapse instance from a git checkout or
  709. a github snapshot URL, and (b) have email notifications enabled.
  710. If you have email notifications enabled, you should ensure that
  711. ``email.template_dir`` is either configured to point at a directory where you
  712. have installed customised templates, or leave it unset to use the default
  713. templates.
  714. Upgrading to v0.27.3
  715. ====================
  716. This release expands the anonymous usage stats sent if the opt-in
  717. ``report_stats`` configuration is set to ``true``. We now capture RSS memory
  718. and cpu use at a very coarse level. This requires administrators to install
  719. the optional ``psutil`` python module.
  720. We would appreciate it if you could assist by ensuring this module is available
  721. and ``report_stats`` is enabled. This will let us see if performance changes to
  722. synapse are having an impact to the general community.
  723. Upgrading to v0.15.0
  724. ====================
  725. If you want to use the new URL previewing API (/_matrix/media/r0/preview_url)
  726. then you have to explicitly enable it in the config and update your dependencies
  727. dependencies. See README.rst for details.
  728. Upgrading to v0.11.0
  729. ====================
  730. This release includes the option to send anonymous usage stats to matrix.org,
  731. and requires that administrators explictly opt in or out by setting the
  732. ``report_stats`` option to either ``true`` or ``false``.
  733. We would really appreciate it if you could help our project out by reporting
  734. anonymized usage statistics from your homeserver. Only very basic aggregate
  735. data (e.g. number of users) will be reported, but it helps us to track the
  736. growth of the Matrix community, and helps us to make Matrix a success, as well
  737. as to convince other networks that they should peer with us.
  738. Upgrading to v0.9.0
  739. ===================
  740. Application services have had a breaking API change in this version.
  741. They can no longer register themselves with a home server using the AS HTTP API. This
  742. decision was made because a compromised application service with free reign to register
  743. any regex in effect grants full read/write access to the home server if a regex of ``.*``
  744. is used. An attack where a compromised AS re-registers itself with ``.*`` was deemed too
  745. big of a security risk to ignore, and so the ability to register with the HS remotely has
  746. been removed.
  747. It has been replaced by specifying a list of application service registrations in
  748. ``homeserver.yaml``::
  749. app_service_config_files: ["registration-01.yaml", "registration-02.yaml"]
  750. Where ``registration-01.yaml`` looks like::
  751. url: <String> # e.g. "https://my.application.service.com"
  752. as_token: <String>
  753. hs_token: <String>
  754. sender_localpart: <String> # This is a new field which denotes the user_id localpart when using the AS token
  755. namespaces:
  756. users:
  757. - exclusive: <Boolean>
  758. regex: <String> # e.g. "@prefix_.*"
  759. aliases:
  760. - exclusive: <Boolean>
  761. regex: <String>
  762. rooms:
  763. - exclusive: <Boolean>
  764. regex: <String>
  765. Upgrading to v0.8.0
  766. ===================
  767. Servers which use captchas will need to add their public key to::
  768. static/client/register/register_config.js
  769. window.matrixRegistrationConfig = {
  770. recaptcha_public_key: "YOUR_PUBLIC_KEY"
  771. };
  772. This is required in order to support registration fallback (typically used on
  773. mobile devices).
  774. Upgrading to v0.7.0
  775. ===================
  776. New dependencies are:
  777. - pydenticon
  778. - simplejson
  779. - syutil
  780. - matrix-angular-sdk
  781. To pull in these dependencies in a virtual env, run::
  782. python synapse/python_dependencies.py | xargs -n 1 pip install
  783. Upgrading to v0.6.0
  784. ===================
  785. To pull in new dependencies, run::
  786. python setup.py develop --user
  787. This update includes a change to the database schema. To upgrade you first need
  788. to upgrade the database by running::
  789. python scripts/upgrade_db_to_v0.6.0.py <db> <server_name> <signing_key>
  790. Where `<db>` is the location of the database, `<server_name>` is the
  791. server name as specified in the synapse configuration, and `<signing_key>` is
  792. the location of the signing key as specified in the synapse configuration.
  793. This may take some time to complete. Failures of signatures and content hashes
  794. can safely be ignored.
  795. Upgrading to v0.5.1
  796. ===================
  797. Depending on precisely when you installed v0.5.0 you may have ended up with
  798. a stale release of the reference matrix webclient installed as a python module.
  799. To uninstall it and ensure you are depending on the latest module, please run::
  800. $ pip uninstall syweb
  801. Upgrading to v0.5.0
  802. ===================
  803. The webclient has been split out into a seperate repository/pacakage in this
  804. release. Before you restart your homeserver you will need to pull in the
  805. webclient package by running::
  806. python setup.py develop --user
  807. This release completely changes the database schema and so requires upgrading
  808. it before starting the new version of the homeserver.
  809. The script "database-prepare-for-0.5.0.sh" should be used to upgrade the
  810. database. This will save all user information, such as logins and profiles,
  811. but will otherwise purge the database. This includes messages, which
  812. rooms the home server was a member of and room alias mappings.
  813. If you would like to keep your history, please take a copy of your database
  814. file and ask for help in #matrix:matrix.org. The upgrade process is,
  815. unfortunately, non trivial and requires human intervention to resolve any
  816. resulting conflicts during the upgrade process.
  817. Before running the command the homeserver should be first completely
  818. shutdown. To run it, simply specify the location of the database, e.g.:
  819. ./scripts/database-prepare-for-0.5.0.sh "homeserver.db"
  820. Once this has successfully completed it will be safe to restart the
  821. homeserver. You may notice that the homeserver takes a few seconds longer to
  822. restart than usual as it reinitializes the database.
  823. On startup of the new version, users can either rejoin remote rooms using room
  824. aliases or by being reinvited. Alternatively, if any other homeserver sends a
  825. message to a room that the homeserver was previously in the local HS will
  826. automatically rejoin the room.
  827. Upgrading to v0.4.0
  828. ===================
  829. This release needs an updated syutil version. Run::
  830. python setup.py develop
  831. You will also need to upgrade your configuration as the signing key format has
  832. changed. Run::
  833. python -m synapse.app.homeserver --config-path <CONFIG> --generate-config
  834. Upgrading to v0.3.0
  835. ===================
  836. This registration API now closely matches the login API. This introduces a bit
  837. more backwards and forwards between the HS and the client, but this improves
  838. the overall flexibility of the API. You can now GET on /register to retrieve a list
  839. of valid registration flows. Upon choosing one, they are submitted in the same
  840. way as login, e.g::
  841. {
  842. type: m.login.password,
  843. user: foo,
  844. password: bar
  845. }
  846. The default HS supports 2 flows, with and without Identity Server email
  847. authentication. Enabling captcha on the HS will add in an extra step to all
  848. flows: ``m.login.recaptcha`` which must be completed before you can transition
  849. to the next stage. There is a new login type: ``m.login.email.identity`` which
  850. contains the ``threepidCreds`` key which were previously sent in the original
  851. register request. For more information on this, see the specification.
  852. Web Client
  853. ----------
  854. The VoIP specification has changed between v0.2.0 and v0.3.0. Users should
  855. refresh any browser tabs to get the latest web client code. Users on
  856. v0.2.0 of the web client will not be able to call those on v0.3.0 and
  857. vice versa.
  858. Upgrading to v0.2.0
  859. ===================
  860. The home server now requires setting up of SSL config before it can run. To
  861. automatically generate default config use::
  862. $ python synapse/app/homeserver.py \
  863. --server-name machine.my.domain.name \
  864. --bind-port 8448 \
  865. --config-path homeserver.config \
  866. --generate-config
  867. This config can be edited if desired, for example to specify a different SSL
  868. certificate to use. Once done you can run the home server using::
  869. $ python synapse/app/homeserver.py --config-path homeserver.config
  870. See the README.rst for more information.
  871. Also note that some config options have been renamed, including:
  872. - "host" to "server-name"
  873. - "database" to "database-path"
  874. - "port" to "bind-port" and "unsecure-port"
  875. Upgrading to v0.0.1
  876. ===================
  877. This release completely changes the database schema and so requires upgrading
  878. it before starting the new version of the homeserver.
  879. The script "database-prepare-for-0.0.1.sh" should be used to upgrade the
  880. database. This will save all user information, such as logins and profiles,
  881. but will otherwise purge the database. This includes messages, which
  882. rooms the home server was a member of and room alias mappings.
  883. Before running the command the homeserver should be first completely
  884. shutdown. To run it, simply specify the location of the database, e.g.:
  885. ./scripts/database-prepare-for-0.0.1.sh "homeserver.db"
  886. Once this has successfully completed it will be safe to restart the
  887. homeserver. You may notice that the homeserver takes a few seconds longer to
  888. restart than usual as it reinitializes the database.
  889. On startup of the new version, users can either rejoin remote rooms using room
  890. aliases or by being reinvited. Alternatively, if any other homeserver sends a
  891. message to a room that the homeserver was previously in the local HS will
  892. automatically rejoin the room.