Backend for Sapphire (C)

Alyssa Rosenzweig 641f96764f Resurrect instances il y a 5 ans
accounts 05e8dde29c Accounts/README il y a 5 ans
.editorconfig 3ef6ef2b3b Add .editorconfig il y a 5 ans
.gitignore 960b1c4ba5 Ignore the proxy il y a 5 ans
LICENSE 7559951990 LICENSE file il y a 5 ans
Makefile 5fa005c302 Migrate push notifications to proxy (fixes major regression) il y a 5 ans
README.md 888e8faec5 .. il y a 5 ans
cert.sh 05f4aff5c2 Opt-in HTTPS il y a 5 ans
core.c 5fa005c302 Migrate push notifications to proxy (fixes major regression) il y a 5 ans
core.h 6465665df5 Strip some old code il y a 5 ans
event-loop.c 60d14a6af1 Refactor event loop il y a 5 ans
event-loop.h 60d14a6af1 Refactor event loop il y a 5 ans
jailed.sh 39ceb00ee7 jailed.sh update il y a 5 ans
json_compat.h 1d439ad47a Broadcast write_conv as JSON il y a 5 ans
proxy.c 641f96764f Resurrect instances il y a 5 ans
push.c 5fa005c302 Migrate push notifications to proxy (fixes major regression) il y a 5 ans
push.h 5fa005c302 Migrate push notifications to proxy (fixes major regression) il y a 5 ans
sapphire-accounts.json c331633d37 Move push notification email to proxy il y a 5 ans
secure-compare-64.h d1ad08ddcc Add new files il y a 5 ans
websocket.c 496cf70595 Minor fix il y a 5 ans
websocket.h 8664981cd0 Cleanup core given singularity il y a 5 ans

README.md

Backend

sapphire-backend communicates only over local filesystem-resident sockets, to simplify jailing. To reach the outside world -- in particular, to benefit from websockets -- it must be paired with sapphire-proxy, which implements proxying, authentication, and SSL.

To set this up, use:

$ ./sapphire-backend & ./sapphire-proxy

And if you need to restart, it's probably safest to quit both.

This process might be further streamlined in the future.

Proxy

Historically, on a local single-user Sapphire instance, the architecture was simple:

Browser <--> Backend

However, this does not work for multi-user, public-facing instances. In these cases, to minimise attack surface, this proxy is publicly facing while the backends only listen to localhost and are sandboxed:

Browser <--> Proxy (<--> Backends)

This package proxies WebSockets and implements authentication. It therefore depends on glib/json-glib/libsoup, but it MUST NOT depend on libpurple due to security isolation concerns.