Reaching your Hub

Reaching your Hub

Reach your Hub with Tailscale

Reach your Hub from your own devices over Tailscale, with a real HTTPS certificate and nothing exposed to the internet.

This page has instructions for several ways of running the Hub. Each is shown under its name.

This page puts your Hub on your Tailscale network (your "tailnet"), so every device you sign in to Tailscale reaches it at an address like https://hub.tailnet-1234.ts.net, with a valid certificate, while nobody else on the internet can connect at all. It is the recommended way for most people. For other options see Reaching your Hub.

Tip

Used the installer? It does this for you when you choose Only on Tailscale. It installs Tailscale if needed, signs the machine in, runs tailscale serve and sets the Hub's address. To switch later, run the installer again and choose Change how it is set up. This page is for doing it by hand, or for understanding what was set up. With the installer, the Docker files are in /opt/postern instead of ~/postern, and the program is /usr/local/bin/postern-hub.

What you get:

  • HTTPS with a real certificate, so passkeys, Google sign-in and Web Push work.
  • No open ports on your router. It also works behind CGNAT.
  • Phones reach the Hub on mobile data, as long as the Tailscale app is connected.
  • Push notifications keep working, because the Hub sends them over outbound connections.

What it costs: every person and every device that uses the Hub needs the Tailscale app and a Tailscale login (your own, or a machine you share with them). Tailscale's free plan covers a household.

Docker Compose

You need Tailscale on the host that runs Docker, not in the container. tailscale serve forwards to 127.0.0.1:8080, which compose.yaml publishes by default.

Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS

You need Tailscale on the machine that runs the Hub. tailscale serve forwards to 127.0.0.1:8080, where the Hub listens by default.

Desktop app (built-in Hub)

This does not work with the desktop app's built-in Hub: it only accepts connections from your own computer, and its address is fixed to http://localhost:<port>. To reach a Hub from your phone, run it on a server (a Raspberry Pi is enough) as described in Set up Postern, then come back to this page and pick that method above.

1. Turn on MagicDNS and HTTPS in your tailnet #

  1. Create a Tailscale account at https://login.tailscale.com if you do not have one.
  2. Open the admin console, page DNS.
  3. Turn on MagicDNS if it is off. It gives every machine a name like hub.tailnet-1234.ts.net.
  4. Further down, under HTTPS Certificates, select Enable HTTPS.

The part tailnet-1234.ts.net is your tailnet's DNS name. It is shown at the top of the DNS page.

Note

Certificates are public. When Tailscale issues one, the machine's full name (hub.tailnet-1234.ts.net) appears in public Certificate Transparency logs. The Hub itself stays unreachable from outside your tailnet, but pick a machine name you do not mind being seen.

Check: the DNS page shows MagicDNS as enabled and HTTPS Certificates as enabled.

If it did not work: only the tailnet's Owner or an Admin can change DNS settings. Ask them, or use your own tailnet.

2. Install Tailscale on the Hub machine #

Docker Compose

Install Tailscale on the Docker host with Tailscale's install script. It detects the distribution and adds Tailscale's own package repository (apt on Debian, Ubuntu and Raspberry Pi OS, dnf on Fedora), so later updates come with your normal system updates:

curl -fsSL https://tailscale.com/install.sh | sh

If you prefer to add the repository by hand, follow the instructions for your distribution linked from https://tailscale.com/download/linux.

Debian and Ubuntu and Raspberry Pi OS

Install Tailscale with its install script. On Debian, Ubuntu and Raspberry Pi OS it adds Tailscale's apt repository and installs the tailscale package, so updates come with sudo apt upgrade:

curl -fsSL https://tailscale.com/install.sh | sh

You can read the script first (https://tailscale.com/install.sh), or add the apt repository by hand following the instructions for your release linked from https://tailscale.com/download/linux.

Fedora and RHEL

Install Tailscale with its install script. On Fedora it adds Tailscale's dnf repository and installs the tailscale package, so updates come with sudo dnf upgrade:

curl -fsSL https://tailscale.com/install.sh | sh

You can read the script first (https://tailscale.com/install.sh), or add the dnf repository by hand following the Fedora instructions linked from https://tailscale.com/download/linux.

Desktop app (built-in Hub)

Not applicable to the built-in Hub.

Then start Tailscale and sign in. The command prints a link; open it in any browser and sign in with your Tailscale account:

Docker Compose, Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS

sudo systemctl enable --now tailscaled
sudo tailscale up

Desktop app (built-in Hub)

Not applicable to the built-in Hub.

Give the machine a short name in the admin console (Machines → the machine → Edit machine name), for example hub. That name becomes the first part of the Hub's address.

Check: tailscale status lists the machine with a 100.x.y.z address, and the admin console shows it as connected.

tailscale status

If it did not work: sudo systemctl status tailscaled shows why the daemon does not run. If tailscale up hangs, the machine cannot reach Tailscale's servers: check the clock (timedatectl) and outbound internet access.

3. Keep the Hub on localhost #

The Hub should keep listening on 127.0.0.1:8080 only, which is the default. Tailscale forwards to it from the same machine, so nothing else needs to reach port 8080.

Docker Compose

In ~/postern/.env, POSTERN_BIND should be missing or 127.0.0.1:8080:

grep POSTERN_BIND ~/postern/.env

Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS

In /etc/postern/hub.env, POSTERN_LISTEN should be 127.0.0.1:8080:

sudo grep POSTERN_LISTEN /etc/postern/hub.env

Desktop app (built-in Hub)

Not applicable to the built-in Hub.

Check: on the Hub machine, curl -s http://127.0.0.1:8080/api/v1/info prints a short JSON document with "apiVersion":1 and your Hub's name.

curl -s http://127.0.0.1:8080/api/v1/info

If it did not work: the Hub is not running. Start it and look at its log (see Troubleshooting).

4. Serve the Hub over HTTPS on your tailnet #

On the Hub machine:

Docker Compose, Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS

sudo tailscale serve --bg 8080

Desktop app (built-in Hub)

Not applicable to the built-in Hub.

This tells Tailscale to accept HTTPS on port 443 of the machine's tailnet address and pass the requests to http://127.0.0.1:8080. --bg keeps it running in the background and across reboots. Tailscale gets the certificate for the MagicDNS name by itself and renews it. It forwards WebSockets (the Hub's live updates on /api/v1/ws) without extra settings, and it adds the X-Forwarded-* headers the Hub reads.

See what is served:

tailscale serve status

It lists the HTTPS address (https://hub.tailnet-1234.ts.net), notes that it is reachable from the tailnet only, and shows that / is proxied to http://127.0.0.1:8080.

Check: from another device in your tailnet (your laptop with Tailscale connected), open https://hub.tailnet-1234.ts.net in a browser. The Hub's sign-in page (or the setup wizard) appears, with a valid padlock. The first request can take a few seconds while Tailscale gets the certificate.

If it did not work:

  • "HTTPS is not enabled" or a certificate error: step 1 is not done, or MagicDNS is off.
  • The name does not resolve: the other device is not connected to Tailscale, or it uses another tailnet. Run tailscale status there.
  • "502 Bad Gateway": the Hub does not listen on 127.0.0.1:8080 (step 3).
  • To undo everything and start over: sudo tailscale serve reset.

5. Tell the Hub its address #

Set the public URL to the exact address from tailscale serve status, and tell the Hub that a proxy is in front of it:

Docker Compose

Add to ~/postern/.env:

POSTERN_PUBLIC_URL=https://hub.tailnet-1234.ts.net
POSTERN_TRUST_PROXY=true

Apply:

cd ~/postern && docker compose up -d

tailscale serve connects to the published port, so the Hub sees the request coming from Docker's network gateway (a private address such as 172.17.0.1). The default POSTERN_TRUSTED_PROXIES already trusts private networks, so leave it unset.

Debian and Ubuntu, Fedora and RHEL and Raspberry Pi OS

Add to /etc/postern/hub.env (sudoedit /etc/postern/hub.env):

POSTERN_PUBLIC_URL=https://hub.tailnet-1234.ts.net
POSTERN_TRUST_PROXY=true
POSTERN_TRUSTED_PROXIES=127.0.0.1,::1

tailscale serve connects from the same machine, so only loopback has to be trusted. Apply:

sudo systemctl restart postern-hub

Desktop app (built-in Hub)

Not applicable to the built-in Hub.

Check: run postern-hub doctor (see Doctor for the command for your install). The Network section shows ✓ https://hub.tailnet-1234.ts.net is reachable and a valid certificate. In the web app, Settings → Admin → Status shows the address and Secure connection (https): Yes.

If it did not work:

  • Saving anything in the web app fails with "Cross-origin request rejected": POSTERN_PUBLIC_URL does not match the address in the browser, or POSTERN_TRUST_PROXY is missing. Compare letter by letter with tailscale serve status.
  • doctor says "is not reachable from this machine": the Hub machine itself must be able to resolve its MagicDNS name. Check that tailscale status works on it and that MagicDNS is on.

6. Finish setup and connect your apps #

If you have not set up the Hub yet, open https://hub.tailnet-1234.ts.net and follow the setup wizard with the setup code from the Hub's log (Set up Postern).

Then, on every device that should use Postern:

  1. Install Tailscale and sign in to the same tailnet. On phones, use the Tailscale app from the App Store or Google Play and leave it connected (Tailscale's VPN switch on).
  2. Open the Postern app and connect to https://hub.tailnet-1234.ts.net, or pair it with a QR code from a device that is already signed in (Pairing).

To let family members in without adding them to your tailnet, share the Hub machine with them from the admin console (Machines → the machine → Share). They see only that machine.

Check: the phone shows your inbox with Tailscale connected on mobile data (Wi-Fi off).

If it did not work: see Phones away from home below.

Phones away from home #

The phone reaches the Hub only while the Tailscale app is connected. If you turn Tailscale off, the Postern app keeps working with the mail it has (it talks to your mail providers directly), and syncs settings with the Hub again when Tailscale is back. See Offline and direct mode.

Push notifications still arrive with Tailscale off. The Hub sends a wake-up to the push relay over an ordinary outbound connection, and the relay passes it on through Apple or Google. Nothing has to reach the Hub from outside for that. See Push relay.

Tailscale Funnel: use with care #

tailscale funnel makes a port reachable from the public internet, not only from your tailnet. Postern does not need it: apps reach the Hub over the tailnet, and push goes out through the relay. Use Funnel only if you have a reason to open the Hub to everyone (for example a browser you cannot install Tailscale on), and then only if every account uses a strong password with TOTP or a passkey and you keep the Hub up to date. If you do, the Hub is as exposed as with a public reverse proxy; read Hardening.

Remove it again #

sudo tailscale serve reset

Then remove POSTERN_PUBLIC_URL and POSTERN_TRUST_PROXY (or replace them for your next option) and restart the Hub.