From fea271db5e5993e577f1b84eb83efd437f1bc013 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Sat, 19 Aug 2023 15:53:23 -0600 Subject: [PATCH 1/3] Specify MSC4040 --- content/server-server-api.md | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/content/server-server-api.md b/content/server-server-api.md index d0167e01e..17cd507e6 100644 --- a/content/server-server-api.md +++ b/content/server-server-api.md @@ -148,7 +148,15 @@ to send. The process overall is as follows: Requests must be made with a `Host` header of `:`. The target server must present a valid certificate for ``. - 3. If `` is not an IP literal and no + 3. {{< added-in v="1.8" >}} If `` is not an IP literal and no + `` is present, an SRV record is looked up for + `_matrix-fed._tcp.`. This may result in another + hostname (to be resolved using AAAA or A records) and port. + Requests should be made to the resolved IP address and port with + a `Host` header containing the ``. The + target server must present a valid certificate for + ``. + 4. **[Deprecated]** If `` is not an IP literal and no `` is present, an SRV record is looked up for `_matrix._tcp.`. This may result in another hostname (to be resolved using AAAA or A records) and port. @@ -156,20 +164,27 @@ to send. The process overall is as follows: a `Host` header containing the ``. The target server must present a valid certificate for ``. - 4. If no SRV record is found, an IP address is resolved using CNAME, AAAA + 5. If no SRV record is found, an IP address is resolved using CNAME, AAAA or A records. Requests are then made to the resolve IP address and a port of 8448, using a `Host` header of ``. The target server must present a valid certificate for ``. -4. If the `/.well-known` request resulted in an error response, a server is +4. {{< added-in v="1.8" >}} If the `/.well-known` request resulted in an error response, a server is + found by resolving an SRV record for `_matrix-fed._tcp.`. This may + result in a hostname (to be resolved using AAAA or A records) and + port. Requests are made to the resolved IP address and port, with a `Host` + header of ``. The target server must present a valid certificate + for ``. + +5. **[Deprecated]** If the `/.well-known` request resulted in an error response, a server is found by resolving an SRV record for `_matrix._tcp.`. This may result in a hostname (to be resolved using AAAA or A records) and port. Requests are made to the resolved IP address and port, with a `Host` header of ``. The target server must present a valid certificate for ``. -5. If the `/.well-known` request returned an error response, and the +6. If the `/.well-known` request returned an error response, and the SRV record was not found, an IP address is resolved using CNAME, AAAA and A records. Requests are made to the resolved IP address using port 8448 and a `Host` header containing the ``. The target @@ -191,6 +206,14 @@ mandated by [RFC2782](https://www.rfc-editor.org/rfc/rfc2782.html): > the name MUST NOT be an alias (in the sense of RFC 1034 or RFC 2181) {{% /boxes/note %}} +{{% boxes/note %}} +Steps 3.4 and 5 are deprecated because they use a service name not registered by IANA. +They may be removed in a future version of the specification. Server admins are encouraged +to use `.well-known` over any form of SRV records. + +The IANA registration for port 8448 and `matrix-fed` can be found [here](https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=matrix-fed). +{{% /boxes/note %}} + {{% http-api spec="server-server" api="wellknown" %}} ### Server implementation From d096613cb43cab5156a7de19cfd41cbf0263ab06 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Sat, 19 Aug 2023 15:56:56 -0600 Subject: [PATCH 2/3] add changelog --- changelogs/server_server/newsfragments/1624.deprecation | 1 + changelogs/server_server/newsfragments/1624.feature | 1 + 2 files changed, 2 insertions(+) create mode 100644 changelogs/server_server/newsfragments/1624.deprecation create mode 100644 changelogs/server_server/newsfragments/1624.feature diff --git a/changelogs/server_server/newsfragments/1624.deprecation b/changelogs/server_server/newsfragments/1624.deprecation new file mode 100644 index 000000000..4d8c481a0 --- /dev/null +++ b/changelogs/server_server/newsfragments/1624.deprecation @@ -0,0 +1 @@ +Deprecate `matrix` SRV lookup steps during server discovery, as per [MSC4040](https://github.com/matrix-org/matrix-spec-proposals/pull/4040). \ No newline at end of file diff --git a/changelogs/server_server/newsfragments/1624.feature b/changelogs/server_server/newsfragments/1624.feature new file mode 100644 index 000000000..324bf07f6 --- /dev/null +++ b/changelogs/server_server/newsfragments/1624.feature @@ -0,0 +1 @@ +Add `matrix-fed` SRV lookup steps to server discovery, as per [MSC4040](https://github.com/matrix-org/matrix-spec-proposals/pull/4040). \ No newline at end of file From a51ca559330f8e31c67a35263397fe422022be40 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Tue, 22 Aug 2023 09:21:09 -0600 Subject: [PATCH 3/3] Fix flow of steps 4 and 5 --- content/server-server-api.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/content/server-server-api.md b/content/server-server-api.md index 17cd507e6..d658e009f 100644 --- a/content/server-server-api.md +++ b/content/server-server-api.md @@ -156,8 +156,9 @@ to send. The process overall is as follows: a `Host` header containing the ``. The target server must present a valid certificate for ``. - 4. **[Deprecated]** If `` is not an IP literal and no - `` is present, an SRV record is looked up for + 4. **[Deprecated]** If `` is not an IP literal, no + `` is present, and a `_matrix-fed._tcp.` + SRV record was not found, an SRV record is looked up for `_matrix._tcp.`. This may result in another hostname (to be resolved using AAAA or A records) and port. Requests should be made to the resolved IP address and port with @@ -177,7 +178,8 @@ to send. The process overall is as follows: header of ``. The target server must present a valid certificate for ``. -5. **[Deprecated]** If the `/.well-known` request resulted in an error response, a server is +5. **[Deprecated]** If the `/.well-known` request resulted in an error response, + and a `_matrix-fed._tcp.` SRV record was not found, a server is found by resolving an SRV record for `_matrix._tcp.`. This may result in a hostname (to be resolved using AAAA or A records) and port. Requests are made to the resolved IP address and port, with a `Host`