GatewaySet up
Plan and prerequisites
What a gateway runs, and the server, DNS records, certificate and OAuth app it needs before you install.
The work, in order
The pages set up one gateway on one Ubuntu 24.04 server. example.com stands for your domain throughout.
| Phase | What it answers | What you finish with |
|---|---|---|
| Plan, this page | What do I need before I start? | A server, three DNS records, a wildcard certificate, an OAuth app |
| Install | Which packages, and where does the data live? | Postgres with the gateway database, and the service packages |
| Configure | How do the services find each other and their public names? | The configuration under /etc/chan-gateway/, and the services running |
| The edge proxy | How does traffic from the internet reach the services? | nginx terminating TLS for the three names |
| Accounts and OAuth2 sign-in | Who may sign in? | Your own account, signed in, with its username set |
| Publish a devserver | Does it work end to end? | A devserver online, opened in a browser, and shared |
| WireGuard, optional | Can desktops reach the proxy nodes through WireGuard? | Desktops enrolled at sign-in |
| Operate | How do I run it from day to day? | The admin CLI, more nodes, upgrades, health checks |
What you run
A gateway is a few small services, a Postgres database and a TLS edge in front. Each service listens on loopback; the edge publishes only what must be public.
| Service | Does | Reached at |
|---|---|---|
| identity | OAuth2 sign-in with GitHub, Google or GitLab, the account page, access tokens, sharing, the desktop's sign-in | gw.example.com |
| profile | Accounts, devservers, shares and policy, in Postgres | Internal only |
| devserver-control | Admits devservers and tracks the proxy nodes. No devserver traffic crosses it. | Internal only |
| devserver-proxy | Takes the devservers' tunnels and serves each devserver at an origin of its own | proxy.example.com, *.p1.proxy.example.com |
| wireguard-agent | Optional: keeps a proxy node's WireGuard peers in step with the gateway | No listener |
chan-gateway-admin | The operator's command line | Run as root on the server |
A devserver's machine needs no inbound port, DNS name or certificate: it dials out to the gateway with an access token. The gateway guide draws the traffic.
Details and limits
gw.chan.appis the maintainer's own deployment of this code: experimental, with OAuth2 sign-in off by default. It is not a hosted product and takes no sign-ups.- To run the services on Kubernetes instead of one server, follow packaging/kube. The WireGuard agent has no manifest, since it changes the host's own network interface.
What you need
| You need | For | Who provides it |
|---|---|---|
| A server: Ubuntu 24.04, amd64 or arm64, TCP ports 80 and 443 open | Every service, Postgres and nginx | You, with sudo on it |
| A domain whose DNS you control | The three names below | Whoever manages the domain's DNS |
| An API credential at your DNS provider | The DNS challenge a wildcard certificate needs | The DNS provider's account |
| An OAuth app at GitHub, Google or GitLab | OAuth2 sign-in | An account at that provider, or an admin of its organization |
| UDP port 51820 open, only for WireGuard | Desktops' WireGuard tunnels | You, at the server's firewall |
DNS and a certificate
Point three records at the server:
| Name | Serves |
|---|---|
gw.example.com | OAuth2 sign-in, accounts, and desktop discovery. |
proxy.example.com | Tunnel ingress, where devservers dial in, and proxy health. |
*.p1.proxy.example.com | One origin per devserver on proxy node p1. A *.example.com record does not cover these names. |
The services speak plain HTTP on loopback, and nginx terminates TLS in front of them. The wildcard name needs a certificate from a DNS challenge, so install certbot with the plugin for your DNS provider. With Cloudflare:
$sudo apt install certbot python3-certbot-dns-cloudflare
sudo certbot certonly --dns-cloudflare \
--dns-cloudflare-credentials /root/cloudflare.ini \
-d gw.example.com -d proxy.example.com -d '*.p1.proxy.example.com'
The certificate lands in /etc/letsencrypt/live/gw.example.com/, where the edge configuration reads it, and certbot renews it on its own.
Details and limits
- With WireGuard,
p1.proxy.example.comneeds a record of its own: desktops dial it, and the wildcard record does not cover the name itself. - Each further proxy node adds a wildcard of its own, such as
*.p2.proxy.example.com. See More proxy nodes. - A certificate from a CA of your own works for a gateway on an internal network. Install that CA in the system trust store of every machine that runs Chan Desktop, a devserver or the WireGuard agent.
- On macOS and Windows, chan verifies the gateway through the system, as a browser does. On Linux it reads the system's CA bundle (
update-ca-certificateson Debian and Ubuntu,update-ca-truston Fedora) beside the roots it carries. - chan reads the trust store when it starts: restart a running desktop, devserver or agent after installing a CA.
An OAuth2 sign-in provider
The gateway needs at least one of GitHub, Google and GitLab. For GitHub, open Developer settings, choose New OAuth App, and set:
| Field | Value |
|---|---|
| Homepage URL | https://gw.example.com |
| Authorization callback URL | https://gw.example.com/auth/github/callback |
Keep the client ID and a client secret for Configure. For Google or GitLab, the callback ends in /auth/google/callback or /auth/gitlab/callback.