Self-hosted relay (kettu-relay)
Deploy kettu-relay on your own server and connect from Desktop, Android, iPhone/iPad, daemon, and browser without a Kettu account.
kettu-relay is Kettu’s open source relay that you run on your own server. Once your computers sign in to it, your Android phone, iPhone/iPad, other computers, or browser can reach them from any network—with no Kettu account, no VPN, and no port forwarding on your computers.
The relay only forwards Kettu’s end-to-end encrypted traffic and never sees your sessions, files, or keys.
Order matters: configure the relay key on the host computer only
Do not paste the kettu-relay link (https://…#key=krk_…) into the pairing field on your phone or another computer.
Follow this two-step order:
- Configure your own relay on the computer you want to reach (Desktop app or Daemon)—the access key stays encrypted on that host and is never given to clients.
- Generate a pairing code on that computer (click Add device…), then scan it or paste the pairing link on Android, iPhone/iPad, or another computer. The pairing code automatically carries your relay address (and certificate pin for IP-only relays), so clients need no relay setup and no Kettu account.
1. Deploy kettu-relay and get its link
Pick a publicly reachable server and start kettu-relay using one of the setups below. The first start prints the full relay link (such as https://relay.example.com#key=krk_…), and kettu-relay link prints it again at any time.
Point a domain at your server and open ports 80 and 443 (for automatic Let’s Encrypt certificates), then run on Linux with systemd:
curl -fsSL https://kettu.sh/relay/install | sudo sh -s -- --domain relay.example.com Print the link again later with:
sudo -u kettu-relay sh -c 'set -a; . /etc/kettu-relay.env; kettu-relay link' Point a domain at your server and open ports 80 and 443:
docker run -d --name kettu-relay --restart unless-stopped \
-p 80:80 -p 443:443 \
-e KETTU_RELAY_DOMAIN=relay.example.com \
-v kettu-relay:/data \
ghcr.io/kettuai/relay:latest
docker exec kettu-relay kettu-relay link Without a domain, open port 443 and pass your server’s public IP address. kettu-relay creates a self-signed certificate and includes its public-key SHA-256 pin in the link:
# Linux systemd install script
curl -fsSL https://kettu.sh/relay/install | sudo sh -s -- --ip 203.0.113.7
# Or Docker
docker run -d --name kettu-relay --restart unless-stopped \
-p 443:443 \
-e KETTU_RELAY_IP=203.0.113.7 \
-v kettu-relay:/data \
ghcr.io/kettuai/relay:latest
docker exec kettu-relay kettu-relay link The link looks like https://203.0.113.7#key=krk_…&pin=…. Desktop, Daemon, iPhone/iPad, and Android (v0.0.7 and later) all verify this certificate pin directly.
Browsers require a domain
Browsers cannot pin self-signed certificates, so an IP-only relay does not serve the web client. Use a domain if you want browser access.
If Caddy or nginx already terminates HTTPS, run kettu-relay on loopback (127.0.0.1:8798 by default) and set KETTU_RELAY_URL to the public HTTPS URL:
KETTU_RELAY_URL=https://relay.example.com kettu-relay Make sure nginx forwards WebSocket upgrades and keeps connections open:
location / {
proxy_pass http://127.0.0.1:8798;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 1h;
} In Docker behind another proxy container, also set KETTU_RELAY_LISTEN=:8798 and KETTU_RELAY_TRUSTED_PROXIES. See the full kettu-relay deployment guide for every setting.
Keep the relay link private
Anyone who has the full relay link (with #key=krk_…) can sign computers in to your relay. If it leaks, run kettu-relay key reset—the old key stops working within seconds.
2. Connect your host computer to the relay
Configure the computer you want to access remotely (Desktop app or server Daemon) first.
Open Settings › Remote access and turn on Remote access.
Under Relay, choose Your own relay.
Paste the full relay link (https://relay.example.com#key=krk_…, or https://203.0.113.7#key=krk_…&pin=… for IP-only relays) into Address. Kettu automatically splits the address, access key, and certificate pin into the right fields (or you can enter them separately).
Click Use this relay. Kettu verifies the address, certificate/pin, and access key before switching. Once connected, the status card shows Connected · xx ms · relay x.y.z.
If you want clients to connect exclusively through your relay, you can turn off Direct connections on the same page (leaving it on lets devices on the same Wi-Fi or VPN connect directly).
On a server running Kettu’s daemon, run (keep single quotes around the # link):
kettu relay use 'https://relay.example.com#key=krk_...'
kettu relay status In Docker or automated setups, you can instead set the KETTU_RELAY_LINK environment variable so the daemon checks and uses it on every start.
3. Pair your phone, another computer, or browser
Once the host computer shows Connected, pair your client devices. The pairing code already carries your relay address (and IP certificate pin)—no relay key and no Kettu account are needed on the client.
Make sure the Android app is on v0.0.7 or later (adds full domain and IP-pinned self-hosted relay support; get the latest APK on the Download page).
On the host computer, open Settings › Remote access, click Add device… under Devices, and keep Open with set to App (on a daemon server, run kettu pair). A QR code and pairing link appear.
Open Kettu on Android:
- First launch (signed out): tap Continue without an account to use Kettu account-free.
- Already inside the app: open Computers, tap Add a computer, and choose Scan a pairing code or Paste a pairing link.
Scan the QR code on the host computer, or choose Paste a pairing link and paste the pairing link from Add device… (not the #key= relay link).
Back on the host computer, verify the device name/code and click Add to approve pairing (or confirm in the daemon terminal).
Once paired, the computer card and dashboard show Its own relay, <your relay>.
Later, you can also view status, switch relay addresses, or replace the host’s access key directly from Android under the computer’s Dashboard › Remote access and devices › Relay › Your own relay (pasting a full #key=&pin= link splits automatically).
The iPhone and iPad app supports both domain-based and IP-pinned self-hosted relays with no Kettu account required.
On the host computer, open Settings › Remote access › Add device… with Open with set to App (or run kettu pair on a daemon server).
Open Kettu on iPhone or iPad:
- First launch (signed out): choose Local (no account) and tap Scan a pairing code (or Paste a pairing link).
- Already inside the app: open Computers, tap Add a computer, and choose Scan a pairing code or Paste a pairing link.
Scan the QR code displayed on the host computer.
Click Add on the host computer to finish pairing.
The computer page then shows Online · through <your relay>. Tap Remote access and devices on that computer to inspect relay latency/version or tap Change to update the host’s relay address or access key.
To control one computer from another desktop running Kettu, only the host (controlled) computer needs the relay access key—the controller computer gets the relay address from the pairing link.
On the host computer, open Settings › Remote access › Add device…, keep Open with on App, and click Copy (or run kettu pair on a daemon server).
On the controller computer, open Settings › Hosts, click Add host…, paste the pairing link, and click Add.
Confirm by clicking Add in the approval prompt on the host computer.
Name the controller device on the controller computer and click Done.
When running on a domain, kettu-relay automatically downloads and serves Kettu’s web client directly from your own domain (without touching app.kettu.sh).
On the host computer, open Settings › Remote access › Add device… and switch Open with to Browser.
Scan the QR code or open the https://<your relay>/pair#… link in your browser.
Click Add on the host computer to approve the browser.
See Web client · Through your own relay. Browsers cannot verify self-signed certificate pins, so IP-only relays require the Desktop, iPhone/iPad, or Android app instead.
4. Switching relays, rotating keys, and automatic migration
- Switching relay addresses: Click Change… in Settings › Remote access › Relay on the host computer (or from Remote access and devices on iPhone/Android). Any client that is online at the time moves to the new relay automatically; offline devices pick up the change the next time they connect on the same network, or when paired again.
- Rotating the access key: Run
kettu-relay key resetandkettu-relay linkon the relay server. The host computer’s status changes to Refused · the relay has a new access key—click Paste new link… or Replace… and paste the new link. Paired phones and browsers do not need to re-pair.
5. Troubleshooting
| Symptom | Cause and fix |
|---|---|
| Phone says the pasted link is not a valid pairing code | You likely pasted the kettu-relay relay link (#key=krk_…). Configure that link on the host computer under Settings › Remote access › Relay › Your own relay, then use Add device… to generate a pairing code for your phone. |
| Android cannot connect to an IP-only relay or lacks self-hosted relay controls | Update the Android app to v0.0.7 or later, and verify the host computer was configured with the full link including &pin=…. |
| Client says it cannot reach the relay | Check that kettu-relay is running, firewall/security group allows TCP 443, and TLS is valid. Behind nginx, verify Upgrade, Connection "upgrade", and proxy_read_timeout 1h are set. |
| Client says the computer is offline on the relay | Your relay is reachable, but the host computer is not signed in to it. Confirm Kettu is running on the host, Remote access is on, and Relay shows Connected. |
| Host shows Refused · the relay has a new access key | The key changed or was reset with kettu-relay key reset. Run kettu-relay link on the server and paste the new link on the host. |
| Browser fails to open an IP-only relay | Browsers cannot pin self-signed certificates, so IP-only relays do not serve the web client. Bind a domain for browser access, or use Desktop, iPhone/iPad, or Android. |