-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Support UNIX sockets for HTTP interfaces #4975
Comments
support for what? the CS-API? I'm struggling to see how that would be useful. |
It would be useful for people who don't want to open a localhost TCP port when they have a proxy in front of synapse. |
Fair enough. I wasn't aware that http-over-unix-sockets was even a thing. |
+1 to this request. It's really common practice for app servers like gunicorn, to skip local networking and just use sockets between the frontend (like nginx) and the app server, e.g. http://docs.gunicorn.org/en/stable/deploy.html |
I'm also looking forward to see this getting implemented. |
This would be cool. I am not really a fan of using unprivileged TCP ports for loopbacks. Any unprivileged local user could seize the port if the server shuts down for a while. This issue could perhaps therefore be tagged with the "security" tag? |
This is a quick hack I am using currently.
|
Nice hack. It probably doesn't make a terrible amount of sense to require all the TCP options for a UNIX listener. Having thought about it for a bit, here's what I imagine would happen:
If this seems sensible I might try working on this in the next few days. |
That sounds like a reasonable approach on the face of it. Not sure how gnarly it'll end up being. I suspect the worst part is figuring out how to do the configuration without bloating the config (and being backwards compatible). |
My suggestion for config modifications: Dont Change:
Drop (ignore or throw error if set):
Add:
Another idea, allow to set ipaddrs and unix_paths side by side in bind_addresses... |
@1848 I don't see a good reason to allow listening on multiple paths and/or TCP sockets for a UNIX listener. Surely if you're specifying a UNIX socket to listen on then you intend on using a reverse proxy, right? |
@auscompgeek I am with you. I could imagine corner cases where it would make sense (e.g. multiple frontends, some of them unable to use unix sockets) but yeah, corner cases... |
Yeah, you could give your metric scraper access to one socket and your reverse proxy access to the others. I can definitely see the use cases. Ideally it would be supported to pass these in from systemd (or similar runners) so that synapse doesn't need to worry about permissions and socket options and just let the service manager deal with that. This also allows hitless restarts, socket activation and other niceties. |
Do we consider this closed by #15353? |
Almost. There's a little more to do yet. Note for those watching, metrics won't happen at this time. That's a completely separate problem this won't help with. |
Should probably be implemented in a wrapper around
synapse/synapse/app/_base.py
Line 162 in 9482a84
See https://twistedmatrix.com/documents/8.2.0/api/twisted.internet.interfaces.IReactorUNIX.html.
The text was updated successfully, but these errors were encountered: