MSC1711_certificates_FAQ.html 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. <!DOCTYPE HTML>
  2. <html lang="en" class="sidebar-visible no-js light">
  3. <head>
  4. <!-- Book generated using mdBook -->
  5. <meta charset="UTF-8">
  6. <title>Upgrading from pre-Synapse 1.0 - Synapse</title>
  7. <!-- Custom HTML head -->
  8. <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  9. <meta name="description" content="">
  10. <meta name="viewport" content="width=device-width, initial-scale=1">
  11. <meta name="theme-color" content="#ffffff" />
  12. <link rel="icon" href="favicon.svg">
  13. <link rel="shortcut icon" href="favicon.png">
  14. <link rel="stylesheet" href="css/variables.css">
  15. <link rel="stylesheet" href="css/general.css">
  16. <link rel="stylesheet" href="css/chrome.css">
  17. <link rel="stylesheet" href="css/print.css" media="print">
  18. <!-- Fonts -->
  19. <link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
  20. <link rel="stylesheet" href="fonts/fonts.css">
  21. <!-- Highlight.js Stylesheets -->
  22. <link rel="stylesheet" href="highlight.css">
  23. <link rel="stylesheet" href="tomorrow-night.css">
  24. <link rel="stylesheet" href="ayu-highlight.css">
  25. <!-- Custom theme stylesheets -->
  26. <link rel="stylesheet" href="docs/website_files/table-of-contents.css">
  27. <link rel="stylesheet" href="docs/website_files/remove-nav-buttons.css">
  28. <link rel="stylesheet" href="docs/website_files/indent-section-headers.css">
  29. <link rel="stylesheet" href="docs/website_files/version-picker.css">
  30. </head>
  31. <body>
  32. <!-- Provide site root to javascript -->
  33. <script type="text/javascript">
  34. var path_to_root = "";
  35. var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
  36. </script>
  37. <!-- Work around some values being stored in localStorage wrapped in quotes -->
  38. <script type="text/javascript">
  39. try {
  40. var theme = localStorage.getItem('mdbook-theme');
  41. var sidebar = localStorage.getItem('mdbook-sidebar');
  42. if (theme.startsWith('"') && theme.endsWith('"')) {
  43. localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
  44. }
  45. if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
  46. localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
  47. }
  48. } catch (e) { }
  49. </script>
  50. <!-- Set the theme before any content is loaded, prevents flash -->
  51. <script type="text/javascript">
  52. var theme;
  53. try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
  54. if (theme === null || theme === undefined) { theme = default_theme; }
  55. var html = document.querySelector('html');
  56. html.classList.remove('no-js')
  57. html.classList.remove('light')
  58. html.classList.add(theme);
  59. html.classList.add('js');
  60. </script>
  61. <!-- Hide / unhide sidebar before it is displayed -->
  62. <script type="text/javascript">
  63. var html = document.querySelector('html');
  64. var sidebar = 'hidden';
  65. if (document.body.clientWidth >= 1080) {
  66. try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
  67. sidebar = sidebar || 'visible';
  68. }
  69. html.classList.remove('sidebar-visible');
  70. html.classList.add("sidebar-" + sidebar);
  71. </script>
  72. <nav id="sidebar" class="sidebar" aria-label="Table of contents">
  73. <div class="sidebar-scrollbox">
  74. <ol class="chapter"><li class="chapter-item expanded affix "><li class="part-title">Introduction</li><li class="chapter-item expanded "><a href="welcome_and_overview.html">Welcome and Overview</a></li><li class="chapter-item expanded affix "><li class="part-title">Setup</li><li class="chapter-item expanded "><a href="setup/installation.html">Installation</a></li><li class="chapter-item expanded "><a href="postgres.html">Using Postgres</a></li><li class="chapter-item expanded "><a href="reverse_proxy.html">Configuring a Reverse Proxy</a></li><li class="chapter-item expanded "><a href="setup/forward_proxy.html">Configuring a Forward/Outbound Proxy</a></li><li class="chapter-item expanded "><a href="turn-howto.html">Configuring a Turn Server</a></li><li class="chapter-item expanded "><a href="delegate.html">Delegation</a></li><li class="chapter-item expanded affix "><li class="part-title">Upgrading</li><li class="chapter-item expanded "><a href="upgrade.html">Upgrading between Synapse Versions</a></li><li class="chapter-item expanded "><a href="MSC1711_certificates_FAQ.html" class="active">Upgrading from pre-Synapse 1.0</a></li><li class="chapter-item expanded affix "><li class="part-title">Usage</li><li class="chapter-item expanded "><a href="federate.html">Federation</a></li><li class="chapter-item expanded "><a href="usage/configuration/index.html">Configuration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="usage/configuration/homeserver_sample_config.html">Homeserver Sample Config File</a></li><li class="chapter-item expanded "><a href="usage/configuration/logging_sample_config.html">Logging Sample Config File</a></li><li class="chapter-item expanded "><a href="structured_logging.html">Structured Logging</a></li><li class="chapter-item expanded "><a href="templates.html">Templates</a></li><li class="chapter-item expanded "><a href="usage/configuration/user_authentication/index.html">User Authentication</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single-Sign On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="openid.html">OpenID Connect</a></li><li class="chapter-item expanded "><div>SAML</div></li><li class="chapter-item expanded "><div>CAS</div></li><li class="chapter-item expanded "><a href="sso_mapping_providers.html">SSO Mapping Providers</a></li></ol></li><li class="chapter-item expanded "><a href="password_auth_providers.html">Password Auth Providers</a></li><li class="chapter-item expanded "><a href="jwt.html">JSON Web Tokens</a></li></ol></li><li class="chapter-item expanded "><a href="CAPTCHA_SETUP.html">Registration Captcha</a></li><li class="chapter-item expanded "><a href="application_services.html">Application Services</a></li><li class="chapter-item expanded "><a href="server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="consent_tracking.html">Consent Tracking</a></li><li class="chapter-item expanded "><a href="development/url_previews.html">URL Previews</a></li><li class="chapter-item expanded "><a href="user_directory.html">User Directory</a></li><li class="chapter-item expanded "><a href="message_retention_policies.html">Message Retention Policies</a></li><li class="chapter-item expanded "><a href="modules/index.html">Pluggable Modules</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="modules/writing_a_module.html">Writing a module</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="modules/spam_checker_callbacks.html">Spam checker callbacks</a></li><li class="chapter-item expanded "><a href="modules/third_party_rules_callbacks.html">Third-party rules callbacks</a></li><li class="chapter-item expanded "><a href="modules/presence_router_callbacks.html">Presence router callbacks</a></li><li class="chapter-item expanded "><a href="modules/account_validity_callbacks.html">Account validity callbacks</a></li><li class="chapter-item expanded "><a href="modules/password_auth_provider_callbacks.html">Password auth provider callbacks</a></li><li class="chapter-item expanded "><a href="modules/porting_legacy_module.html">Porting a legacy module to the new interface</a></li></ol></li></ol></li><li class="chapter-item expanded "><a href="workers.html">Workers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="synctl_workers.html">Using synctl with Workers</a></li><li class="chapter-item expanded "><a href="systemd-with-workers/index.html">Systemd</a></li></ol></li></ol></li><li class="chapter-item expanded "><a href="usage/administration/index.html">Administration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="usage/administration/admin_api/index.html">Admin API</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="admin_api/account_validity.html">Account Validity</a></li><li class="chapter-item expanded "><a href="usage/administration/admin_api/background_updates.html">Background Updates</a></li><li class="chapter-item expanded "><a href="admin_api/delete_group.html">Delete Group</a></li><li class="chapter-item expanded "><a href="admin_api/event_reports.html">Event Reports</a></li><li class="chapter-item expanded "><a href="admin_api/media_admin_api.html">Media</a></li><li class="chapter-item expanded "><a href="admin_api/purge_history_api.html">Purge History</a></li><li class="chapter-item expanded "><a href="admin_api/register_api.html">Register Users</a></li><li class="chapter-item expanded "><a href="usage/administration/admin_api/registration_tokens.html">Registration Tokens</a></li><li class="chapter-item expanded "><a href="admin_api/room_membership.html">Manipulate Room Membership</a></li><li class="chapter-item expanded "><a href="admin_api/rooms.html">Rooms</a></li><li class="chapter-item expanded "><a href="admin_api/server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="admin_api/statistics.html">Statistics</a></li><li class="chapter-item expanded "><a href="admin_api/user_admin_api.html">Users</a></li><li class="chapter-item expanded "><a href="admin_api/version_api.html">Server Version</a></li></ol></li><li class="chapter-item expanded "><a href="manhole.html">Manhole</a></li><li class="chapter-item expanded "><a href="metrics-howto.html">Monitoring</a></li><li class="chapter-item expanded "><a href="usage/administration/request_log.html">Request log format</a></li><li class="chapter-item expanded "><div>Scripts</div></li></ol></li><li class="chapter-item expanded "><li class="part-title">Development</li><li class="chapter-item expanded "><a href="development/contributing_guide.html">Contributing Guide</a></li><li class="chapter-item expanded "><a href="code_style.html">Code Style</a></li><li class="chapter-item expanded "><a href="development/git.html">Git Usage</a></li><li class="chapter-item expanded "><div>Testing</div></li><li class="chapter-item expanded "><a href="opentracing.html">OpenTracing</a></li><li class="chapter-item expanded "><a href="development/database_schema.html">Database Schemas</a></li><li class="chapter-item expanded "><a href="development/experimental_features.html">Experimental features</a></li><li class="chapter-item expanded "><div>Synapse Architecture</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="log_contexts.html">Log Contexts</a></li><li class="chapter-item expanded "><a href="replication.html">Replication</a></li><li class="chapter-item expanded "><a href="tcp_replication.html">TCP Replication</a></li></ol></li><li class="chapter-item expanded "><a href="development/internal_documentation/index.html">Internal Documentation</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single Sign-On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="development/saml.html">SAML</a></li><li class="chapter-item expanded "><a href="development/cas.html">CAS</a></li></ol></li><li class="chapter-item expanded "><a href="development/room-dag-concepts.html">Room DAG concepts</a></li><li class="chapter-item expanded "><div>State Resolution</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="auth_chain_difference_algorithm.html">The Auth Chain Difference Algorithm</a></li></ol></li><li class="chapter-item expanded "><a href="media_repository.html">Media Repository</a></li><li class="chapter-item expanded "><a href="room_and_user_statistics.html">Room and User Statistics</a></li></ol></li><li class="chapter-item expanded "><div>Scripts</div></li><li class="chapter-item expanded affix "><li class="part-title">Other</li><li class="chapter-item expanded "><a href="deprecation_policy.html">Dependency Deprecation Policy</a></li></ol>
  75. </div>
  76. <div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
  77. </nav>
  78. <div id="page-wrapper" class="page-wrapper">
  79. <div class="page">
  80. <div id="menu-bar-hover-placeholder"></div>
  81. <div id="menu-bar" class="menu-bar sticky bordered">
  82. <div class="left-buttons">
  83. <button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
  84. <i class="fa fa-bars"></i>
  85. </button>
  86. <button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
  87. <i class="fa fa-paint-brush"></i>
  88. </button>
  89. <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
  90. <li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li>
  91. <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
  92. <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
  93. <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
  94. <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
  95. </ul>
  96. <button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
  97. <i class="fa fa-search"></i>
  98. </button>
  99. <div class="version-picker">
  100. <div class="dropdown">
  101. <div class="select">
  102. <span></span>
  103. <i class="fa fa-chevron-down"></i>
  104. </div>
  105. <input type="hidden" name="version">
  106. <ul class="dropdown-menu">
  107. <!-- Versions will be added dynamically in version-picker.js -->
  108. </ul>
  109. </div>
  110. </div>
  111. </div>
  112. <h1 class="menu-title">Synapse</h1>
  113. <div class="right-buttons">
  114. <a href="print.html" title="Print this book" aria-label="Print this book">
  115. <i id="print-button" class="fa fa-print"></i>
  116. </a>
  117. <a href="https://github.com/matrix-org/synapse" title="Git repository" aria-label="Git repository">
  118. <i id="git-repository-button" class="fa fa-github"></i>
  119. </a>
  120. <a href="https://github.com/matrix-org/synapse/edit/develop/docs/MSC1711_certificates_FAQ.md" title="Suggest an edit" aria-label="Suggest an edit">
  121. <i id="git-edit-button" class="fa fa-edit"></i>
  122. </a>
  123. </div>
  124. </div>
  125. <div id="search-wrapper" class="hidden">
  126. <form id="searchbar-outer" class="searchbar-outer">
  127. <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
  128. </form>
  129. <div id="searchresults-outer" class="searchresults-outer hidden">
  130. <div id="searchresults-header" class="searchresults-header"></div>
  131. <ul id="searchresults">
  132. </ul>
  133. </div>
  134. </div>
  135. <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
  136. <script type="text/javascript">
  137. document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
  138. document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
  139. Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
  140. link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
  141. });
  142. </script>
  143. <div id="content" class="content">
  144. <main>
  145. <!-- Page table of contents -->
  146. <div class="sidetoc">
  147. <nav class="pagetoc"></nav>
  148. </div>
  149. <h1 id="msc1711-certificates-faq"><a class="header" href="#msc1711-certificates-faq">MSC1711 Certificates FAQ</a></h1>
  150. <h2 id="historical-note"><a class="header" href="#historical-note">Historical Note</a></h2>
  151. <p>This document was originally written to guide server admins through the upgrade
  152. path towards Synapse 1.0. Specifically,
  153. <a href="https://github.com/matrix-org/matrix-doc/blob/main/proposals/1711-x509-for-federation.md">MSC1711</a>
  154. required that all servers present valid TLS certificates on their federation
  155. API. Admins were encouraged to achieve compliance from version 0.99.0 (released
  156. in February 2019) ahead of version 1.0 (released June 2019) enforcing the
  157. certificate checks.</p>
  158. <p>Much of what follows is now outdated since most admins will have already
  159. upgraded, however it may be of use to those with old installs returning to the
  160. project.</p>
  161. <p>If you are setting up a server from scratch you almost certainly should look at
  162. the <a href="setup/installation.html">installation guide</a> instead.</p>
  163. <h2 id="introduction"><a class="header" href="#introduction">Introduction</a></h2>
  164. <p>The goal of Synapse 0.99.0 is to act as a stepping stone to Synapse 1.0.0. It
  165. supports the r0.1 release of the server to server specification, but is
  166. compatible with both the legacy Matrix federation behaviour (pre-r0.1) as well
  167. as post-r0.1 behaviour, in order to allow for a smooth upgrade across the
  168. federation.</p>
  169. <p>The most important thing to know is that Synapse 1.0.0 will require a valid TLS
  170. certificate on federation endpoints. Self signed certificates will not be
  171. sufficient.</p>
  172. <p>Synapse 0.99.0 makes it easy to configure TLS certificates and will
  173. interoperate with both &gt;= 1.0.0 servers as well as existing servers yet to
  174. upgrade.</p>
  175. <p><strong>It is critical that all admins upgrade to 0.99.0 and configure a valid TLS
  176. certificate.</strong> Admins will have 1 month to do so, after which 1.0.0 will be
  177. released and those servers without a valid certificate will not longer be able
  178. to federate with &gt;= 1.0.0 servers.</p>
  179. <p>Full details on how to carry out this configuration change is given
  180. <a href="#configuring-certificates-for-compatibility-with-synapse-100">below</a>. A
  181. timeline and some frequently asked questions are also given below.</p>
  182. <p>For more details and context on the release of the r0.1 Server/Server API and
  183. imminent Matrix 1.0 release, you can also see our
  184. <a href="https://matrix.org/blog/2019/02/04/matrix-at-fosdem-2019/">main talk from FOSDEM 2019</a>.</p>
  185. <h2 id="contents"><a class="header" href="#contents">Contents</a></h2>
  186. <ul>
  187. <li>Timeline</li>
  188. <li>Configuring certificates for compatibility with Synapse 1.0</li>
  189. <li>FAQ
  190. <ul>
  191. <li>Synapse 0.99.0 has just been released, what do I need to do right now?</li>
  192. <li>How do I upgrade?</li>
  193. <li>What will happen if I do not set up a valid federation certificate
  194. immediately?</li>
  195. <li>What will happen if I do nothing at all?</li>
  196. <li>When do I need a SRV record or .well-known URI?</li>
  197. <li>Can I still use an SRV record?</li>
  198. <li>I have created a .well-known URI. Do I still need an SRV record?</li>
  199. <li>It used to work just fine, why are you breaking everything?</li>
  200. <li>Can I manage my own certificates rather than having Synapse renew
  201. certificates itself?</li>
  202. <li>Do you still recommend against using a reverse proxy on the federation port?</li>
  203. <li>Do I still need to give my TLS certificates to Synapse if I am using a
  204. reverse proxy?</li>
  205. <li>Do I need the same certificate for the client and federation port?</li>
  206. <li>How do I tell Synapse to reload my keys/certificates after I replace them?</li>
  207. </ul>
  208. </li>
  209. </ul>
  210. <h2 id="timeline"><a class="header" href="#timeline">Timeline</a></h2>
  211. <p><strong>5th Feb 2019 - Synapse 0.99.0 is released.</strong></p>
  212. <p>All server admins are encouraged to upgrade.</p>
  213. <p>0.99.0:</p>
  214. <ul>
  215. <li>
  216. <p>provides support for ACME to make setting up Let's Encrypt certs easy, as
  217. well as .well-known support.</p>
  218. </li>
  219. <li>
  220. <p>does not enforce that a valid CA cert is present on the federation API, but
  221. rather makes it easy to set one up.</p>
  222. </li>
  223. <li>
  224. <p>provides support for .well-known</p>
  225. </li>
  226. </ul>
  227. <p>Admins should upgrade and configure a valid CA cert. Homeservers that require a
  228. .well-known entry (see below), should retain their SRV record and use it
  229. alongside their .well-known record.</p>
  230. <p><strong>10th June 2019 - Synapse 1.0.0 is released</strong></p>
  231. <p>1.0.0 is scheduled for release on 10th June. In
  232. accordance with the the <a href="https://matrix.org/docs/spec/server_server/r0.1.0.html">S2S spec</a>
  233. 1.0.0 will enforce certificate validity. This means that any homeserver without a
  234. valid certificate after this point will no longer be able to federate with
  235. 1.0.0 servers.</p>
  236. <h2 id="configuring-certificates-for-compatibility-with-synapse-100"><a class="header" href="#configuring-certificates-for-compatibility-with-synapse-100">Configuring certificates for compatibility with Synapse 1.0.0</a></h2>
  237. <h3 id="if-you-do-not-currently-have-an-srv-record"><a class="header" href="#if-you-do-not-currently-have-an-srv-record">If you do not currently have an SRV record</a></h3>
  238. <p>In this case, your <code>server_name</code> points to the host where your Synapse is
  239. running. There is no need to create a <code>.well-known</code> URI or an SRV record, but
  240. you will need to give Synapse a valid, signed, certificate.</p>
  241. <h3 id="if-you-do-have-an-srv-record-currently"><a class="header" href="#if-you-do-have-an-srv-record-currently">If you do have an SRV record currently</a></h3>
  242. <p>If you are using an SRV record, your matrix domain (<code>server_name</code>) may not
  243. point to the same host that your Synapse is running on (the 'target
  244. domain'). (If it does, you can follow the recommendation above; otherwise, read
  245. on.)</p>
  246. <p>Let's assume that your <code>server_name</code> is <code>example.com</code>, and your Synapse is
  247. hosted at a target domain of <code>customer.example.net</code>. Currently you should have
  248. an SRV record which looks like:</p>
  249. <pre><code>_matrix._tcp.example.com. IN SRV 10 5 8000 customer.example.net.
  250. </code></pre>
  251. <p>In this situation, you have three choices for how to proceed:</p>
  252. <h4 id="option-1-give-synapse-a-certificate-for-your-matrix-domain"><a class="header" href="#option-1-give-synapse-a-certificate-for-your-matrix-domain">Option 1: give Synapse a certificate for your matrix domain</a></h4>
  253. <p>Synapse 1.0 will expect your server to present a TLS certificate for your
  254. <code>server_name</code> (<code>example.com</code> in the above example). You can achieve this by acquiring a
  255. certificate for the <code>server_name</code> yourself (for example, using <code>certbot</code>), and giving it
  256. and the key to Synapse via <code>tls_certificate_path</code> and <code>tls_private_key_path</code>.</p>
  257. <h4 id="option-2-run-synapse-behind-a-reverse-proxy"><a class="header" href="#option-2-run-synapse-behind-a-reverse-proxy">Option 2: run Synapse behind a reverse proxy</a></h4>
  258. <p>If you have an existing reverse proxy set up with correct TLS certificates for
  259. your domain, you can simply route all traffic through the reverse proxy by
  260. updating the SRV record appropriately (or removing it, if the proxy listens on
  261. 8448).</p>
  262. <p>See <a href="reverse_proxy.html">the reverse proxy documentation</a> for information on setting up a
  263. reverse proxy.</p>
  264. <h4 id="option-3-add-a-well-known-file-to-delegate-your-matrix-traffic"><a class="header" href="#option-3-add-a-well-known-file-to-delegate-your-matrix-traffic">Option 3: add a .well-known file to delegate your matrix traffic</a></h4>
  265. <p>This will allow you to keep Synapse on a separate domain, without having to
  266. give it a certificate for the matrix domain.</p>
  267. <p>You can do this with a <code>.well-known</code> file as follows:</p>
  268. <ol>
  269. <li>
  270. <p>Keep the SRV record in place - it is needed for backwards compatibility
  271. with Synapse 0.34 and earlier.</p>
  272. </li>
  273. <li>
  274. <p>Give Synapse a certificate corresponding to the target domain
  275. (<code>customer.example.net</code> in the above example). You can do this by acquire a
  276. certificate for the target domain and giving it to Synapse via <code>tls_certificate_path</code>
  277. and <code>tls_private_key_path</code>.</p>
  278. </li>
  279. <li>
  280. <p>Restart Synapse to ensure the new certificate is loaded.</p>
  281. </li>
  282. <li>
  283. <p>Arrange for a <code>.well-known</code> file at
  284. <code>https://&lt;server_name&gt;/.well-known/matrix/server</code> with contents:</p>
  285. <pre><code class="language-json">{&quot;m.server&quot;: &quot;&lt;target server name&gt;&quot;}
  286. </code></pre>
  287. <p>where the target server name is resolved as usual (i.e. SRV lookup, falling
  288. back to talking to port 8448).</p>
  289. <p>In the above example, where synapse is listening on port 8000,
  290. <code>https://example.com/.well-known/matrix/server</code> should have <code>m.server</code> set to one of:</p>
  291. <ol>
  292. <li>
  293. <p><code>customer.example.net</code> ─ with a SRV record on
  294. <code>_matrix._tcp.customer.example.com</code> pointing to port 8000, or:</p>
  295. </li>
  296. <li>
  297. <p><code>customer.example.net</code> ─ updating synapse to listen on the default port
  298. 8448, or:</p>
  299. </li>
  300. <li>
  301. <p><code>customer.example.net:8000</code> ─ ensuring that if there is a reverse proxy
  302. on <code>customer.example.net:8000</code> it correctly handles HTTP requests with
  303. Host header set to <code>customer.example.net:8000</code>.</p>
  304. </li>
  305. </ol>
  306. </li>
  307. </ol>
  308. <h2 id="faq"><a class="header" href="#faq">FAQ</a></h2>
  309. <h3 id="synapse-0990-has-just-been-released-what-do-i-need-to-do-right-now"><a class="header" href="#synapse-0990-has-just-been-released-what-do-i-need-to-do-right-now">Synapse 0.99.0 has just been released, what do I need to do right now?</a></h3>
  310. <p>Upgrade as soon as you can in preparation for Synapse 1.0.0, and update your
  311. TLS certificates as <a href="#configuring-certificates-for-compatibility-with-synapse-100">above</a>.</p>
  312. <h3 id="what-will-happen-if-i-do-not-set-up-a-valid-federation-certificate-immediately"><a class="header" href="#what-will-happen-if-i-do-not-set-up-a-valid-federation-certificate-immediately">What will happen if I do not set up a valid federation certificate immediately?</a></h3>
  313. <p>Nothing initially, but once 1.0.0 is in the wild it will not be possible to
  314. federate with 1.0.0 servers.</p>
  315. <h3 id="what-will-happen-if-i-do-nothing-at-all"><a class="header" href="#what-will-happen-if-i-do-nothing-at-all">What will happen if I do nothing at all?</a></h3>
  316. <p>If the admin takes no action at all, and remains on a Synapse &lt; 0.99.0 then the
  317. homeserver will be unable to federate with those who have implemented
  318. .well-known. Then, as above, once the month upgrade window has expired the
  319. homeserver will not be able to federate with any Synapse &gt;= 1.0.0</p>
  320. <h3 id="when-do-i-need-a-srv-record-or-well-known-uri"><a class="header" href="#when-do-i-need-a-srv-record-or-well-known-uri">When do I need a SRV record or .well-known URI?</a></h3>
  321. <p>If your homeserver listens on the default federation port (8448), and your
  322. <code>server_name</code> points to the host that your homeserver runs on, you do not need an
  323. SRV record or <code>.well-known/matrix/server</code> URI.</p>
  324. <p>For instance, if you registered <code>example.com</code> and pointed its DNS A record at a
  325. fresh Upcloud VPS or similar, you could install Synapse 0.99 on that host,
  326. giving it a server_name of <code>example.com</code>, and it would automatically generate a
  327. valid TLS certificate for you via Let's Encrypt and no SRV record or
  328. <code>.well-known</code> URI would be needed.</p>
  329. <p>This is the common case, although you can add an SRV record or
  330. <code>.well-known/matrix/server</code> URI for completeness if you wish.</p>
  331. <p><strong>However</strong>, if your server does not listen on port 8448, or if your <code>server_name</code>
  332. does not point to the host that your homeserver runs on, you will need to let
  333. other servers know how to find it.</p>
  334. <p>In this case, you should see <a href="#if-you-do-have-an-srv-record-currently">&quot;If you do have an SRV record
  335. currently&quot;</a> above.</p>
  336. <h3 id="can-i-still-use-an-srv-record"><a class="header" href="#can-i-still-use-an-srv-record">Can I still use an SRV record?</a></h3>
  337. <p>Firstly, if you didn't need an SRV record before (because your server is
  338. listening on port 8448 of your server_name), you certainly don't need one now:
  339. the defaults are still the same.</p>
  340. <p>If you previously had an SRV record, you can keep using it provided you are
  341. able to give Synapse a TLS certificate corresponding to your server name. For
  342. example, suppose you had the following SRV record, which directs matrix traffic
  343. for example.com to matrix.example.com:443:</p>
  344. <pre><code>_matrix._tcp.example.com. IN SRV 10 5 443 matrix.example.com
  345. </code></pre>
  346. <p>In this case, Synapse must be given a certificate for example.com - or be
  347. configured to acquire one from Let's Encrypt.</p>
  348. <p>If you are unable to give Synapse a certificate for your server_name, you will
  349. also need to use a .well-known URI instead. However, see also &quot;I have created a
  350. .well-known URI. Do I still need an SRV record?&quot;.</p>
  351. <h3 id="i-have-created-a-well-known-uri-do-i-still-need-an-srv-record"><a class="header" href="#i-have-created-a-well-known-uri-do-i-still-need-an-srv-record">I have created a .well-known URI. Do I still need an SRV record?</a></h3>
  352. <p>As of Synapse 0.99, Synapse will first check for the existence of a <code>.well-known</code>
  353. URI and follow any delegation it suggests. It will only then check for the
  354. existence of an SRV record.</p>
  355. <p>That means that the SRV record will often be redundant. However, you should
  356. remember that there may still be older versions of Synapse in the federation
  357. which do not understand <code>.well-known</code> URIs, so if you removed your SRV record you
  358. would no longer be able to federate with them.</p>
  359. <p>It is therefore best to leave the SRV record in place for now. Synapse 0.34 and
  360. earlier will follow the SRV record (and not care about the invalid
  361. certificate). Synapse 0.99 and later will follow the .well-known URI, with the
  362. correct certificate chain.</p>
  363. <h3 id="it-used-to-work-just-fine-why-are-you-breaking-everything"><a class="header" href="#it-used-to-work-just-fine-why-are-you-breaking-everything">It used to work just fine, why are you breaking everything?</a></h3>
  364. <p>We have always wanted Matrix servers to be as easy to set up as possible, and
  365. so back when we started federation in 2014 we didn't want admins to have to go
  366. through the cumbersome process of buying a valid TLS certificate to run a
  367. server. This was before Let's Encrypt came along and made getting a free and
  368. valid TLS certificate straightforward. So instead, we adopted a system based on
  369. <a href="https://en.wikipedia.org/wiki/Convergence_(SSL)">Perspectives</a>: an approach
  370. where you check a set of &quot;notary servers&quot; (in practice, homeservers) to vouch
  371. for the validity of a certificate rather than having it signed by a CA. As long
  372. as enough different notaries agree on the certificate's validity, then it is
  373. trusted.</p>
  374. <p>However, in practice this has never worked properly. Most people only use the
  375. default notary server (matrix.org), leading to inadvertent centralisation which
  376. we want to eliminate. Meanwhile, we never implemented the full consensus
  377. algorithm to query the servers participating in a room to determine consensus
  378. on whether a given certificate is valid. This is fiddly to get right
  379. (especially in face of sybil attacks), and we found ourselves questioning
  380. whether it was worth the effort to finish the work and commit to maintaining a
  381. secure certificate validation system as opposed to focusing on core Matrix
  382. development.</p>
  383. <p>Meanwhile, Let's Encrypt came along in 2016, and put the final nail in the
  384. coffin of the Perspectives project (which was already pretty dead). So, the
  385. Spec Core Team decided that a better approach would be to mandate valid TLS
  386. certificates for federation alongside the rest of the Web. More details can be
  387. found in
  388. <a href="https://github.com/matrix-org/matrix-doc/blob/main/proposals/1711-x509-for-federation.md#background-the-failure-of-the-perspectives-approach">MSC1711</a>.</p>
  389. <p>This results in a breaking change, which is disruptive, but absolutely critical
  390. for the security model. However, the existence of Let's Encrypt as a trivial
  391. way to replace the old self-signed certificates with valid CA-signed ones helps
  392. smooth things over massively, especially as Synapse can now automate Let's
  393. Encrypt certificate generation if needed.</p>
  394. <h3 id="can-i-manage-my-own-certificates-rather-than-having-synapse-renew-certificates-itself"><a class="header" href="#can-i-manage-my-own-certificates-rather-than-having-synapse-renew-certificates-itself">Can I manage my own certificates rather than having Synapse renew certificates itself?</a></h3>
  395. <p>Yes, you are welcome to manage your certificates yourself. Synapse will only
  396. attempt to obtain certificates from Let's Encrypt if you configure it to do
  397. so.The only requirement is that there is a valid TLS cert present for
  398. federation end points.</p>
  399. <h3 id="do-you-still-recommend-against-using-a-reverse-proxy-on-the-federation-port"><a class="header" href="#do-you-still-recommend-against-using-a-reverse-proxy-on-the-federation-port">Do you still recommend against using a reverse proxy on the federation port?</a></h3>
  400. <p>We no longer actively recommend against using a reverse proxy. Many admins will
  401. find it easier to direct federation traffic to a reverse proxy and manage their
  402. own TLS certificates, and this is a supported configuration.</p>
  403. <p>See <a href="reverse_proxy.html">the reverse proxy documentation</a> for information on setting up a
  404. reverse proxy.</p>
  405. <h3 id="do-i-still-need-to-give-my-tls-certificates-to-synapse-if-i-am-using-a-reverse-proxy"><a class="header" href="#do-i-still-need-to-give-my-tls-certificates-to-synapse-if-i-am-using-a-reverse-proxy">Do I still need to give my TLS certificates to Synapse if I am using a reverse proxy?</a></h3>
  406. <p>Practically speaking, this is no longer necessary.</p>
  407. <p>If you are using a reverse proxy for all of your TLS traffic, then you can set
  408. <code>no_tls: True</code>. In that case, the only reason Synapse needs the certificate is
  409. to populate a legacy 'tls_fingerprints' field in the federation API. This is
  410. ignored by Synapse 0.99.0 and later, and the only time pre-0.99 Synapses will
  411. check it is when attempting to fetch the server keys - and generally this is
  412. delegated via <code>matrix.org</code>, which is on 0.99.0.</p>
  413. <p>However, there is a bug in Synapse 0.99.0
  414. <a href="https://github.com/matrix-org/synapse/issues/4554">4554</a> which prevents
  415. Synapse from starting if you do not give it a TLS certificate. To work around
  416. this, you can give it any TLS certificate at all. This will be fixed soon.</p>
  417. <h3 id="do-i-need-the-same-certificate-for-the-client-and-federation-port"><a class="header" href="#do-i-need-the-same-certificate-for-the-client-and-federation-port">Do I need the same certificate for the client and federation port?</a></h3>
  418. <p>No. There is nothing stopping you from using different certificates,
  419. particularly if you are using a reverse proxy. However, Synapse will use the
  420. same certificate on any ports where TLS is configured.</p>
  421. <h3 id="how-do-i-tell-synapse-to-reload-my-keyscertificates-after-i-replace-them"><a class="header" href="#how-do-i-tell-synapse-to-reload-my-keyscertificates-after-i-replace-them">How do I tell Synapse to reload my keys/certificates after I replace them?</a></h3>
  422. <p>Synapse will reload the keys and certificates when it receives a SIGHUP - for
  423. example <code>kill -HUP $(cat homeserver.pid)</code>. Alternatively, simply restart
  424. Synapse, though this will result in downtime while it restarts.</p>
  425. </main>
  426. <nav class="nav-wrapper" aria-label="Page navigation">
  427. <!-- Mobile navigation buttons -->
  428. <a rel="prev" href="upgrade.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
  429. <i class="fa fa-angle-left"></i>
  430. </a>
  431. <a rel="next" href="federate.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
  432. <i class="fa fa-angle-right"></i>
  433. </a>
  434. <div style="clear: both"></div>
  435. </nav>
  436. </div>
  437. </div>
  438. <nav class="nav-wide-wrapper" aria-label="Page navigation">
  439. <a rel="prev" href="upgrade.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
  440. <i class="fa fa-angle-left"></i>
  441. </a>
  442. <a rel="next" href="federate.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
  443. <i class="fa fa-angle-right"></i>
  444. </a>
  445. </nav>
  446. </div>
  447. <script type="text/javascript">
  448. window.playground_copyable = true;
  449. </script>
  450. <script src="elasticlunr.min.js" type="text/javascript" charset="utf-8"></script>
  451. <script src="mark.min.js" type="text/javascript" charset="utf-8"></script>
  452. <script src="searcher.js" type="text/javascript" charset="utf-8"></script>
  453. <script src="clipboard.min.js" type="text/javascript" charset="utf-8"></script>
  454. <script src="highlight.js" type="text/javascript" charset="utf-8"></script>
  455. <script src="book.js" type="text/javascript" charset="utf-8"></script>
  456. <!-- Custom JS scripts -->
  457. <script type="text/javascript" src="docs/website_files/table-of-contents.js"></script>
  458. <script type="text/javascript" src="docs/website_files/version-picker.js"></script>
  459. <script type="text/javascript" src="docs/website_files/version.js"></script>
  460. </body>
  461. </html>