UPGRADE.rst 47 KB

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