Commit graph

80 commits

Author SHA1 Message Date
Olivia Lee
0f9568902d
attempt to remove canonical alias entries when deleting local aliases
The spec says that this behavior is optional, but it's what synapse does
and we had a TODO for it.
2025-05-18 14:14:02 -07:00
Olivia Lee
5f9e85cb49
return an error when attempting to delete a nonexistent local alias
The spec doesn't spell out explicitly that the server should check this,
but it does list M_NOT_FOUND "room alias ... not found" as an example
error response.
2025-05-18 14:13:42 -07:00
Olivia Lee
a34bca3986
transfer local canonical aliases to new room on upgrade
When upgrading rooms, we reassign any local aliases from the old room to
the new room. This commit updates the m.room.canonical_alias events in
the old and new rooms to reflect which aliases were moved. The spec is
unclear on whether the server should do this[1], but it's consistent
with synapse's behavior.

I went with putting the canonical alias update logic inline, rather than
something like add_canonical_alias and remove_canonical_alias helper
functions to the alias service, because it's desirable to have the alias
updates be sent as a single event than a separate event for each change.

[1]: https://github.com/matrix-org/matrix-spec/issues/2142
2025-05-18 14:13:41 -07:00
Olivia Lee
07fb57be06
remove local aliases from old room on upgrade
Without explicitly removing the old alias when reassigning aliases, we
were listing the alias on both rooms in the GET client/v3/rooms/{roomId}/aliases
endpoint. Resolving the alias still always pointed to the correct room.
2025-05-18 14:12:50 -07:00
Olivia Lee
6cb7896e17
use trust-dns for all DNS queries
Previously we were only using trust-dns for resolving SRV records in
server discovery, and then for resolving the hostname from the SRV
record target if one exists. With the previous behavior, admins need to
ensure that both their system resolver and trust-dns are working
correctly in order for outgoing traffic to work reliably. This can be
confusing to debug, because it's not obvious to the admin if or when
each resolver are being used. Now, everything goes through trust-dns and
outgoing federation DNS should fail/succeed more predictably.

I also expect some performance improvement from having an in-process DNS
cache, but haven't taken measurements yet.
2025-04-14 15:56:33 -07:00
Olivia Lee
c03103a142
document that conduwuit migration is unlikely to work
<https://conduwuit.puppyirl.gay/#can-i-migrate-or-switch-from-conduit>
says that they broke db compatibility explicitly. I'm not sure when this
happened and which versions are compatible. Until we evaluate that we
should warn people not to try.
2025-04-11 13:10:23 -07:00
Lambda
6bcc4e310e
Immediately trigger EDU sending after client read receipt
Previously, read receipts would only be forwarded via federation
incidentally when some PDU was later sent to the destination server.
Trigger a send without any event to collect EDUs and get read receipts
out directly.
2025-03-30 16:48:06 -07:00
Charles Hall
799594cd1f
fix typo and update changelog
The MR number for the original MR was missing the leading `1`.
2025-03-21 16:28:11 -07:00
Charles Hall
5a5608e088
separate media and database paths
The primary motivation for this change is to support databases that
don't take a path, e.g. out of process databases.

This configuration structure leaves the door open for other media
storage mechanisms in the future, such as S3.

It's also structured to avoid `#[serde(flatten)]` so that we can use
`#[serde(deny_unknown_fields)]`.
2025-03-20 11:33:59 -07:00
Charles Hall
ae920fdbe8
make option name less redundant 2025-03-20 10:40:20 -07:00
Charles Hall
0a6d2b2731
make a media section in the config file 2025-03-20 10:40:20 -07:00
Lambda
99924e5779 Add admin commands to get and reset tracing filters 2025-02-17 17:41:14 +00:00
Olivia Lee
472f51c350
allow adding canonical aliases from remote servers
Like is mentioned in the comment, this isn't explicitly required by the
spec, but it's reasonable and what synapse does.
2025-01-23 09:20:10 -08:00
Olivia Lee
29d8fbaefa
only validate canonical aliases that are new
Previously we required every alias in a canonical alias event sent by a
client to be valid, and would only validate local aliases. This
prevented clients from adding/removing canonical aliases if there were
existing remote or invalid aliases.
2025-01-23 09:20:10 -08:00
Olivia Lee
051221c0ab
validate schema of new canonical alias events sent by clients
Previously, we would only attempt to validate the aliases in the event
content if we were able to parse the event, and would silently allow it
otherwise.
2025-01-23 09:20:10 -08:00
Olivia Lee
c748c7c188
return M_BAD_ALIAS when trying to set non-existent canonical aliases
This is the error code named in the spec.
2025-01-20 16:59:01 -08:00
Charles Hall
8537c0e8ac
rearrange introduction
I think it's most important for people to read the "Chat with us", "Can
I use it?" and "Expectations management" sections, though I'm not sure
what the best ordering is. This is probably fine.
2024-12-13 17:00:37 -08:00
Charles Hall
5c4d7bbe37
rewrite "Can I use it?" section 2024-12-13 17:00:10 -08:00
Charles Hall
1808ad66f4
document supported targets
This is also a good spot to link to the pre-built binaries. And since I
did that, I can also remove the bit about not publishing binary builds
from the introduction section.
2024-12-13 16:59:13 -08:00
Charles Hall
28a4483c6e
move conduit migration to installing section 2024-12-13 16:59:13 -08:00
Charles Hall
f831dfd1f1
add "Installing" chapter to the book 2024-12-13 16:59:13 -08:00
Olivia Lee
491518d2f3
add changelog entry for M_NOT_YET_UPLOADED when media is missing in fs
The first half of this change happened in !55, but we never added a
changelog entry until now.
2024-12-13 01:21:14 -08:00
Charles Hall
94c1a39437
add a style guide 2024-12-11 14:01:38 -08:00
Charles Hall
42adad330e
move security info to its own page
This makes it easier to find.

Also sort the maintainers list while I'm here.
2024-12-11 13:26:16 -08:00
Charles Hall
3a10e23d94
move matrix link to introduction page 2024-12-11 13:25:12 -08:00
Charles Hall
cf067dbeb1
move changelog section above contributing 2024-12-11 13:25:07 -08:00
Olivia Lee
ba72616672
do not backoff remote device key queries when a request fails due to backoff
The previous logic would increment the backoff counter both when a
request actually fails and when we do not make a request because the
server was already in backoff. This lead to a positive feedback loop
where every request made while a server is in backoff increases the
backoff delay, making it impossible to recover from backoff unless the
entire backoff delay elapses with zero requests.
2024-12-11 13:02:11 -08:00
Olivia Lee
4ee8312068
reset device key query backoff after a successful request
Failing to reset the backoff state resulted in a monotonically
increasing backoff delay. If a remote server was temporarily
unavailable, we would have a persistently increased rate of key query
failures until the backoff state was reset by a server restart. If
enough key queries were attempted while the remote was unavailable, it
can accumulate an arbitrarily long backoff delay and effectively block
all future key queries to this server.
2024-12-11 13:02:10 -08:00
Charles Hall
554751917a
fix some minor documentation typos
* Capitalize Conduit and Grapevine
* Replace a "Not" with "Note"
* Change a "Conduit 0.7.0" to "Conduit <0.8.0"
* Expand "db" to "database" and "database schema" as appropriate
2024-12-11 10:08:55 -08:00
Olivia Lee
c7011fb70d
added "can I use it" section to the docs
This was based on the similar section in the hedgedoc. I dropped the bit
about grapevine users getting banned from the conduwuit rooms cause we
haven't heard about that happening for a while and the original case was
pretty unclear.
2024-12-09 21:03:57 -08:00
Olivia Lee
eda34adef2
add conduit migration section to docs
Most of the database compatibility info came from Charles' notes
in #17.
2024-12-09 21:03:57 -08:00
Olivia Lee
26e986a89b
update olivia's gitlab and matrix usernames 2024-12-06 11:37:11 -08:00
Olivia Lee
a5fe9129f1
update media deletion entry in changelog 2024-12-01 16:18:05 -08:00
Charles Hall
af15f0c596
update rust dependencies
Except OTel stuff, as usual.

The main point is to bump `ruma-state-res` for a state resolution fix.
2024-11-18 11:07:23 -08:00
Charles Hall
93c714a199
update changelog 2024-11-12 00:36:36 -08:00
Charles Hall
1148c6004f
make all caches individually configurable
Also:

* Removes the `cache_capacity_modifier` option
* Renames the `pdu_cache_capacity` option to `cache.pdu`
2024-11-01 14:25:52 -07:00
Andreas Fuchs
9529d43a21 ChangeLog entry for check-config subcmd 2024-11-01 12:16:49 -04:00
Lambda
3247c64cd8 Add support for HAProxy proxy protocol for listeners 2024-10-25 20:48:38 +00:00
Charles Hall
e0cf163486
delete useless admin commands
To clear caches, restart the server. We may want to consider adding the
cache sizes and database memory usage as metrics in the future.
2024-10-20 13:29:28 -07:00
Andreas Fuchs
76a633cb66
Log failed remote resident server join requests 2024-10-13 19:26:35 -07:00
Andreas Fuchs
e001356653
Return local join error if all remote joins fail
If all join requests to resident servers fail or if the joining server
is the only resident server (i.e. the room is local-only), we would
previously send a 500 error, even if the more correct response would be
M_UNAUTHORIZED (e.g. if the user tries to join an invite-only room).

To fix this, we now return the error generated by attempting the join
locally, which correctly informs the client about why their request
failed.
2024-10-13 19:10:58 -07:00
Lambda
e14b7f28f2
Implement federation self-test 2024-09-27 10:51:32 -07:00
Lambda
94d523ebcb
Reload TLS config on SIGHUP 2024-09-27 09:51:17 -07:00
Charles Hall
6ab87f97dd
include traceresponse header if possible
This can help with debugging.
2024-09-26 19:01:15 -07:00
Lambda
084d862e51
Allow configuring served components per listener 2024-09-23 16:43:52 -07:00
Charles Hall
c24f79b79b
update rust deps except rocksdb and otel clownery
* OTel v0.25.0 requires downgrading Tokio to 1.38 [0]
* They have a fix for this but aren't cutting a release just for release
  schedule reasons [1]
* Prometheus support (at least for server-pull) was dropped at OTel
  v0.23 and isn't planned to be picked up again until OTel v1 [2]
* No real reasoning was provided for this decision AFAICT [3] [4]
* So many compiler errors
* Unhelpful changelogs

The last two points are what made me give up on trying to upgrade to
OTel v0.24 too.

RocksDB isn't updated because we'd need to update our nixpkgs too but
that causes other problems, such as an upstream bug in liburing when
building for musl.

[0]: https://github.com/open-telemetry/opentelemetry-rust/issues/2094
[1]: https://github.com/open-telemetry/opentelemetry-rust/issues/2094#issuecomment-2346834030
[2]: https://docs.rs/opentelemetry-prometheus/0.17.0/opentelemetry_prometheus/index.html
[3]: https://github.com/open-telemetry/opentelemetry-rust/pull/1792
[4]: https://github.com/open-telemetry/opentelemetry-rust/pull/1792#issuecomment-2121514344
2024-09-23 14:22:55 -07:00
Benjamin Lee
c1bf4a8ee3
changelog entry for CLI compatibility break 2024-09-21 14:11:40 -07:00
Charles Hall
1ee3bbb316
oops, i dropped my fork
The maintainers had a discussion internally and decided it's unlikely
that we'll have the capacity to try to do a rewrite, which was the
original reason for the suffix's presence. So, now can get rid of it.
2024-09-20 16:52:05 -07:00
Charles Hall
88b009a8d4
update changelog 2024-09-19 15:23:59 -07:00
Lambda
ca6bc74074 Fix X-Matrix signature validation for incoming requests
For HTTP/1 requests, an inbound Request's URI contains only the path and
query parameters, since there's no way to synthesize the authority part.
This is exactly what we need for the X-Matrix "uri" field.

HTTP/2 requests however can contain the :authority pseudo-header, which
is used to populate the Request's URI. Using a URL that includes an
authority breaks the signature check.

Largely inspired by conduit MR !631
(https://gitlab.com/famedly/conduit/-/merge_requests/631).

Co-authored-by: strawberry <strawberry@puppygock.gay>
2024-09-19 16:25:23 +00:00