Keeping chatmail relays reachable when they are blocked: signed relay paths and shared proxy links

Hi all,

I maintain SeyLock (GitHub - Arkhanhel/seylock: Reach your own servers from networks that block them. Signed lists of ways in, paths that race at connect time, a local reverse proxy and a C ABI for any app. Rust, MPL-2.0. · GitHub), an MPL-2.0 Rust library that helps an app reach its own servers when they are blocked. Before building anything for Delta Chat, I would like to ask whether it would be useful.

This is not a request for proxy support: that exists (Socks4/5 and HTTP proxy support, Add proxy settings to mobile apps). It is about the step after it. Two recent threads made me write:

Expected behavior

When a user’s network blocks their relay (by address, by name or by port), Delta Chat keeps reaching it without the user finding and pasting a proxy:

  1. Signed paths. The relay operator publishes a signed list of ways to reach the relay: other addresses, other names, names behind a CDN, TLS through volunteer proxies, Tor.
    • The app tries them in parallel at the connection stage and uses the first that connects.
    • It remembers per network which one worked, so the next connection on a blocked network is fast.
    • A newer signed list can arrive over any channel, and an older one is refused.
  2. Shared links still work. Proxy links that users already share (socks5://, http, ss://) become one more path in the same race.
  3. No single copy reveals everything. Different users get different parts of the list, so a censor cannot block every path from one copy of the app.

Actual behavior

The app connects directly unless the user has configured a proxy. On a blocked network the relay is unreachable until the user finds a working proxy, often a QR code shared in a chat, and adds it by hand. That works for people who manage the step. Many never do, and every shared proxy is visible to the censor too.

What exists, and what I would build

  • Exists. SeyLock 0.2.0 does point 1 for HTTP: it is on crates.io, with Swift and Android packages and a C ABI. In our lab (real TLS, iptables, tc netem; RACE_LAB.md), the first request takes 0.8 s instead of 12.3 s when the direct path is silently dropped.
  • Does not exist yet. A stream mode for IMAP and SMTP, and points 2 and 3. I would build those.

I am applying to the Open Technology Fund to fund this work. If you think it is worth trying, I would do the first pilot as a branch of chatmail/core for you to evaluate, with no commitment on your side.

My questions:

  • Would this be useful, or does it overlap with something you already plan?
  • What would rule it out: binary size, dependencies, how relays are configured today?
  • Who in the core team would be the right person to talk to?

A “no” now is just as helpful as a “yes”. Thank you.

Yurii Arkhanhelskyi

Hi and welcome!

As someone who doesn’t make decisions:
Sounds cool, but, I’m afraid, too complex for something to implement in Delta Char directly.

Chatmail relays are anyways supposed to be lightweight enough so as to not need a secondary way to reach them. If an admin can set up a proxy server, they can also set up another chatmail relay.
So the entire concept may be simplified down to “singed relay lists”.

Also can’t this whole thing be abstracted away from Chatmail relays and instead just be about having "signed paths to a host (or host + port)?
Then it’s just going to be a third-party VPN-like piece of software or at least a library with small API.

Thanks for the quick and detailed answer!

I agree that embedding this directly into Delta Chat is too complicated, and I won’t
insist on this. Your thought about signed paths to the host and port with
a small API is exactly what I strive for in a library. Now she
It only works with HTTP, and the host + port mode is next in my plans.

Hence the question about the simplest option: what if such a program raises
on the phone there is a local SOCKS5 proxy (like Orbot) and it will choose
working path from signed list? Then Delta Chat will connect to it via
already existing proxy setting and do not change anything in Delta Chat itself
necessary. Do you see a catch in this - for example, with IMAP or with the way the kernel
does it work with a proxy?

About “signed lists of relays” as is usually done now
does a user, if his repeater is blocked, start a new one on another?
Would the project benefit from such a signed list?

A small clarification: I prepared the first message using the AI assistant he
helped me gather facts and structure. I am writing this answer myself.

Yuri

Thank you for genuinely considering chinese users​:folded_hands:

Hm yes, I think there is a catch, so my idea needs polishing (or clarification). The thing is that Delta Chat would be responsible for TLS, so I believe the TLS server would have act the same way for all the different ways one can connect to it over TCP, so that this connection redirection is not treated by the TLS client as a MITM.

Otherwise things should work fine, setting up a local SOCKS5 listener and connecting Delta Chat to it should work I believe.

Currently a Delta Chat profile can have up to 5 relays. They are not added/rotated automatically (see related topic Anti-censor relays distribution).
Currently Delta Chat listens on all relays at the same time.

Personal opinion: turning Chatmail relays into something completely ephemeral, something to automatically rotate every day or hour, for the purposes of censorship circumvention, is not something that Delta Chat should go for. At least right now it doesn’t seem like something that’s one small step away. That would basically mean reinventing Tor or Snowflake, except worse because you can only use this for Delta Chat but not to browse the internet.

BTW automatic rotation would be possible to do with, again, third-party software, if Delta Chat exposed its JSON-RPC server (API).