# Running a Taper server This is how to run the prototype server for real people. It is a single process. It hosts the web client, so your users need only one link. **Status:** prototype. It has no external security audit, and federation is experimental (no retry queue or backfill, and no media across servers). Run it for a community you know, not as a public service. ## What you need - A Linux host with a public IP address and port 443 free. - A domain name pointing at it, and a TLS certificate for that name, for example from Let's Encrypt through certbot or lego. - Either Node.js 22 or later (for systemd), or Podman or Docker. ## The two directories, and backups Taper keeps two directories, and **they must never be backed up together**: | Directory | Holds | Back it up? | |-----------|-------|-------------| | `data` | the database `taper.db` (SQLite; the format version is in `PRAGMA user_version`, and an older server refuses a newer database): accounts (OPAQUE records), public keys, security-key records, suspension and deleted-user records, identity copies sealed by the users, and messages, queues, media and key-backup parts encrypted under daily keys | Yes | | `keys` | the daily keys that unlock messages, and `opaque.secret` | **Only `opaque.secret`**, kept somewhere else | Messages expire after 21 days. The server destroys a day's key when everything under it has expired, plus one more day of margin (a key lasts about 22 days after its day ends, not 21), and then every copy of those messages becomes unreadable at once, including copies in your backups. If you back up the daily keys, expired messages stay readable in the backup, which defeats that. `opaque.secret` is different: it is needed for every login. **If you lose it, every user is locked out.** Back up that one file, separately from the data, as you would a TLS private key. **What a backup of `data` holds, and what a restore does.** The plain records are never shredded: a backup holds every account, token hash, public key, security-key record, suspension and deleted-user record as it was, for as long as you keep it. If you restore an old backup, accounts that users have since deleted and keys they have since removed come back, and the deleted-user records written after the backup are lost, so a deleted name can be registered again. Restoring without the daily keys loses the sealed rows (messages, queues, media and key-backup parts): users' clients upload their room keys again when they next log in. Take backups of a stopped server, or with SQLite's own backup tool, not by copying `taper.db` while it is running. ## Option 1: systemd ```sh useradd --system --no-create-home --shell /usr/sbin/nologin taper git clone /opt/taper-src cd /opt/taper-src install -d /opt/taper/server /opt/taper/client cp server/index.js server/config.js server/util.js server/sessions.js server/rooms.js server/keys.js server/media.js server/quota.js server/auth.js server/account.js server/federation.js server/gateway.js server/operator.js server/events.js server/fed.js server/store.js server/state-res.js server/padding.js server/socks.js server/webauthn.js server/admin.js server/dms.js server/dms-order.js server/package.json server/package-lock.json /opt/taper/server/ cp client/index.html client/style.css client/*.js client/package.json client/package-lock.json /opt/taper/client/ (cd /opt/taper/server && npm ci --omit=dev --ignore-scripts) (cd /opt/taper/client && npm ci --omit=dev --ignore-scripts) install -d -m 0750 -o root -g taper /etc/taper /etc/taper/tls install -m 0640 -o root -g taper deploy/taper.env.example /etc/taper/taper.env $EDITOR /etc/taper/taper.env # server name, gateway path install -m 0644 deploy/taper.service /etc/systemd/system/taper.service ``` Install the certificate where the service reads it, and again after every renewal. With certbot, as a deploy hook: ```sh # /etc/letsencrypt/renewal-hooks/deploy/taper #!/bin/sh install -m 0640 -o root -g taper "$RENEWED_LINEAGE/fullchain.pem" /etc/taper/tls/fullchain.pem install -m 0640 -o root -g taper "$RENEWED_LINEAGE/privkey.pem" /etc/taper/tls/privkey.pem systemctl reload taper ``` `systemctl reload taper` makes the server re-read the certificate without dropping anyone's connection. Then: ```sh systemctl enable --now taper journalctl -u taper # "Taper gateway on wss://..." ``` The data is in `/var/lib/taper/data` and the keys in `/var/lib/taper/keys`. ## Option 2: a container ```sh podman build -f deploy/Containerfile -t taper . podman volume create taper-data podman volume create taper-keys podman run -d --name taper -p 443:8443 \ -v taper-data:/var/lib/taper/data -v taper-keys:/var/lib/taper/keys \ -v /etc/taper/tls:/tls:ro \ -e TAPER_TLS_CERT=/tls/fullchain.pem -e TAPER_TLS_KEY=/tls/privkey.pem \ --env-file /etc/taper/taper.env -e PORT=8443 \ taper ``` After a certificate renewal, run `podman kill --signal HUP taper`. The certificate files must be readable by the container's `node` user (uid 1000). The image holds the same server files as the systemd install above. If you add a module to `server/`, add it to both lists, or the server won't start. ## Inviting people Your users' link is https:/// It opens the web client, which connects back to the same path. Share it the way you would share a private group's invite: directly, not on a public page. Anyone without the path sees only the cover website (yours, from `TAPER_COVER_DIR`, or a plain placeholder page). Registration needs a proof-of-work challenge, which the client solves automatically. Passwords never reach the server: Taper uses OPAQUE. Users should pick a strong password, because it also protects their encryption identity and their room-key backup. The client's forms ask for at least 8 characters; the server enforces no minimum, and can't judge strength, because it never sees the password. ## Running the server: operator commands `server/admin.js` is the operator's command line. It talks to the running server over a Unix socket, which the server creates only when `TAPER_ADMIN_SOCKET` is set, with mode 0600. Only the account that runs the server (and root) can open it. Nothing here is reachable from the network, and it can't show message content, because the server has none. With the systemd unit, which makes `/run` read-only, give the service a runtime directory and the socket path (a drop-in, `systemctl edit taper`): ```ini [Service] RuntimeDirectory=taper Environment=TAPER_ADMIN_SOCKET=/run/taper/admin.sock ``` Then, as the service account: ```sh sudo -u taper node /opt/taper/server/admin.js --socket /run/taper/admin.sock users ``` | Command | What it does | |---------|--------------| | `users` | List accounts: user ID, creation day, `SUSPENDED`, number of security keys | | `stats` | Counters: users, rooms, sessions, suspended accounts, current limits | | `suspend USER` | Sign the account out and stop it logging in. The suspension is stored and survives a restart | | `unsuspend USER` | Let it log in again | | `revoke USER` | Sign every device out (tokens and device keys); the account stays | | `unlock USER` | Clear the account's security keys and its "key needed at login" rule, and sign it out. For a user who lost every key | | `delete USER` | Delete the account, exactly as the user's own "Delete my account" does. The user ID is kept, with the time, so nobody can register it again | | `limits` | Show the limits. `limits NAME VALUE` sets one: `registration_open` and `invite_only` (`true` or `false`), `register_pow_bits` (0 to 28), `rate_burst` and `rate_per_sec` (1 to 1000), `budget_scale` (0.01 to 100). Limits change live and **reset to the environment's values at a restart** | | `invite [TTL_HOURS]` | Create a single-use registration invite (`ti_…`), valid for `TTL_HOURS` (default 168, at most 504). With `invite_only` on (or `TAPER_INVITE_ONLY=1`), registration needs one. The server keeps only a hash of the token and its expiry, never who issued or used it | | `rotate-signing-key` | Replace the server's event signing key. The old key signs a proof naming the new one, so peers that pinned it follow the rotation | | `repin-peer SERVER` | Forget the signing key pinned for a federation peer, and close the connection to it, after you have checked the peer's new key with its operator by another route | `USER` is `alice` or a full `@alice:your.server`. The server's log records the action (`admin: suspend`) and never the account. **`unlock` is a way round the security keys.** Anyone who can persuade you can use it to remove a user's second factor, so check who is asking, by a route other than Taper, before you run it. It doesn't give anyone a password. ## Security keys (optional) Users can register FIDO2/WebAuthn keys (YubiKeys and similar). Nothing needs configuring for that to work, with these limits: - A key works only on the host name where it was registered. A server reached by a bare IP address can't use security keys. `localhost`, `.onion` and `https` host names work. - **Every key is "unattested" until you install attestation roots.** `TAPER_WEBAUTHN_ROOTS` is empty by default and the server ships no roots. To make some keys show as "checked", get the attestation root certificates of the key makers you trust, from the makers or another source you trust, put the PEM files (`*.pem` or `*.crt`) in a directory, and set `TAPER_WEBAUTHN_ROOTS` to it. A bad file stops the server at start-up. Which makers to trust is your decision, and "checked" then means only that a key chained to a root you chose. - `TAPER_WEBAUTHN_ORIGINS` (optional, comma-separated, for example `https://example.org`) limits which sites may use keys on this server. - If a user loses every key, only you can clear them: `admin.js unlock`. ## Federation Federation is **experimental**, and the server says so in its log at start-up when peers are configured. It is allowlist-only. Agree with another operator, exchange federation paths privately, and list each other in `TAPER_FEDERATION_PEERS`. Over Tor, see [Running on Tor](#running-on-tor). Conflicting state changes made at the same time on two servers are settled by State Resolution v2.1. Federation doesn't yet carry media between servers, retry failed deliveries, or backfill missed history. Each peer's signing key is pinned the first time it is seen; a new key is accepted only with a signed rotation proof from the pinned one (see `rotate-signing-key` and `repin-peer` above). ## Running on Tor Taper can run as a Tor onion service, with or without an ordinary address. That hides where your server is and who connects to it, and needs no domain name or certificate authority. 1. Install Tor from your distribution (`apt install tor`), and add [`torrc.example`](torrc.example) to its configuration. 2. Start Taper on loopback, without TLS (the onion service already encrypts and authenticates the connection): ```sh TAPER_SERVER_NAME=$(cat /var/lib/tor/taper/hostname) \ HOST=127.0.0.1 PORT=8080 \ TAPER_GATEWAY_PATH=/$(head -c 24 /dev/urandom | base64 | tr '+/' '-_') \ TAPER_TOR_SOCKS=127.0.0.1:9050 \ TAPER_DATA_DIR=/var/lib/taper/data TAPER_KEY_DIR=/var/lib/taper/keys \ node /opt/taper/server/index.js ``` Using the onion address as the server name means user IDs look like `@alice:
.onion`. It can't be changed later, so **back up `/var/lib/tor/taper/hs_ed25519_secret_key`**. Losing it loses the address and every account with it. Keep it apart from the data backups, like `opaque.secret`. 3. Invite people with `http://
.onion/`. It must be opened in **Tor Browser at the Standard security level**. The Safer and Safest levels block WebAssembly, which the client needs for encryption and login. If your users can't use Standard, they need a native client. Notes: - **Federating over Tor:** list peers by onion address (`TAPER_FEDERATION_PEERS=.onion=ws://.onion/`) and set `TAPER_TOR_SOCKS`. Every federation connection then goes through Tor, each peer on its own circuits, and names are never looked up in DNS. The server refuses plain `ws://` to anything but onion and loopback addresses, because a Tor exit could read it. - **Post-quantum:** Tor's own encryption is not post-quantum yet. If that matters for you, also give Taper a certificate (`TAPER_TLS_CERT`) and publish port 443 in the onion service, so the hybrid post-quantum TLS runs inside Tor. - **Private communities:** Tor's client authorization means only people holding a key can reach the onion service at all. - **Tested:** `server/test-tor-live.js` runs two servers as onion services on the real Tor network, with users who register, federate and exchange encrypted messages only through Tor. It takes a few minutes and needs Tor and Internet access: `cd server && node test-tor-live.js`. Where Tor is blocked, add `TAPER_TOR_BRIDGES=snowflake` (through `snowflake-client`), or `TAPER_TOR_BRIDGES=`, a file of bridge lines such as the WebTunnel lines you received (through `lyrebird`). On 2026-11-23, on a network that blocks Tor relays, it passed through Snowflake both ways: with `snowflake-client`, and with lyrebird reading the bridge lines from a file. Each run took about 3 to 5 minutes. ## Where Tor is blocked: bridges, and REALITY Some countries, China among them, block Tor's public relays and actively probe suspected proxies. **First choice: Tor bridges.** Nothing changes on your server, there's no impersonation, and the Tor Project keeps the circumvention working. Bridges are slower, and none works everywhere all the time. - **WebTunnel** looks like an ordinary HTTPS website, so it is the hardest to block. Use it where Snowflake doesn't work. - Its bridges are given out a few at a time, never in a public list: on https://bridges.torproject.org (choose WebTunnel), from `@GetBridgesBot` on Telegram, or by email to `bridges@torproject.org` from a Gmail or Riseup address. - Point your users to these channels; they can't be given bridges by Taper. - **Snowflake** is built in and needs nothing from the user, but is slower and easier to block. - **Where to set them:** - Tor Browser: Settings → Connection; - the desktop app: **Bridges…** on its connecting screen (see `desktop/README.md`). - **A private bridge for your community.** You can also run your own WebTunnel bridge with `BridgeDistribution none`, so it's never given out publicly, and hand its bridge line out with your invites. The Tor Project's WebTunnel bridge guide covers setting one up. Run it on a different machine and address from your Taper server, so that blocking one doesn't block the other, and so the bridge doesn't link your users to your server. **Operator's choice, at your own risk: Xray REALITY in front of Taper.** REALITY makes your server's TLS handshake look like another website's. The Taper spec deliberately doesn't include it: browsers can't speak it, so users need a separate app (an Xray client such as v2rayN, set as their system proxy); it depends on a fragile choice of target site; and it impersonates another organisation. In some places, owning such an app is itself a legal risk for users. If you run it anyway, these are the mistakes that undo the protection: 1. **`target` (called `dest` in older Xray) must be a real outside site,** not Taper. It is where unauthenticated visitors and censors' probes are sent. Pointing it at `127.0.0.1:8080` shows probers your Taper server instead of the site you claim to be. 2. **Choose a target site hosted in your server's own network.** A small VPS claiming to be `www.microsoft.com` is easy to spot by comparing the server name with who owns the IP address. 3. **Lock routing to Taper.** In VLESS the client chooses the destination, so without routing rules every key holder can use your server as an open proxy to anywhere. Send REALITY traffic for one name to Taper, and block everything else. 4. **Turn the access log off** (`"log": {"access": "none"}`). Xray otherwise logs every connection by user ID: a record of who uses your server. 5. **Keep TLS in Taper.** The web client needs a secure context (`https://`) for its cryptography, and browsers send loopback addresses around the proxy, so users must reach Taper by its real `https://` name through the tunnel. Keep `TAPER_TLS_CERT` set. Use the `xtls-rprx-vision` flow, which is designed for TLS carried inside REALITY. 6. **Install Xray the way you install everything else:** from a pinned, verified release, never by piping a script from the Internet into a root shell. A routing sketch (check the field names against the documentation for your Xray version): ```json { "log": { "access": "none", "loglevel": "warning" }, "inbounds": [{ "tag": "reality-in", "port": 443, "protocol": "vless", "settings": { "clients": [{ "id": "", "flow": "xtls-rprx-vision" }], "decryption": "none" }, "streamSettings": { "network": "tcp", "security": "reality", "realitySettings": { "target": ":443", "serverNames": [""], "privateKey": "", "shortIds": [""] } } }], "outbounds": [ { "tag": "to-taper", "protocol": "freedom", "settings": { "redirect": "127.0.0.1:8443" } }, { "tag": "block", "protocol": "blackhole" } ], "routing": { "rules": [ { "type": "field", "inboundTag": ["reality-in"], "domain": ["full:"], "outboundTag": "to-taper" }, { "type": "field", "inboundTag": ["reality-in"], "outboundTag": "block" } ] } } ``` Taper then listens with TLS on `127.0.0.1:8443` for its real host name. Each user's client config holds your server's address and public key: if one leaks, the address is burned. Hand configs out one by one, like invites. ## Checklist before inviting anyone - [ ] `TAPER_GATEWAY_PATH` is random (the server refuses to start with TLS otherwise). - [ ] `https:///` shows your cover site, and nothing mentions Taper. - [ ] `opaque.secret` is backed up somewhere other than the data backups. - [ ] Data backups don't include `/var/lib/taper/keys`. - [ ] The certificate renewal hook installs the certificate and reloads the server. - [ ] Core dumps are off (the systemd unit sets `LimitCORE=0`). - [ ] On Tor: `hs_ed25519_secret_key` is backed up, apart from the data. - [ ] `server/webauthn.js` and `server/admin.js` are in the installed copy (or the image). - [ ] If you want the admin command line: `TAPER_ADMIN_SOCKET` is set to a path only the service account can reach, and you have run `admin.js users` once. - [ ] You decided whether to install attestation roots (`TAPER_WEBAUTHN_ROOTS`). Without them every key is "unattested".