Commit graph

2814 commits

Author SHA1 Message Date
mikoto
2e57497bc8
OpenID routes
Cherry-picked from https://gitlab.com/famedly/conduit/-/merge_requests/681.

Co-Authored-By: Matthias Ahouansou <matthias@ahouansou.cz>
2025-04-16 17:32:36 -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
e249aed1cb
rename Resolver -> FederationResolver and document 2025-04-14 15:50:04 -07:00
Olivia Lee
e98dd5b9a3
put global trust-dns resolver in an Arc
This allows us to reference it in reqwest clients configuration.
2025-04-14 15:50:04 -07:00
Olivia Lee
33f3592612
fix starting the server when db/media dirs do not exist yet
This used to be supported, as we explicitly call std::fs::create_dir_all
when initializing these, but it was broken in
b01b70fc20, which attempts to canonicalize
the paths to check for overlap before creating them.
2025-04-14 15:28:31 -07:00
Olivia Lee
abb1b5681e
add partial_canonicalize helper function
This is useful for checking for potential overlap between paths that
have not been fully created yet.
2025-04-14 15:28:31 -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
Olivia Lee
1529d60a6a
set default database backend in nixos module to rocksdb
The media backend already has a default value.
2025-04-06 20:06:40 -07:00
Charles Hall
1cd12460d7
make systemd patient for startup
RocksDB compaction can take quite a while if it doesn't happen
regularly, which it doesn't, currently.
2025-04-06 15:46:27 -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
Lambda
81c5f09919
service/sending: tiny refactors, NFC 2025-03-30 16:48:06 -07:00
Lambda
d9c7fbbd82
services/sending: avoid unnecessary clone 2025-03-30 16:48:06 -07:00
Lambda
ed12b0bf67
services/sending: guard against federation requests to ourselves
These would always fail and get stuck/retried forever.
2025-03-30 16:48:02 -07:00
Charles Hall
bb80f1cf2e
update rust deps that don't require code changes
I also had to pin ruma because otherwise cargo complained that features
were removed from ruma so it couldn't resolve the dependency by itself.
2025-03-27 16:31:45 -07:00
Charles Hall
a901d62575
skip checks for deps-only derivation
This is probably a crane bug that it's doing this in the first place.
2025-03-27 16:31:41 -07:00
Charles Hall
8b7cbb5f25
update rocksdb
This is done separately since it requires more involved changes than
just cargo's files.
2025-03-27 16:30:52 -07:00
Charles Hall
8da6c5d4b3
bump lockfile format version
This was actually introduced in version 1.83 of the rust toolchain.
2025-03-27 16:30:48 -07:00
K900
7ee117d36a fix: update nix inputs, fix build with latest crane
Fixes references to rustc leaking into the binary.

Flake lock file updates:

• Updated input 'attic':
    'github:zhaofengli/attic/47752427561f1c34debb16728a210d378f0ece36' (2024-11-10)
  → 'github:zhaofengli/attic/ff8a897d1f4408ebbf4d45fa9049c06b3e1e3f4e' (2025-02-02)
• Updated input 'crane':
    'github:ipetkov/crane/ef80ead953c1b28316cc3f8613904edc2eb90c28' (2024-11-08)
  → 'github:ipetkov/crane/70947c1908108c0c551ddfd73d4f750ff2ea67cd' (2025-03-19)
• Updated input 'fenix':
    'github:nix-community/fenix/e10ba121773f754a30d31b6163919a3e404a434f' (2024-11-16)
  → 'github:nix-community/fenix/7d9ba794daf5e8cc7ee728859bc688d8e26d5f06' (2025-03-20)
• Updated input 'fenix/rust-analyzer-src':
    'github:rust-lang/rust-analyzer/1b90e979aeee8d1db7fe14603a00834052505497' (2024-11-15)
  → 'github:rust-lang/rust-analyzer/15d87419f1a123d8f888d608129c3ce3ff8f13d4' (2025-03-18)
• Updated input 'flake-compat':
    'github:edolstra/flake-compat/0f9255e01c2351cc7d116c072cb317785dd33b33' (2023-10-04)
  → 'github:edolstra/flake-compat/ff81ac966bb2cae68946d5ed5fc4994f96d0ffec' (2024-12-04)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/5e4fbfb6b3de1aa2872b76d49fafc942626e2add' (2024-11-15)
  → 'github:NixOS/nixpkgs/698214a32beb4f4c8e3942372c694f40848b360d' (2025-03-25)
2025-03-27 22:37:39 +03:00
Charles Hall
d6475eee6d
remove redundant condition 2025-03-21 16:48:56 -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
218d75d573
update nixos module
Can't believe I forgot to do this...
2025-03-21 16:25:42 -07:00
Charles Hall
a04951541a
don't check canonicalized paths while sandboxed
Because the configured paths won't exist in the sandbox, so
canonicalization would fail.
2025-03-21 16:25:42 -07:00
Charles Hall
50583bc93e
reject overlapping non-canonical paths too
For example, if the database path is `/foo` and the media path is
`/foo/bar`, but `/foo/bar` is a symlink or hardlink to `/baz`, the
previous check would pass. The whole point of this check is to ensure
that the database and media data can't step on each other, so this check
is needed to deny that kind of situation as well.

It would probably be good to add a test for this behavior.
2025-03-21 16:25:31 -07:00
Charles Hall
b01b70fc20
reject overlapping media and database paths 2025-03-20 11:33:59 -07:00
Charles Hall
81a449d1d2
make database path a pathbuf
I'm guessing it wasn't like this already because of one of the admin
commands I deleted.
2025-03-20 11:33:59 -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
Charles Hall
f6b0a10e6e
implement _file in terms of _folder
what the heck lol
2025-03-20 10:40:16 -07:00
K900
fd2a0ac2ab nixos: allow Unix sockets
Because OF COURSE.
2025-03-18 18:18:09 +03:00
K900
ed67ae6418 nixos: fix systemd service type 2025-03-18 13:13:59 +00:00
Charles Hall
adb174d985
don't use file type flake inputs
Because they aren't supported by flake-compat and can't be without IFD.
2025-03-02 11:12:38 -08:00
Charles Hall
114e7ba577
allow supplying custom version extra info in nix 2025-03-02 10:57:13 -08:00
Charles Hall
e11e27bc0c
don't try to set version extra outside flakes
The two attributes being accessed here don't exist when calling though
flake-compat, so we need to handle that case by making the environment
variable unset if neither attribute exists.
2025-03-02 10:54:56 -08:00
Olivia Lee
57c79b1999
Fix native compilation on aarch64
Turns out fenix.packages.aarch64-linux.targets.x86_64-*.minimal.rustc
is an x86_64 compiler. The only component that you actually need to pull
from 'targets' for cross compilation is rust-std.

Because x86_64-unknown-linux-gnu is first in the target list, we were
getting x86 rustc and cargo binaries, making it impossible to compile
grapevine on an aarch64 host.

We were also missing aarch64-unknown-linux-gnu in the targets list,
which is used by the default package on a aarch64 host.
2025-03-02 01:20:51 -08:00
Lambda
65ec500d75 Enable useful new clippy lints
Picked from this filtered list:
https://rust-lang.github.io/rust-clippy/master/index.html?versions=gte%3A82%2Clte%3A84&levels=allow&groups=cargo%2Ccomplexity%2Ccorrectness%2Cnursery%2Cperf%2Crestriction%2Cstyle%2Csuspicious
2025-02-18 17:06:08 +00:00
Lambda
175a62007d Update MSRV to 1.84.0
And appease clippy (`__CARGO_FIX_YOLO=1 cargo clippy --fix` plus some
manual type shuffling).
2025-02-18 17:06:08 +00:00
Lambda
5616510727 Use UInt instead of u32 for max request size
Sometimes you just really want to upload a full disk image as media.
2025-02-18 16:48:47 +00:00
Lambda
99924e5779 Add admin commands to get and reset tracing filters 2025-02-17 17:41:14 +00:00
Lambda
5eab758bd2 Make tracing filter reload handles mutable
Makes the following diff nicer.
2025-02-17 17:40:55 +00:00
Olivia Lee
4cc390345a
don't markdownlint ignored files
I like to put a bunch of untracked stuff in a /scratch directory for
each project, and then puth /scratch in my global gitignore. There are
usually some markdown notes files in here that I don't care about style
for. The previous markdownlint invokation didn't respect the global
gitignore, making local 'engage' runs kinda useless due to false
positives from the scratch dir.
2025-01-23 13:04:59 -08: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
50c1e77cd6
factor canonical alias event validation into a helper function
Not all the semantics from the spec quote in the doc comment are
implemented yet.
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