-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Hostname provided by SNI and in the Host header doesn't match in federation requests #3843
Comments
@dani: we need to see the logs for the requests which are failing - probably a large block of logs at INFO log level on both the source & destination server would help. |
In fact, it seems that synapse >= 0.33.3 who sends put requests on the federation endpoints are not dispatched correctly to synapse backend, but are being answered by a 400 error message by the frontal httpd directly. It might have something to do with the recent SNI change brought in 0.33.3, which somehow doesn't play well with my proxypass setup (request treated by wrong vhost ?). I'll gather the info and post it here ASAP |
Ok, looks like I got it. Requests from other synapse servers (but only those >= 0.33.3) are not valid, because the SNI doesn't match the Host header. Eg, my matrix server is lapiole.org. My ID is @dani:lapiole.org but the DNS name of the box handling it is matrix.lapiole.org (published through the SRV DNS entry), and here are the result:
And the corresponding access_log line
There was no SNI before that, so the request was being treated (through a dedicated vhost listening on a specific port), but now that there's SNI, and that it doesn't match Host, httpd automatically responds with a 400 bad request. It doesn't even reach synapse backend. |
Not sure how nginx (or other proxies) are handling this, but those requests are invalid. And it looks like there's no way to ignore this and serve them anyway with Apache httpd. So indeed, 0.33.3 broke reverse-proxyfied federation |
The problem has already been rised in issue #2525 which has been closed: "the conclusion was that the current behaviour is actually correct". I do not agree with the conclusion. Requests with a mismatch between SNI and Host headers are invalid (not only Apache httpd rejects them, cloudflare also does for example, see https://support.cloudflare.com/hc/en-us/articles/204872628-Error-1013-HTTP-hostname-and-TLS-SNI-hostname-mismatch) |
Indeed there should not be a mismatch between SNI and Host. (The topic of #2525 was what they should be set to.) I'll have a look at this later. |
Running synapse since several months behind a proxypass, including the federation port. I'm using apache httpd as reverse proxy. I have to servers (same config). As soon as I update one of those to 0.33.3 (or now 0.33.4), federation don't work anymore. The homeserver 0.33.4 can't send anything to the one still at 0.33.2
I can see a lot of resp 400 from synapse to the rev proxy each time a synapse >= 0.33.3 talks to me (0.33.2). Upgrading this synapse instance to 0.33.4 doesn't change anything. So it's not an incompatibility between >= 0.33.3 and older, but something which broke federation behind a proxypass.
What info would you need to debug this ?
The text was updated successfully, but these errors were encountered: